顯示具有 foxpro 標籤的文章。 顯示所有文章
顯示具有 foxpro 標籤的文章。 顯示所有文章

2012/09/16

foxweb 根據 hostname 出現不同圖檔


PROCEDURE test2
 
alonehtml=.t.
 
crlf=chr(13)+chr(10)
 
br='<br>'
 
 html_out = 'Content-type: text/html'+crlf+crlf ;
  +'<html><body>';
  +'cookie:'+cgi.cookie+br;
  +'cookieLen:'+str(len(cgi.cookie))+br;
  +userid+br;
  +cgi.remotehost+br;
  +'programpath:'+cgi.programpath+br;
  +cgi.querystring
 
 html_out=html_out;
  +'javascript....<br>';
  +[ <script language=javascript> ]+crlf;
  +[  s1=window.location.hostname;]+crlf;
  +[  p1=s1.indexOf('domain.com');]+crlf;
  +[  alert (p1)]+crlf;
  +[  if (p1>0) { alert ('bingo!')]+crlf;
  +[    alert('bingo2!')]+crlf;
  +[    document.write('<img src=http://pexhome.com/img6/pexhometitle.jpg>');]+crlf;
  +[  } ]+crlf;
  +[ </script> ]+crlf
 
 
** foxpro simple encrypt code ** function code from netware
select userdb
scan
s2=aencode(password)
s3=adecode(s2)
? password,s2,s3
endscan


**********************************************************************
* Program....: AEnCode.PRG
* Compiler...: Visual FoxPro 06.00.8492.00 for Windows
* Abstract...: Encrypt a Password
**********************************************************************
FUNCTION aencode(tcKeyWord)
LOCAL lcRaw, lnVar, lcEnc
IF TYPE('tcKeyWord') # "C" OR EMPTY(tcKeyWord)
*** Must pass a character key to this process
ERROR( "9000: A Character string is the required parameter for AEnCode" )
RETURN ""
ENDIF
lcRaw = UPPER(ALLTRIM(tcKeyWord)) && Keyword
lnVar = INT(RAND() * 10) && Random Number Key: 0 - 9
lcEnc = ALLTRIM(STR(lnVar)) && Encrypted string starts with key #
*** Parse the Keyword and encrypt each character
*** Using its ASCII code + 17 + Random Key + Position in Keyword
FOR lnCnt = 1 TO LEN(lcRaw)
lcChar = SUBSTR(lcRaw, lnCnt,1)
lcEnc = lcEnc + CHR( ASC(lcChar) + 17 + lnVar + lnCnt + 1)
NEXT
RETURN lcEnc
**********************************************************************
* Program....: ADeCode.PRG
* Compiler...: Visual FoxPro 06.00.8492.00 for Windows
* Abstract...: Decodes a password encrypted with AEnCode()
**********************************************************************
FUNCTION adecode(tcKeyWord)
LOCAL lcRaw, lnVar, lcEnc
IF TYPE('tcKeyWord') # "C" OR EMPTY(tcKeyWord)
*** Must pass a character key to this process
ERROR( "9000: An Encrypted string is the required parameter for ADeCode" )
RETURN ""
ENDIF
lcEnc = ALLTRIM(tcKeyWord) && Keyword
lnVar = VAL(LEFT(lcEnc,1)) && Encryption Key
lcRaw = "" && Decoded Password
*** Parse the Keyword and decrypt each character
*** Using its ASCII code + 17 + Random Key + Position in Keyword
FOR lnCnt = 2 TO LEN(lcEnc)
lcChar = SUBSTR(lcEnc, lnCnt, 1)
lcRaw = lcRaw + CHR( ASC(lcChar) - (17 + lnVar + lnCnt) )
NEXT
RETURN lcRaw