kenken999/php
0
1<?php2require_once("include/dbcommon.php");3 4Function randString($stype,$ct)5{6 $i=1;7 $randStr="";8 $randNum="";9 $useList="";10 $alpha="A,B,C,D,E,F,G,H,I,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";11 $secure="!,@,$,%,&,*,-,_,=,+,?,~";12 if($stype=="alpha")13 {14 $randNum=52;15 $useList=$alpha;16 }17 else if($stype=="alphanum")18 {19 $randNum=62;20 $useList=$alpha . ",1,2,3,4,5,6,7,8,9";21 }22 else if($stype=="secure")23 {24 $randNum=73;25 $useList=$alpha . ",0,1,2,3,4,5,6,7,8,9," . $secure;26 }27 else28 {29 $randNum=10;30 $useList="0,1,2,3,4,5,6,7,8,9";31 }32 33 $arr = Array();34 $arr = explode(",",$useList);35 $randNum=count($arr);36 for($i=0;$i<$ct;$i++)37 {38 $randStr=$randStr . $arr[rand(0,$randNum-1)];39 }40 return $randStr;41}42//Modify the randstring variable below to customize your security code.43//- Use 'num' for numbers only44//- Use 'alphanum' for numbers and letters45//- Use 'secure' for numbers, letter and special characters46//Modify the number in the string to reflect how many characters you want your security code to be47 48$_SESSION["captcha_" . $_GET["id"]]=randString("alphanum",6);49?>50&securitycode=<?php echo $_SESSION["captcha_" . $_GET["id"]];?>&