PHP Chinese Verification Code implementation method

Source: Internet
Author: User

This article is an example of the implementation of PHP Chinese verification code. Share to everyone for your reference. The specific analysis is as follows:

First look at the following effect chart:

The specific code is as follows:

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 5 86 87 88 89 90 91 <?php/********************************* * Code by gently * 24/07/07 * Solemn statement: Verification code for the program randomly generated, "a certain coincidence" of the word combination is a normal phenomenon, * some people with ulterior motives do not Exaggerated *power by Zendstudio.net *********************************/session_start (); Header ("Content-type:image/png"); $w = 180; $h = 60; $fontface = "C:windowsfontsmsyh.ttf"; Font file $STR = "I'll do it when he's going to do it." One of the domestic work on the annual order of righteousness into the Ministry of the People can be out of the party into the discord in the big this is the main man for the students to learn subordinate with a peer to say that the species of life and more than a child after the small machine also through the force line of the electricity high length of the party to the real home of the determination of the deep water physical and chemical dispute now two three All right, 10, no agriculture, no farming, and so on. Pre-and-end anti-body road map put the newly-opened in the knot from the time when the two also gifted the team point of view and in-room in the part of the work gas industry generation of the whole number of fruit stage guide the base or the moon hair however, if you want to make the heart-like dry all to change the question of the exhibition that it is not the most and outside of the Mi Qun of the forest of the first meaning only Ming Four horse recognition of the text but a gram and male hole leading into the seat of the emotional device and fly crude oil put up the question of the construction of the area to test the masses is hereby often stone strong polar soil has been root altogether straight group turn to cut nine you take the West holds the total material second term Zhi view tune seven Mody Shan Cheng Hundred newspaper more see will true Heat Conservation Committee will repair the branch to Vichan a few first Lao specialized Six-type with the east of the belt, the wind back to the South Canton, the north of the road to make a car to do business by the whole step class set number Levin installed that is the Slavs in order to reach the end of the weaving flowers in the mouth of the fault mining precision gold boundary products to the end of the clear to the million accurate book surgery factory must be away from the sea and the children of the green before the eight test Regulation of the railway in the near---------------------------------------------------------------name Red continued drug mark hard to keep the body tight liquid send quasi-pound angle descending dimension plate XU-he cun the potential end of the technical bottom-bed field to the Divine The value of the Huang in the early morning wheat cut the sound of the Su Zhangmi, the tree fertilizer in the right part of the city and the left page anti-Su-ying quickly called the bad move about Ba Wood province black Wuppe Hati only the needle how to plant Beijing to help raise the king's eyes she grabbed the seedlings of the secondary source of the acid old but sufficient short stroke Xuan the first foot wave bearing powder to practise the fish with the test MANFE loss package to promote the branch of the Zhou Yan division Cuschun Ultra-negative sand seal to reduce the poverty reduction Yangyangiang mu-zhi-yuan-wood-speaking ball towards the medical school ancient rice song listen to the only transmission slip station another Wei word drum just write Liu Weilio fan for a certain work of a set of friends limit Roll creation Law rain let bone far help the first skin sowing the death of Poison Circle Wei Ti Xun control to call Cloud mutual with split grain mother practice Plug Steel top strategy double stay in shield late silk female scatter welding the power plant close to the courtyard cold projectile wrong bulk business visual arts extinguish version strong 0 room light blood double deficiency of the pump to observe the absolute urban spray soil simply no column Li Huanpan magnetic male like trapped Shong off delivery slave side run cover swing contact Star Pine to get Hing alone official mixed Ji according to the not-a-wide winter chapter wet bias eat valve mine fortress responsible ripe to win hard price turn odd a pre-grade review read back co-damage cotton invading ash although spear thick Luo mud egg box palm oxygen love stop once dissolve camp Meng money to do Russia shrink sand back to the force of the young to peel the force of the child which stripping forced to pull the clutch is still fresh bar card coarse medium drilling weak feet afraid of salt end yin Fung Fog Crown C Street Lai Pui-chi-san-ji-Mi-Rui-Mi-mi-mi-sen-sheng-jie-----------Late Silkworm Kang the Rang of the core of the wound-flying dew---------------------------------------------------------- Tooth Bud Yong wa Oblique irrigation Eugeshun pig Ocean rot Please give a smile if the tail beam strong and violent vegetables spike Chu Han green drag cattle dye both autumn and summer to heal the Kinguizhou visit Blow Rong Copper along with the call for the dry Enlightenment, the thorn brain and the penetration of the gap furnace shell sulfur and coal to meet the cast adhesion to the thin-blessed longitudinal choice of the fu Fu Reyen smoke sentence pure gradually tillage run ze slow planting Rutch Tide across the cone Hitch lost ship false light that Zhehwai cut and put the tribute to the strength of the instrument to sink the sins of the ancestors of the car wear goods pin Zimping draw Feed Dragon Library keep build room song Cold Xi elder brother wash the stomach the mirror of the wife and the fat, the sword and the clock shake the handle arguing bamboo Valley selling chaos Virtual Bridge Ober Drive Vertical Road, the net cut wild left seek to make up the town of Yi Sheng resistance to the key to Fu Qing Poly-mo Busy dance encounter So Gu gum yanghu nail benevolence sound track broken stretch lamp to avoid the pan-Yong King Lluja Jie Ganno in the constitution of the strong island attack who Honche cannon to know Ling Egg closed child milk giant private silver Ychintan the Dulle of the fatigue of the mold and the performance of the Shang Dingqin, the stroke of the peak 0 firewood spring afternoon jump in the beam depletion alkali and dig the blade play heap of the chest and the film Slow convex service cut Sichuan snow chain fishing face family of the Yang Zongjio, the flag of the fish filter silicon carbon stocks sit steam condensate unexpectedly trapped gun li-dark holes, you are the song arc explosion of the painting of Jin-qi-Jian-qi-wei-lu Ah kin bean draw mo arrive thumper around seam police pick dirty ice Cambodia mouth what rice plastic send Zhao shout cushion dan du ear planing Tiger pen dilute kun lang tea drop shallow hug point lun Niang ton of immersion sleeve bead female mother purple play tower hammer shock years old, clean, the front of the suspect PA Flash PO Fierce complaint brush Malicious, Joe Tang leak smell shen melt chlorine barren stem men who rob like a pulp side glass also faithful singing Mongolia to catch the lock, especially by Uzhi light allow rebel livestock capture Bilibao core ye Jian Jing jiang calcium shoulder teng withered throw track Hall mix dad 祝励 Ken Wine rope Poor pond dryness bubble bag lang feed aluminum soft drainage of the trade and feces of the full wall of the old ink to the reverse unloading air clothing Sun Ling Ling cheat Hugh Borrow "; $code = ""; For ($i =0 $i <4; $i + +) {$Xi =mt_rand (0,strlen ($STR)/2); if ($Xi%2) $Xi +=1; $code. =substr ($str, $Xi, 2);} $_session[' Code ']= $code; $im =IMAGECREatetruecolor ($w, $h); $bkcolor =imagecolorallocate ($im, 250,250,250); Imagefill ($im, 0,0, $bkcolor); /*** Add Interference ***/for ($i =0 $i <15; $i + +) {$fontcolor =imagecolorallocate ($im, Mt_rand (0,255), Mt_rand (0,255), Mt_rand ( 0,255)); Imagearc ($im, Mt_rand ( -10, $w), Mt_rand ( -10, $h), Mt_rand (30,300), Mt_rand (20,200), 55,44, $fontcolor); For ($i =0 $i <255; $i + +) {$fontcolor =imagecolorallocate ($im, Mt_rand (0,255), Mt_rand (0,255), Mt_rand (0,255)); Imagesetpixel ($im, Mt_rand (0, $w), Mt_rand (0, $h), $fontcolor); /*********** content *********/for ($i =0 $i <4; $i + +) {$fontcolor =imagecolorallocate ($im, Mt_rand (0,120), Mt_rand (0,120 ), Mt_rand (0,120)); This ensures that the color of the random comes out darker. $codex =iconv ("GB2312", "UTF-8", substr ($code, $i *2,2)); Imagettftext ($im, Mt_rand (20,24), Mt_rand (-60,60), 40* $i +20,mt_rand (30,35), $fontcolor, $fontface, $codex); } imagepng ($im);?>

I hope this article will help you with your PHP programming.

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.