28,391
社区成员
发帖
与我相关
我的任务
分享
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%
checkcode(1000,9999,'checkcode');
function checkcode(nStart, nOver, sSession){
if(!nStart) nStart=1000;
if(!nOver) nOver=9999;
if(!sSession) sSession='checkcode';
var ar=[10];
//0
ar[0]=new Array('0x3c', '0x66', '0xc3', '0xc3', '0xc3', '0xc3', '0xc3', '0xc3', '0x66', '0x3c');
//1
ar[1]=new Array('0x18', '0x1c', '0x18', '0x18', '0x18', '0x18', '0x18', '0x18', '0x18', '0x7e');
//2
ar[2]=new Array('0x3c', '0x66', '0x60', '0x60', '0x30', '0x18', '0x0c', '0x06', '0x06', '0x7e');
//3
ar[3]=new Array('0x3c', '0x66', '0xc0', '0x60', '0x1c', '0x60', '0xc0', '0xc0', '0x66', '0x38');
//4
ar[4]=new Array('0x38', '0x3c', '0x36', '0x33', '0x33', '0x33', '0xff', '0x30', '0x30', '0xfe');
//5
ar[5]=new Array('0xfe', '0xfe', '0x06', '0x06', '0x3e', '0x60', '0xc0', '0xc3', '0x66', '0x3c');
//6
ar[6]=new Array('0x60', '0x30', '0x18', '0x0c', '0x3e', '0x63', '0xc3', '0xc3', '0x66', '0x3c');
//7
ar[7]=new Array('0xff', '0xc0', '0x60', '0x30', '0x18', '0x18', '0x18', '0x18', '0x18', '0x18');
//8
ar[8]=new Array('0x3c', '0x66', '0xc3', '0x66', '0x3c', '0x66', '0xc3', '0xc3', '0x66', '0x3c');
//9
ar[9]=new Array('0x3c', '0x66', '0xc3', '0xc3', '0x66', '0x3c', '0x18', '0x0c', '0x06', '0x03');
//Response.Buffer = false;
with(Response){
Expires = -1 ;
AddHeader("Pragma","no-cache") ;
AddHeader("cache-ctrol","no-cache");
}
var nNum=fRandomBy(nStart,nOver)+'';
Session(sSession)=nNum;
//Response.write(Session(sSession));
var arDg=[];
for(var i=0; i<nNum.length; i++){
arDg[i]=nNum.charAt(i);
}
var sMarker='\r\n';
var nWidth=8*arDg.length;
var nHeight=10;
Response.ContentType = "image/x-xbitmap"
var sImg='#define counter_width '+nWidth+sMarker+
'#define counter_height '+nHeight+sMarker+
'static unsigned char counter_bits[] = {'+sMarker
for(var i=0; i<10; i++){
for(var j=0, k=arDg.length; j<k; j++){
sImg+=ar[arDg[j]][i]+',';
}
}
sImg=sImg.replace(/\,$/,'');
sImg+='};'+sMarker;
Response.write(sImg);
function fRandomBy(nUnder, nOver){
switch(arguments.length){
case 1: return parseInt(Math.random()*nUnder+1);
case 2: return parseInt(Math.random()*(nOver-nUnder+1) + nUnder);
default: return 0;
}
} // shawl.qiu code
} // end function checkcode(nStart, nOver, sSession)
%>