http://newyork.craigslist.org/mnh/vac/1083225965.html这里
“Reply to:”页面代码为
<a href="mailto:hous-b4njc-1083225965@craigslist.org?subject=$198%20/%201br%20-%20BEAUTIFUL%20Soho%20Apt.%20-%20CHIC%20HOTEL%20ALTERNATIVE%20(SoHo)">hous-b4njc-1083225965@craigslist.org</a>
它使得邮件地址不可见
请问在asp 中这是用什么 函数实现的
7 个解决方案
#1
不像是加密,好像有一定的规律。
这些应该是ASCII码值吧!隔一定的距离就将字符转换成ASCII码值?
这些应该是ASCII码值吧!隔一定的距离就将字符转换成ASCII码值?
#2
Dim ValueStr
ValueStr=RandomConvert("hous-b4njc-1083225965@craigslist.org")
Response.Write ValueStr&"<br />"
Response.Write Replace(Replace(Replace(ValueStr,"&","&"),"#","#"),";",";")
Public Function RandomConvert(ByVal NeedStr)
If NeedStr="" Then RandomConvert="":Exit Function
Dim TempStr,StrLength,StrChar,RandomItem,RandomLen,RandomNum,RandomMaxLen,NumStr,ResultStr
TempStr=NeedStr:StrLength=Len(TempStr)
For RandomItem=0 To StrLength/2
Randomize
If RandomItem=0 Then
RandomMaxLen=1
RandomLen=1
Else
RandomMaxLen=2
RandomLen=StrLength
End If
RandomNum=Int((RandomLen - RandomMaxLen+1 ) * Rnd + RandomMaxLen)
'If RandomNum=RandomLen Then Exit For
If Instr(NumStr,","&RandomNum&",")=0 Then
RandomMaxLen=RandomNum
NumStr=NumStr&RandomNum&","
End If
Next
For StrItem=1 To StrLength
StrChar=Mid(TempStr,StrItem,1)
If Instr(NumStr,","&StrItem&",")>0 Then
ResultStr=ResultStr&"&#"&Asc(StrChar)&";"
Else
ResultStr=ResultStr&StrChar
End If
Next
RandomConvert=ResultStr
End Function
试着写了一下,不过可能还存在一些问题,代码写的也不够简洁! -_-
#3
演示地址:http://www.cnode.cn/Lab/asp/RandomConvert/
#4
这是用php实现的
查看源代码
<a href="mailto:yourname@yourdomain.com">Your Name</a><br /><a href="mailto:yourname@yourdomain.com">yourname@yourdomain.com</a><br />yourname@yourdomain.com
应该是你需要的,但是我没学过asp,无法帮你改了
function asciiEncodeEmail($strEmail,$strDisplay,$blnCreateLink) {
$strMailto = "mailto:";
for ($i=0; $i < strlen($strEmail); $i++) {
$strEncodedEmail .= "&#".ord(substr($strEmail,$i)).";";
}
if(strlen(trim($strDisplay))>0) {
$strDisplay = $strDisplay;
}
else {
$strDisplay = $strEncodedEmail;
}
if($blnCreateLink) {
return "<a href=\"".$strMailto.$strEncodedEmail."\">".$strDisplay."</a>";
}
else {
return $strDisplay;
}
}
echo asciiEncodeEmail("yourname@yourdomain.com","Your Name",true);
echo "<br />";
echo asciiEncodeEmail("yourname@yourdomain.com","",true);
echo "<br />";
echo asciiEncodeEmail("yourname@yourdomain.com","",false);
查看源代码
<a href="mailto:yourname@yourdomain.com">Your Name</a><br /><a href="mailto:yourname@yourdomain.com">yourname@yourdomain.com</a><br />yourname@yourdomain.com
应该是你需要的,但是我没学过asp,无法帮你改了
#5
这个代码是php帮助文档提供的,应该没有错误啊!
#6
&#(\d+);或者&#x([A-Fa-f0-9]+);
是Unicode的表达方式,一般都是用来编码双字节字符的,例如简体繁体这些字符,他这样用只是想隐藏Email地址
是Unicode的表达方式,一般都是用来编码双字节字符的,例如简体繁体这些字符,他这样用只是想隐藏Email地址
'Unicode 编码
Public Function UniEncode(ByVal strData)
Dim i, l, ret
l = Len(strData)
ReDim ret(l - 1)
For i = 1 To l
ret(i - 1) = "&#" & (AscW(Mid(strData, i, 1)) And &HFFFF&) & ";"
Next
UniEncode = Join(ret, Empty)
End Function
'Unicode 解码
Public Function UniDecode(ByVal strData)
Dim reg, arr, ptr
Dim ret, pos
Set reg = New RegExp
reg.Global = True
reg.Pattern = "&#(\d+);"
Set arr = reg.Execute(strData)
pos = 1
For Each ptr In arr
ret = ret & Mid(strData, pos, ptr.FirstIndex + 1 - pos)
pos = ptr.FirstIndex + 1 + ptr.Length
ret = ret & ChrW(CLng(ptr.SubMatches(0)))
Next
Set arr = Nothing
Set reg = Nothing
ret = ret & Mid(strData, pos)
UniDecode = ret
End Function
Dim tmp
tmp = UniEncode("hous-b4njc-1083225965@craigslist.org")
Response.Write "<a href=""mailto:" & tmp & """>" & tmp & "</a><br/>"
Response.Write UniDecode(tmp) & "<br/>"
#7
楼上的兄弟你太有才了!谢谢,我也找到了~
---------------------------------------------
PHP代码
function uni($str) {
$ret = '';
for($i=0;$i<mb_strlen($str,'utf-8');$i=$i+1) {
$ret .= "&#" . uniord(mb_substr($str, $i, 1, 'utf-8')) . ";";
}
return $ret;
}
echo uni("海海家园");
function unichr($u) {
return mb_convert_encoding(pack("N",$u), mb_internal_encoding(), 'UCS-4BE');
}
function uniord($u) {
$c = unpack("N", mb_convert_encoding($u, 'UCS-4BE', 'UTF-8'));
return $c[1];
}
JavaScript 版本
JavaScript代码
<script>
function unicode(s){
var len=s.length;
var rs="";
alert(len);
for(var i=0;i<len;i++){
var k=s.substring(i,i+1);
rs+="&#"+s.charCodeAt(i)+";";
}
return rs;
}
function runicode(s){
var k=s.split(";");
var rs="";
for(i=0;i<k.length;i++){
var m=k[i].replace(/&#/,"");
rs+=String.fromCharCode(m);
}
return rs;
}
//alert(unicode("我是一个神"));//我是一个神
//alert(runicode("我是一个神"));
</script>
从朋友那得到的新方法:(2007.8.14)
JavaScript代码
<script language="javascript" type="text/javascript">
var oSource = document.getElementById("source");
var oShow2 = document.getElementById("show2");
var oTt = document.getElementById("tt");
function action(pChoice){
switch(pChoice){
case "CONVERT_FMT1":
oShow2.value = ascii(oSource.value);
break;
case "CONVERT_FMT2":
oShow2.value = unicode(oSource.value);
break;
case "RECONVERT":
oShow2.value = reconvert(oSource.value);
break;
}
}
function ascii(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\$2;")});
}
function unicode(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\\u$2")});
}
function reconvert(str){
str = str.replace(/(\\u)(\w{4})/gi,function($0){
return (String.fromCharCode(parseInt((escape($0).replace(/(%5Cu)(\w{4})/g,"$2")),16)));
});
str = str.replace(/()(\w{4});/gi,function($0){
return String.fromCharCode(parseInt(escape($0).replace(/(%26%23x)(\w{4})(%3B)/g,"$2"),16));
});
return str;
}
</script>
---------------------------------------------
PHP代码
function uni($str) {
$ret = '';
for($i=0;$i<mb_strlen($str,'utf-8');$i=$i+1) {
$ret .= "&#" . uniord(mb_substr($str, $i, 1, 'utf-8')) . ";";
}
return $ret;
}
echo uni("海海家园");
function unichr($u) {
return mb_convert_encoding(pack("N",$u), mb_internal_encoding(), 'UCS-4BE');
}
function uniord($u) {
$c = unpack("N", mb_convert_encoding($u, 'UCS-4BE', 'UTF-8'));
return $c[1];
}
JavaScript 版本
JavaScript代码
<script>
function unicode(s){
var len=s.length;
var rs="";
alert(len);
for(var i=0;i<len;i++){
var k=s.substring(i,i+1);
rs+="&#"+s.charCodeAt(i)+";";
}
return rs;
}
function runicode(s){
var k=s.split(";");
var rs="";
for(i=0;i<k.length;i++){
var m=k[i].replace(/&#/,"");
rs+=String.fromCharCode(m);
}
return rs;
}
//alert(unicode("我是一个神"));//我是一个神
//alert(runicode("我是一个神"));
</script>
从朋友那得到的新方法:(2007.8.14)
JavaScript代码
<script language="javascript" type="text/javascript">
var oSource = document.getElementById("source");
var oShow2 = document.getElementById("show2");
var oTt = document.getElementById("tt");
function action(pChoice){
switch(pChoice){
case "CONVERT_FMT1":
oShow2.value = ascii(oSource.value);
break;
case "CONVERT_FMT2":
oShow2.value = unicode(oSource.value);
break;
case "RECONVERT":
oShow2.value = reconvert(oSource.value);
break;
}
}
function ascii(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\$2;")});
}
function unicode(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\\u$2")});
}
function reconvert(str){
str = str.replace(/(\\u)(\w{4})/gi,function($0){
return (String.fromCharCode(parseInt((escape($0).replace(/(%5Cu)(\w{4})/g,"$2")),16)));
});
str = str.replace(/()(\w{4});/gi,function($0){
return String.fromCharCode(parseInt(escape($0).replace(/(%26%23x)(\w{4})(%3B)/g,"$2"),16));
});
return str;
}
</script>
#1
不像是加密,好像有一定的规律。
这些应该是ASCII码值吧!隔一定的距离就将字符转换成ASCII码值?
这些应该是ASCII码值吧!隔一定的距离就将字符转换成ASCII码值?
#2
Dim ValueStr
ValueStr=RandomConvert("hous-b4njc-1083225965@craigslist.org")
Response.Write ValueStr&"<br />"
Response.Write Replace(Replace(Replace(ValueStr,"&","&"),"#","#"),";",";")
Public Function RandomConvert(ByVal NeedStr)
If NeedStr="" Then RandomConvert="":Exit Function
Dim TempStr,StrLength,StrChar,RandomItem,RandomLen,RandomNum,RandomMaxLen,NumStr,ResultStr
TempStr=NeedStr:StrLength=Len(TempStr)
For RandomItem=0 To StrLength/2
Randomize
If RandomItem=0 Then
RandomMaxLen=1
RandomLen=1
Else
RandomMaxLen=2
RandomLen=StrLength
End If
RandomNum=Int((RandomLen - RandomMaxLen+1 ) * Rnd + RandomMaxLen)
'If RandomNum=RandomLen Then Exit For
If Instr(NumStr,","&RandomNum&",")=0 Then
RandomMaxLen=RandomNum
NumStr=NumStr&RandomNum&","
End If
Next
For StrItem=1 To StrLength
StrChar=Mid(TempStr,StrItem,1)
If Instr(NumStr,","&StrItem&",")>0 Then
ResultStr=ResultStr&"&#"&Asc(StrChar)&";"
Else
ResultStr=ResultStr&StrChar
End If
Next
RandomConvert=ResultStr
End Function
试着写了一下,不过可能还存在一些问题,代码写的也不够简洁! -_-
#3
演示地址:http://www.cnode.cn/Lab/asp/RandomConvert/
#4
这是用php实现的
查看源代码
<a href="mailto:yourname@yourdomain.com">Your Name</a><br /><a href="mailto:yourname@yourdomain.com">yourname@yourdomain.com</a><br />yourname@yourdomain.com
应该是你需要的,但是我没学过asp,无法帮你改了
function asciiEncodeEmail($strEmail,$strDisplay,$blnCreateLink) {
$strMailto = "mailto:";
for ($i=0; $i < strlen($strEmail); $i++) {
$strEncodedEmail .= "&#".ord(substr($strEmail,$i)).";";
}
if(strlen(trim($strDisplay))>0) {
$strDisplay = $strDisplay;
}
else {
$strDisplay = $strEncodedEmail;
}
if($blnCreateLink) {
return "<a href=\"".$strMailto.$strEncodedEmail."\">".$strDisplay."</a>";
}
else {
return $strDisplay;
}
}
echo asciiEncodeEmail("yourname@yourdomain.com","Your Name",true);
echo "<br />";
echo asciiEncodeEmail("yourname@yourdomain.com","",true);
echo "<br />";
echo asciiEncodeEmail("yourname@yourdomain.com","",false);
查看源代码
<a href="mailto:yourname@yourdomain.com">Your Name</a><br /><a href="mailto:yourname@yourdomain.com">yourname@yourdomain.com</a><br />yourname@yourdomain.com
应该是你需要的,但是我没学过asp,无法帮你改了
#5
这个代码是php帮助文档提供的,应该没有错误啊!
#6
&#(\d+);或者&#x([A-Fa-f0-9]+);
是Unicode的表达方式,一般都是用来编码双字节字符的,例如简体繁体这些字符,他这样用只是想隐藏Email地址
是Unicode的表达方式,一般都是用来编码双字节字符的,例如简体繁体这些字符,他这样用只是想隐藏Email地址
'Unicode 编码
Public Function UniEncode(ByVal strData)
Dim i, l, ret
l = Len(strData)
ReDim ret(l - 1)
For i = 1 To l
ret(i - 1) = "&#" & (AscW(Mid(strData, i, 1)) And &HFFFF&) & ";"
Next
UniEncode = Join(ret, Empty)
End Function
'Unicode 解码
Public Function UniDecode(ByVal strData)
Dim reg, arr, ptr
Dim ret, pos
Set reg = New RegExp
reg.Global = True
reg.Pattern = "&#(\d+);"
Set arr = reg.Execute(strData)
pos = 1
For Each ptr In arr
ret = ret & Mid(strData, pos, ptr.FirstIndex + 1 - pos)
pos = ptr.FirstIndex + 1 + ptr.Length
ret = ret & ChrW(CLng(ptr.SubMatches(0)))
Next
Set arr = Nothing
Set reg = Nothing
ret = ret & Mid(strData, pos)
UniDecode = ret
End Function
Dim tmp
tmp = UniEncode("hous-b4njc-1083225965@craigslist.org")
Response.Write "<a href=""mailto:" & tmp & """>" & tmp & "</a><br/>"
Response.Write UniDecode(tmp) & "<br/>"
#7
楼上的兄弟你太有才了!谢谢,我也找到了~
---------------------------------------------
PHP代码
function uni($str) {
$ret = '';
for($i=0;$i<mb_strlen($str,'utf-8');$i=$i+1) {
$ret .= "&#" . uniord(mb_substr($str, $i, 1, 'utf-8')) . ";";
}
return $ret;
}
echo uni("海海家园");
function unichr($u) {
return mb_convert_encoding(pack("N",$u), mb_internal_encoding(), 'UCS-4BE');
}
function uniord($u) {
$c = unpack("N", mb_convert_encoding($u, 'UCS-4BE', 'UTF-8'));
return $c[1];
}
JavaScript 版本
JavaScript代码
<script>
function unicode(s){
var len=s.length;
var rs="";
alert(len);
for(var i=0;i<len;i++){
var k=s.substring(i,i+1);
rs+="&#"+s.charCodeAt(i)+";";
}
return rs;
}
function runicode(s){
var k=s.split(";");
var rs="";
for(i=0;i<k.length;i++){
var m=k[i].replace(/&#/,"");
rs+=String.fromCharCode(m);
}
return rs;
}
//alert(unicode("我是一个神"));//我是一个神
//alert(runicode("我是一个神"));
</script>
从朋友那得到的新方法:(2007.8.14)
JavaScript代码
<script language="javascript" type="text/javascript">
var oSource = document.getElementById("source");
var oShow2 = document.getElementById("show2");
var oTt = document.getElementById("tt");
function action(pChoice){
switch(pChoice){
case "CONVERT_FMT1":
oShow2.value = ascii(oSource.value);
break;
case "CONVERT_FMT2":
oShow2.value = unicode(oSource.value);
break;
case "RECONVERT":
oShow2.value = reconvert(oSource.value);
break;
}
}
function ascii(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\$2;")});
}
function unicode(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\\u$2")});
}
function reconvert(str){
str = str.replace(/(\\u)(\w{4})/gi,function($0){
return (String.fromCharCode(parseInt((escape($0).replace(/(%5Cu)(\w{4})/g,"$2")),16)));
});
str = str.replace(/()(\w{4});/gi,function($0){
return String.fromCharCode(parseInt(escape($0).replace(/(%26%23x)(\w{4})(%3B)/g,"$2"),16));
});
return str;
}
</script>
---------------------------------------------
PHP代码
function uni($str) {
$ret = '';
for($i=0;$i<mb_strlen($str,'utf-8');$i=$i+1) {
$ret .= "&#" . uniord(mb_substr($str, $i, 1, 'utf-8')) . ";";
}
return $ret;
}
echo uni("海海家园");
function unichr($u) {
return mb_convert_encoding(pack("N",$u), mb_internal_encoding(), 'UCS-4BE');
}
function uniord($u) {
$c = unpack("N", mb_convert_encoding($u, 'UCS-4BE', 'UTF-8'));
return $c[1];
}
JavaScript 版本
JavaScript代码
<script>
function unicode(s){
var len=s.length;
var rs="";
alert(len);
for(var i=0;i<len;i++){
var k=s.substring(i,i+1);
rs+="&#"+s.charCodeAt(i)+";";
}
return rs;
}
function runicode(s){
var k=s.split(";");
var rs="";
for(i=0;i<k.length;i++){
var m=k[i].replace(/&#/,"");
rs+=String.fromCharCode(m);
}
return rs;
}
//alert(unicode("我是一个神"));//我是一个神
//alert(runicode("我是一个神"));
</script>
从朋友那得到的新方法:(2007.8.14)
JavaScript代码
<script language="javascript" type="text/javascript">
var oSource = document.getElementById("source");
var oShow2 = document.getElementById("show2");
var oTt = document.getElementById("tt");
function action(pChoice){
switch(pChoice){
case "CONVERT_FMT1":
oShow2.value = ascii(oSource.value);
break;
case "CONVERT_FMT2":
oShow2.value = unicode(oSource.value);
break;
case "RECONVERT":
oShow2.value = reconvert(oSource.value);
break;
}
}
function ascii(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\$2;")});
}
function unicode(str){
return str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"\\u$2")});
}
function reconvert(str){
str = str.replace(/(\\u)(\w{4})/gi,function($0){
return (String.fromCharCode(parseInt((escape($0).replace(/(%5Cu)(\w{4})/g,"$2")),16)));
});
str = str.replace(/()(\w{4});/gi,function($0){
return String.fromCharCode(parseInt(escape($0).replace(/(%26%23x)(\w{4})(%3B)/g,"$2"),16));
});
return str;
}
</script>