Chinese character verification code and Formula Verification code
People know that simple numbers or letter verification code can easily be cracked, but the formula verification code or Chinese character verification code is not easy to be cracked,
Therefore, we recommend that you use the verification code, as far as possible to use the Formula verification code or Chinese character verification code.
Here are the two codes I wrote, useful to friends can refer to the following:
Original reproduced from: http://www.phpskill.com/html/show-1-4410-1.html
1. Formula Verification Code:
PhpSession_Start();Header("Content-type:image/png");$num 1=Mt_rand(0,9);//number of first digits$num 2=Mt_rand(1,9);//number of second digits$type _str= "+-*";//Method String Collection$type=substr($type _str,Rand(0,2), 1);//Random Method$change=Mt_rand(1,3);if($change==1){ $code= "$num 1$type$num2=?"; $result= "\ $verifyCode =$num 1$type$num2;"; Eval($result); $_session[' authnum_session '] =$verifyCode; }ElseIf($change==2){ $result= "\ $verifyCode =$num 1$type$num2;"; Eval($result); $code=$num 1.$type." _=".$verifyCode; $_session[' authnum_session '] =$num 2; }ElseIf($change==3){ $result= "\ $verifyCode =$num 1$type$num2;"; Eval($result); $code= "_".$type.$num 2." =".$verifyCode; $_session[' authnum_session '] =$num 1; }$im= Imagecreate (68,28); $black= Imagecolorallocate ($im, 0,0,0); $white= Imagecolorallocate ($im, 255,255,255);$gray= Imagecolorallocate ($im, 200,200,200);$red= Imagecolorallocate ($im, 255, 0, 0); Imagefill ($im, 0, 0,$white); Imagestring ($im, 5, 10, 8,$code,$black); for($i= 0;$i<70;$i++) {Imagesetpixel ($im,Mt_rand(0, 58),Mt_rand(0, 28),$black); Imagesetpixel ($im,Mt_rand(0, 58),Mt_rand(0, 28),$red); Imagesetpixel ($im,Mt_rand(0, 58),Mt_rand(0, 28),$gray); }imagepng ($im); Imagedestroy ($im); ?>
2. Chinese Character Verification Code:
PhpSession_Start();$ch _str= "The first is in the big and the main person for the people of the Labor to move to the domestic with me to he will be a sub-class on the level of the level of righteousness to the Ministry of the public can be out of the side of the side to say that a species of life-size leather and multi-child after self-social plus small machine also through the power line high-volume long party to real home fixed deep method of water physical and chemical dispute two from the Miyoshi 10 war non-agricultural sex before and other anti-body road map of the knot is new Open the matter from when the two also gifted team batch, such as should shape want to make heart-like dry all turn to turn off point of fertility and the inside go due to pieces of the daily profit by the pressure of the whole group number of fruit phase guide the basis or month Mao ran asked it's the most and the outside of the show. Five solutions to the forest of the Mi Qun head meaning only Ming four Ma Wen Tong, but the bar is more than the male hole leader in the flow of the seat and fly crude oil put up the problem of quality refers to the building area We hereby make sure that the ordinary stone strong soil is less than the root of the total integration of the general type of the nine you take the west holding the total material re-election of the concept of the seven mountain-pass hundred more see must be true to protect the Heat committee hand to the branch has to be repaired heath a few first avoid special type six with an indication of the re-safety belt each east of the wind back to the south-canton of the north of the road to make a car to do business by the whole set number of Levin installed that is known as the axis of a single solid-based fast anti-Slavs set up the field weaving calendar The flower is asked to transmit the fault condition of the production of fine gold in the boundary of the boundary clearance to the million true research book operation factory must be away from the head of the sea-right vote son green only to permit the low-cross eight test regulation of the near-the-edge of cloth door iron needs to go to the county soldiers to remove the same-like lead teeth thousand wins fine shadow Ji Bai lattice effect to push the empty matching knife leaf rate said this election to keep the German words to check the half enemy beginning of the film application of the name of the red continuation of the drug mark is difficult to save a probe body tight liquid send quasi-catty angle reduction plate Xu broken the bottom of the technology Bed field potential end sense to God will he cun structure illumination capacity not to engage in the sub-mill Group fire Section calculation of the state-of-the-Huang service morning wheat cutting letter row station sound of the hit Su Zhangmi hou Cao He tree fertilizer on the right side of the City Yan-Keng left page anti-su show bitter English quickly called bad move about Pakistan Timber Province black Wuppe Hati only needle How to implant the King eye she grabbed the side of the seedling to talk about the source of the surrounding food sources of acid old but sufficient short strokes Xuan fall the first ruler wave bearing powder live the house fish With the test engraved enough to mitsuo the graft of the branch of the stem Zhou Yan Division Cuschun Super-negative sand seal change too mold poverty reduction Yangyangiang analysis mu of wood-like ball to medical school ancient rice song listen only to lose slip station Another Wei drum just write Liu Weilio fan for a block a certain work set of friends limit to roll up law rain let bone far help the first skin broadcast gifted death poison Circle Wei Ti Xun control excitation find called cloud mutual crack grain mother practice plug Steel top strategy double stay wrong base suction resistance so inch shield late silk girl scattered Welding Power Plant Pro-school cold and wrong scattered commercial visual arts out of 0 rooms light blood times the lack of the pump observation of the urban Chong spray soil simply no column Li Huanpan magnetic male like trapped Shong off delivery slave side run cover swing from the touch star Pine to get the independence of the official mixed Ji Yi the non-frame wide winter chapter wet partial grain to eat hold valve mine village responsibility ripe steady win hard price to turn odd a pre-vocational evaluation read Back association damage cotton invasion Ash although spear thick Luo mud to inform egg box palm oxygen loving stop once dissolve camp finally outline Meng money to stay Russia shrinking sand back Chen to beg for the cell of the child, which stripping the rotation of the groove down to hold the arm still AH fresh bar card coarse medium drill weak feet afraid of salt end Yin Feng Production Bee urgent take the expansion of flying dew nuclear margin Rang Central Wu region very fast and easy to order free paper night township long scribe cylinder clip read LAN Anh Ditch b Confucianism kill vapor phosphorus difficult crystal plug the Flame huan Iron supplement our Bud Yongwa Tilt Carbon show Wei tooth Bud Yong wa Oblique irrigation Eugeshun Pig Yang Rot please the meridian of the pulse should laugh if the tail bundle of strong and violent food The more green of the ear-chu-Han and the autumn-time jade-summer healing of the budding Kinguizhou visit to blow Rong copper along the rollers to call for the dry EnlightenmentStab the brain measures to make the gap furnace shell sulfur coal ying casting sticking to the light of the good fortune of the Reyen of the residual smoke sentence pure gradual tillage run ze slow planting Rutch The tide cross the cone Hitch defeat ship false Bright said that the Zhehwai cut pendulum gong The wealth instrument sinks the hemp crime ancestral car to wear the goods sell Zimping draws the dragon Storehouse defends the building the House song Cold Xi elder brother washes the waste to the abdomen to the record mirror the fat village rub the danger like the bell to shake the handle to argue the Bamboo Valley sells the disorderly bridge Ober to drive down the forehead wall NET cut out of the plot of the plot to hang the town of the Fu Qing of the resistance to the aid of the bond to the busy dance encounter So Gu gum yanghu nail benevolence sound trace broken extension lamp to avoid flooding the emperor Liuha Jie Gannon almost the constitution thick island attack who Honche cannon spot understanding the spirit of the egg closed children's milk giant private silver Ychintan Dulle isolation bending performance strokes Shaoxing hu-Call Pain Peak 0 Diesel Spring noon jump Shang Dingqin slightly chase beam depletion alkali grade dig blade drama heap Hittite chest Value Qin film In the case of the seedling slow convex service shears Sichuan snow chain fishing face Home Yang Zongjio Buy the flag filter silicon carbon stocks sitting steam coagulation unexpectedly trapped gun dark hole the barrel of your Song arc explosion fallacy Tu Jin arm barrier brown land Ah Jian Zun Bean pull mo arrive thumper around slit police pick dirty ice Cambodian mouth what rice plastic send Zhao shout mat Kang The garden cavity order fragrant Meat Brother house sensitive to forget clothes Sun Ling Ridge cheat Hugh borrow Dan Watanabe planing Tiger Pen dilute kun tea drop shallow hug mouth cover lun Niang ton dip sleeve Beads The female mother purple play Tower hammer quake old appearance clean the front of the fire, the fire of the Flash PO fierce and sudden disaster, Joe Tang leak smell shen melt chlorine waste stem man where rob like Pulp beside the glass also loyal sing to catch lock, especially by Uzhi pale allowable rebel livestock prisoner feel rust sweep Bilibao core ye Jian-jiang calcium shoulder teng withered throw rail Hall mix dad lure 祝励 Ken wine rope Poor pond dry bubble bag long feeding aluminum soft channel of habitual trade manure wall trend of the second phase of the anti-dumping fog Crown C Street Lai Pui spoke intestinal fu ji infiltration The moment of the late Silkworm--------hung------Jim;$len= Mb_strlen ($ch _str, "Utf-8");//Chinese character length$str=Array(); for($i= 0;$i<4;$i++){ $pos=Mt_rand(0,$len-5);//Start Position $str[] = Mb_substr ($ch _str,$pos, 1, "Utf-8");}$authnum _session=implode("",$str);$_session[' authnum_session '] =$authnum _session;//Log to sessionHeader("Content-type:image/png");//the length and height of the picture$image _x=100;$image _y=50;$im= Imagecreate ($image _x,$image _y);//here to take the image of the white background$bkg= Imagecolorallocate ($im, 255,255,255);//Display the font style, this will put the file in the corresponding directory, if you do not have files, go to the window font file to find a bar. $fnt= "Simhei.ttf";//assign some colors to an image$white=imagecolorallocate ($im, 234,185,95);//To draw an elliptical arc on a picture, specify the next coordinate pointImagearc ($im, 150, 8, 20, 20, 75, 170,$white); Imagearc ($im, 180, 7, 50, 30, 75, 175,$white);//draw a line segment on the picture to specify the next coordinate pointImageline ($im, 20,20,180,30,$white); Imageline ($im, 20,18,170,50,$white); Imageline ($im, 25,50,80,50,$white);//the number of chaotic points$noise _num=3000;$line _num=50;//the colors of various chaotic characters$rectangle _color=imagecolorallocate ($im, 0XAA,0XAA,0XAA);$noise _color=imagecolorallocate ($im, 0x00,0x00,0x00);$font _color=imagecolorallocate ($im, 0x00,0x00,0x00); for($i= 0;$i<$noise _num;$i++){ //draw a single pixel at a coordinate point, which is defined above and is black. Imagesetpixel ($im, Mt_rand (0, $image _x), Mt_rand (0, $image _y), $noise _color);} for($i= 0;$i<$line _num;$i++){ $line _color=imagecolorallocate ($im,Mt_rand(0,255),Mt_rand(0,255),Mt_rand(0,255)); //draw a line between two coordinate points, the color defined aboveImageline ($im,Mt_rand(0,$image _x),Mt_rand(0,$image _y),Mt_rand(0,$image _x),Mt_rand(0,$image _y),$line _color); } for($i= 0;$i<4;$i++) {Imagettftext ($im,Rand(18,20),Rand(0,20),Rand(($image _x/4) *$i+$image _x/100, ($image _x/4) *$i+$image _x/8),Rand($image _y/2+$image _y/10,$image _y/2+$image _y/5),$font _color,$fnt,$str[$i]); }imagepng ($im); Imagedestroy ($im);?
Attached font file: Simhei.rar
Attention:
The Chinese character verification code executes separately, then obtains the session to discover the verification code and the session content is inconsistent. However, in the IMG tag in the SRC attribute referenced in the Chinese character verification code file, and then get the session, when the two content is consistent.
The reason is ominous, if any friend knows, hope the following message!
Original reproduced from: http://www.phpskill.com/html/show-1-4410-1.html
PHP Pure Technology Group 323899029
-
1/ F Waitkey
-
Chinese character verification code is executed separately, then the session will find that the verification code and session content is inconsistent. , in Firefox will have this problem, alone in the address bar to access a picture, the browser will request to the server two times (sometimes more), in the end Firefox itself, or some plug-ins caused by the current cause unknown.
-
Re: phpskill
-
@waitkey, yes!