Public Function GetSearchKeyword (Reference) 'Search Keywords ON Error Resume Next Dim Re set re = new regexp Re.ignorecase = True Re.global = True Dim A, B, J RE.PATTERN = "(" _ & "Google. ? Q = ([^ &] *) "&" | sina. ? word = ([^ &] *) "_ &" | SOHU. ? query = ([^ &] *) "&" | 163 . q = ([^ &] *) "_ &" | yahoo. ? p = ([^ &] *) "&" | baidu. ? word = ([^ &] *) "_ & "| OpenFind. ? Q = ([^ &] *)" & "| lycos. ? query = ([^ &] *)" _ & "| aol. ? query = ([^ &] *) "&" | ONSEEK. ? Keyword = ([^ &] *) "_ &" | 3721 / .com. ? p = ([^ &] *) "&" | search / .tom. ? word = ([^ &] *) "_ &") "Set a = re.execute (refererull) if a.count> 0 THEN SET B = a (a.count-1). Submatches for j = 1 to b. Count if len (b (j))> 0 Then getsearchkeyword = b (j): exit function next endSearchkeyword = refererull else getsearchkeyword = "" end if End function
UTF-8 type: such as Google
<% Function utf8code (strutf) 'converts a single UTF string to GB Chinese characters, l = len (strutf) / 9for i = 1 to L astr = left (strutf, 9) if i = l dam = L dam Else Strutf = MID (Strutf, 10, (L-I 1) * 9) End IF
DIM icode, icode1, icode2
iCode = MID (astr, 2, 2) icode1 = mid (astr, 5, 2) icode2 = mid (astr, 8, 2)
ICODE = "& H" & icide iCode1 = "& H" & icide1 iCode2 = "& H" & icode2
Iicode = (iCode and & H0F) Iicode1 = (iCode1 and & H3F) iicode2 = (icode2 and & h3f)
ST = Chrw (Iicode * 2 ^ 12) or Iicode2 'encoded conversion algorithm, test through utf8code = utf8code & stnextend function%> 16 credit conversion 10
<% Function Ten (NUM) for i = 1 to Len (NUM) Temp = MID (Num, I, 1) IF TRIM (TEMP) = "a" THEN TEMP = 10 elseif Trim (TEMP) = "B" THEN TEMP = 11 elseif trim (Temp) = "c" Temp = 12 elseif Trim (TEMP) = "d" Temp = 13 elseif Trim (TEMP) = "e" TEMP = 14 elseif Trim (TEMP) = "f" Temp = 15 end if cf = len (num) -i sum = sum cint (TEMP) * (16 ^ cf) Next Ten = SUM END FUNCTION
'Conversion search engine keyword, such as 3721, Baidu.163, etc. Function FN (ST) JS1 = CDBL (Ten (MID (ST, 2, 2)) * 256) JS2 = CDBL (Ten (MID (ST, 5, 2) )) JS = CDBL (JS1) CDBL (JS2) JS = JS-65536 FN = CHR (JS) End Function%>
<% Function NAF (STR) L = LEN (STR) / 6for J = 1 to L Hz = Left (STR, 6) IF J = L THEN STR = "" Else Str = MID (STR, 7, (L-J 1) * 6) End if naf = NAF & FN (HZ) Nextend Function%>
'3721, baidu, etc.