PHP alphanumeric verification Code and Chinese Verification Code

Source: Internet
Author: User

1: Alpha-numeric combination of verification codes

HTML code:

1 captcha:<type= "text"  name= "code"> 2 <  onclick= "this.src="./gd.php?aa= ' +math.random () "  src="./gd.php "  />

PHP Code:

1 //generate random Verification code characters2 $str= "ABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZ";3 $str=Str_shuffle($str);4 $code=substr($str, 0,5);5 6 Session_Start();7 $_session[' Code ']=$code;8 //Create a canvas9 $image=imagecreatetruecolor (100, 30);Ten //Define Color One $red=imagecolorallocate ($image, 255, 0, 0); A //Random Color -  -  the //randomly generated interference line color - functionRandlinecolor ($image){ -      returnImagecolorallocate ($image,Rand(0,150),Rand(0,150),Rand(0,150)); -  } +  - //randomly generated font color +  functionRandtextcolor ($image){ A      returnImagecolorallocate ($image,Rand(150,255),Rand(150,255),Rand(150,255)); at  } -   -  //start writing on the canvas -Imagestring ($image,Rand(2,5),Rand(0,60),Rand(0,15),$code, Randtextcolor ($image)); -   - //generates 5 lines of interference in  for($i= 0;$i<5;$i++){ -Imageline ($image, 0,Rand(0,30), 100,Rand(0,30), Randlinecolor ($image)); to  } +   -  //tells the browser to return in image/png form the  Header("Content-type:image/png"); *  $  //back to picturesPanax NotoginsengImagepng ($image); -  the //destroying a picture resource +Imagedestroy ($image);

1: Chinese Character Verification Code:

1 //produce random Chinese characters and common kanji2 $str= "They take me to he will do when the domestic one is a work on the annual order of the Ministry of the People can be out of the party into the big and this is the main person in order to learn the subordinate to a peer to say that a kind of life-size leather and many children since the social plus small machine also through the power line of high-volume long party to the real home fixed deep method of water physical and chemical dispute is two from the Miyoshi 10 war no agricultural sex before and other anti-body road map to the knot in the new Open the matter from when the two also gifted the team to make a point of fertility and the inner part of the cause of the day by the pressure of the gas industry on behalf of the whole group number of fruit phase guide the basis or the moon hair, such as the shape of the heart-like dry all to turn off ask the exhibition that it does not look at the most and outside of the five solutions to the forest Mi Qun head meaning only four Ma Wen Tong, but the bar and the male hole leader inflow into the seat of the EQ 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 spiral of the groove upside down and still ah fresh bar card coarse medium drill weak feet afraid of salt end Yin Feng Fog Crown C Street Lai Pui spoke intestines pay Ji Infiltration Rui surprise Dayton squeeze seconds hung Sam Rotten sugar Saint the concave pottery word late silkworm billion moment Kang by the amplitude of the garden cavity order fragrant Meat Brother house sensitive to produce bee urgent take spread injury flying dew Nuclear margin Rang Central Wu-hui-xu-free night township long scribe cylinder clip read LAN Anh Ditch b Confucianism kill vapor phosphorus difficult Crystal Plug Flame Huan Iron complement our Bud Yongwa dip array Carbon-bearing Eugeshun Bud Yong-wa oblique irrigation pig yang rot pleaseDangerous vein should laugh if the tail of the strong and the green vegetables Spike Chu Han greener Drag cattle part dyeing both autumn and forge Jade Summer healing Kinguizhou visit Blowing Rong Copper along the rollers to call the drought awareness stab the brain of the penetration of the furnace shell sulfur coal ying casting adhesion a good blessing in the light of the Reyen, may be residual smoke sentence pure gradually tillage run ze slow planting Rutch rich tide cross-cut cone Hitch defeat ship false Light said that the Zhehwai cut pendulum tribute to the Jin Money instrument shen Lian ma sin ancestral car wear cargo pin Zimping pump Draw the Dragon Storehouse keep building house song Cold Xi elder brother wash eclipse waste na abdomen by the record mirror women's fat zhuang rub risk praise clock shake the handle of Bamboo Valley sell Chaos Bridge Ober to catch up the wall net cut the plot of the road to hang a lesson town pass the rescue worry about the bond to Fu Qing Poly-mo busy dance encounter So Gu gum yanghu nail benevolence sound trace broken extension lamp to avoid flooding the emperor Liuha Jie Gannon about the constitution thick island attack who Honche cannon spot Understanding Spirit Egg Close Child release milk giant private silver Ychintan tired Homogenization of the Dulle of the pain Peak 0 Chai Spring Noon Jump Residence Shang Dingqin slightly chase beam depletion alkali grade hillock dug blade drama reactor load Chest Value Qin film article in the case of seedling slow convex service shears Chuan snow chain fishing face home of the Hubble League buy Yang Zongjio flag filter Silicon carbon stocks sitting steam coagulation unexpectedly trapped gun dark hole you song arc explosion fallacy Tu Jin arm barrier brown land Ah Jian Zun Bean pull mo thumper around seam police pick dirty ice Cambodian mouth what rice plastic send Zhao shout mat Dan Watanabe planing Tiger pen thin kun lang tea drip shallow hug point cover LUN Niang ton dip sleeve beads Female mother purple drama Tower hammer quake old face clean cut the front of the suspect PA Flash PO Fierce and sudden disaster trouble Joe Tang leak smell shen melt chlorine barren stalk man where Rob like the pulp beside the glass also faithful to catch lock, especially by Uzhi, the light allowable rebellious livestock prisoners feel rust sweep Bilibao core Ye jian secret clean jiang calcium shoulder teng withered throw rail Hall mix dad 祝励 Ken Wine rope Poor pond dry bubble bag long feed aluminum soft canal of the habit trade excrement Comprehensive wall trend of the anti-dumping air clothing Sun Ling Ridge cheat Hugh Borrow ";
3 $code=MB_SUBSTR ($str,Rand(0, Floor((strlen($str)/3))-3), 3, "Utf-8");4 5 //Save to $_session6 Session_Start();7 $_session[' Code ']=$code;8 9 //Create a canvasTen $image=imagecreatefromjpeg ("./data/ceshi.jpg"); One  A //randomly generated font color - functionRandtextcolor ($image){ -     returnImagecolorallocate ($image,Rand(150,255),Rand(150,255),Rand(150,255)); the } -  - //fonts (can be found under C:\windows\fonts) - $ziti= "./MSYH.TTC"; +  - //write on the canvas +Imagettftext ($image, 16,Rand(0,360), Randtextcolor ($image),$ziti,$code); A  at //tells the browser to return in image/png form - Header("Content-type:image/png"); -  - //back to pictures -Imagepng ($image); -  in //destroying a picture resource -Imagedestroy ($image);

PHP alphanumeric verification Code and Chinese Verification Code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.