PHP Production Verification Code

Source: Internet
Author: User
Tags ming

<?php

/* Set English Digital Verification code */

/*

Session_Start ();

$image =imagecreatetruecolor (100,30);

Create a background color of white

$bgcolor =imagecolorallocate ($image, 255, 255, 255);

Fill the background with white

Imagefill ($image, 0, 0, $bgcolor);

$capth _code= ';

*/

/* Generate a pure digit verification code */

/*

for ($i =0; $i <4; $i + +) {

$fontsize =6;//Font Size

Set Dark font Color

$fontcolor =imagecolorallocate ($image, Rand (0,120), Rand (0,120), Rand (0,120));

$fontcontent =rand (0,9);//Verification Code content

$capth _code.= $fontcontent;

The coordinates of the text placement

$x = ($i *100/4) +rand (5,10);

$y =rand (5,10);

Imagestring ($image, $fontsize, $x, $y, $fontcontent, $fontcolor);

}

*/

/* Generate English alphabet and digital verification code

for ($i =0; $i <4; $i + +) {

$fontsize =6;//Font Size

Set Dark font Color

$fontcolor =imagecolorallocate ($image, Rand (0,120), Rand (0,120), Rand (0,120));

$data = ' abcdefghigklmnopqrstuvwxyz0123456789 ';

$fontcontent =substr ($data, Rand (0,strlen ($DATA)), 1);//Verification Code content

$capth _code.= $fontcontent;

The coordinates of the text placement

$x = ($i *100/4) +rand (5,10);

$y =rand (5,10);

Imagestring ($image, $fontsize, $x, $y, $fontcontent, $fontcolor);

}

$_session[' Authcode ']= $capth _code;

Draw interference elements

Draw interference points

for ($i =0; $i <200; $i + +) {

Set the color of a light point

$pointcolor =imagecolorallocate ($image, Rand (50,200), Rand (50,200), Rand (50,200));

Imagesetpixel ($image, Rand (1,99), Rand (1,29), $pointcolor);

}

Draw interference Lines

for ($i =0; $i <3; $i + +) {

$linecolor =imagecolorallocate ($image, Rand (1,99), Rand (1,99), Rand (1,99));

Imageline ($image, Rand (1,99), Rand (1,29), Rand (1,99), Rand (1,29), $linecolor);

}

Output picture Information

Header (' content-type:image/png ');

Imagepng ($image);

Imagedestroy ($image);

*/


/* Generate Chinese Verification code */

Session_Start ();

$image =imagecreatetruecolor (200,60);//Chinese is larger than

$bgcolor =imagecolorallocate ($image, 255, 255, 255);

Fill the background with white

Imagefill ($image, 0, 0, $bgcolor);

$wordstr = ' Ah Ae, alas, Ai cancer ai ai-ai, I press the Dark bank amine, the Alang ao ao regretful Australian ba grilled ba-ba scar ba-ba-da-pai-pa-i-bai-Bai-the-beat-PA class moved to the board version of the plate to play with the flap half of the Bang Bang list bladder tied rod pound clam pound beside slander bracts Bao Bao Bo Bao Pao treasure hold report storm Leopard Bao Burst cup tablet sad North generation back shellfish barium times jackal prepared exhausted bake by Ben benzene Ben stupid blow-up pump burst nose than the humble pen bi grate cover Die Jingbirok, the harm will be a wall arm to avoid BIPBA whip edge, make a flat change Bian Shenqiu distinguish and debate braid standard Puma fat Table turtle Suppress not flat bin on bin bin Champagne Bing Bing ice handle bing cake bing disease and glass pineapple sowing pot Pobob beat platinum foil Bo Silk back to the bo bo fishing bu bu feeding patch Not cloth Step book department wipe guess cutting Choi cai Choi meal Ginseng silkworm residual ashamed miserable Cang bin Cang the operation of the rough groove Cao Grass toilet side book test layer rubbing fork stubble Tea Check the difference between the astonished demolition of the Jackal mixed with cicada greedy slander to shovel production chatter Chang Hanzi field taste Chang Chang long to repay the bowel factory open sing the song of Chao Chao the nest noisy speculation car pull the button Chen Chen Chen Dust morning greetings Shen Chan while lining support said City Orange into a ride to punish Cheng Cheng the scale to eat crazy hold spoon pool late relaxation shame teeth waste ruler red fin Chi-Chong Worm Chong Pet reward domain lift Catinaccio thick sorrow raise revenge silk Look at the ugly smelly first out of the kitchen energetically hoe chu in addition to Chu Chu twitching touch of the river in the rafters to pass the boat surge of sores window building bed Chong Blow cooking hammer Vertical chun alcohol lip chun pure stupid poke flaw ci ci porcelain ci This thorn give the second Cong chimneys hasty from the clump of coarse vinegar cluster to promote the sudden the level of Cui urge crisp, the level of the level CuO pinch rub the wrong to take a da play Big Bad dai Dai wear with a bag to be caught idle Dan Tan Shan gall nitrogen but Shishi light birthday Play the ball when the block party swing knife to the island Prayer guide to the Rice mourning road Pirates of the board lights Deng di Deng dike low drop di enemy flute di polyester Zhai entropy to the bottom of the Di Di, the royal younger brother handed the Dian Dian iodine point code indigo Mat Electric Dian Dian store drink Dian Dian Temple pillbox Diao Diao off hanging fishing set down Father disc butterfly Diego Ding ding fixed nail ding tripod ingot fixed throw East Winter dong understand moving building dong threatened frozen hole dou bucket steep bean tease acne Viceroy Poison calf Read the game du plating belly degree crossing Jealousy End short forging section broken satin heap against the pier ton squat Dunton hoarding blunt shield dun duo duo Snatch Stack hide Stomp rudder chop lazy fall moth E goose Russian amount of bad ah choke to suppress e-er and son ear bait Behr Two-second rounds of spent valve method June fan Fan alum Vanadium fan all annoying anti-return fan-Fang Fang Fatty room anti-nuisance imitation visit textile put phenanthrene non-brown fly fat bandits dis bark lung waste boiling fee Fen Fen fen powder fen angry dung Feng Feng seal maple Bee Feng Feng wind crazy feng Sewing, Feng Buddha whether the husband apply the skin hatch, the body of the body of fluorine fu fu metre Francis Fu Fu Fu, the arm of the axe of the intestine house rot to the deputy Fu Fu Fu complex Fu Father Belly negative rich obituary attached to impurity GA The change calcium cover gai gan gan rod gan pole liver drive sense stalk dare Gan gang gang just steel cylinder anus Hillock port bar high paste lamb cake to make a pick draft sue GE Pigeon pimple cut leather gregor clam GE each give root and tillage more Geng Geng Soup Geng Stem Work Gong gong to bow gong Masan Mercury arch gong hook hook ditch gou gou Dog scale construction purchase enough gu mushroom goo hoop gu gu bone gu valley stock so gu-gu employment scraping melon cut coat good turn strange coffin Guan Guan Crown Guan Tube Hall tank accustomed to irrigation light wide stroll the rose regulation GUI GUI Ark of the Turtle, the Executioner roll roll stick pot Guo fruit wrapped in ha skeleton children sea Helium hai harm Han Han Ganghan cold letter shouted Han shake defend the drought regret welding Khan Han tamping Hangzhou Air Trench Hao Shong consumption number Hao Ah drink the Lotus kernel wo and ho box raccoon cut off fromRiver dry, Brown crane, hey, black mark is very hard to hate Hum Heng Heng Heng Bang to bake Rainbow hung Hong Honghong red throat hou hou Hou after shouting thick waiting for Hu Yu Fox Paste Lake Arc Tiger to protect each other Hu Hua 猾 slide painting row Huai Irresolute bosom Huai Bad Huan Huan also slow change the body scheming Huan Huan Huan illusion of the yellow, Huang-Hui spring huang anxiety the flurried lie ash Hui Hui restore Ascarina return to destroy regret Hui Huiyuan dark bribe will be braised hui taboo, painting meat faint marriage soul muddy mixed exclusion A live man's fire or confusion rubbish base machine teratogenic ridiculed chicken Kei, Chi Ji Pole collection and urgent disease jealous level squeeze a few ridges of artichoke technology ji season Kabuki Matsuri throb Ji Ji not only taboo inter-prostitute second Jicha flail Jia add pod buccal fieldoptical potassium false price frame drive marry fighter fight, fried and shoulder difficult rape sealed cocoon inspection Cambodian alkali pick pick Jiang shear reduction recommended sill practice cheap See key arrow pieces Jian Jian ship jian preserves gradually splash stream build stiff ginger Will be the River Jiang Jiang Propeller Award for the carpenter sauce Drop banana pepper Reef coke glue jiao jiao chew stir hinge straightening after blast feet sly jiao dumplings pay twisting suppression of the fermentation of the order is called cellar yer all Straw street stage Rob Festival Orange Jie Jie the end of the mouth to borrow the scabies and the commandments of the towel tendon Jin Kim today and Jin tie Jin only to enter the Shunjin no near the embers of the Jin Jing Devotion stem eye Crystal Whale jing-Jing Jing Fine-grain well------------------Nanjing The wine stall to save the old mortar and uncle blame for the arrest of the sniper anthrax Ju Ju chrysanthemum in the moment to gather to refuse according to the huge distance saw all the words fear the torch drama donation Juan Juan, curl up grasping jms dug stubborn Jue, June June the uniform bacteria June June Chun Chun-ka-chi-kai in the opening of the publication of the geological Prospecting Kan cut to see Kang 亢炕 test copy grilled by ke caustic ke ke a ke shell cough can be thirsty grams carved guest Lesson Ken Chew Ken Pit, empty fear hole control pull mouth buckle kou withered cry cave Bitter Cool Pants Kua cross-over crotch block chopsticks executioner fast wide section of the frame mine orbital conditions loss helmet Kui Peep Kwai Kui kui gui feed unworthy of Kun kun Bale trapped in the widening profile wide la la wax spicy cheer Lai Lai Blue greed bar stop basket Lan calumniate lazy cable rot lang Lang wolf corridor Lang Lang fishing hard prison old man basking casein flood le lei Lei Thunder tired puppets base tracing rib type tear ridge Cold Pear plow Li lei from Li Li Li Li li Lai officials Lili 厉励砾 calendar Lee Curtailing example of the Li-Jian grain lek Force glass and Lotus Lian Lian even sickle-of-the-curtain convergence of the face chain love to practice grain Cool Liang Liang two units of the amount of light to talk about Liao Liao Liao Liao A Liu handcuffs Liao material row crack strong poor hunting Lin Phosphorus Lin Pro the adjacent scale drench rin rental The Ling Ling 0 ages Bell to be in the Lingling Mausoleum Ridge leads the other to slip the sulfur to stay Liu Tumor stream Liu Liulong deaf throat The cage long Ridge gathers the lung Lou Lou to the basket to drain the Burrow Lu Lou Skull LU the LU Lu to carry on the road to be in the way bribery Deer Lu Lu Liu Lu timestamp donkey lu aluminum travel shoes repeatedly ray of chlorine law rate filter green-like-the-luanhe-egg-like-the-moon----the LUN Lun Lun in the Monkey, Lo Luo, Luo luo, ma ma code ma Horse scold? Bury buy Mai sell Mai the pulse of the steamed bread is full of slow diffuse them Mang blind mob busy cat Mao anchor Mao spear rivet Mao hat appearance trade Mei Mei enzyme mold Coal no eyebrow medium magnesium each beauty sister Mei Door stuffy Meng Meng au manganese dream mencius mi Mystery mi mi secret find honey dense power cotton mian mian Mian foetus Burma face Miao Miao Qie Second Temple Miao good contempt kill min min Ming ming name life fallacy touch Mo Mold Film grinding rub the end Mommer mo Desert Lonesome mo conspiracy 牟某拇 male mu Mother's tomb Twilight Screen raise Mu mu mu take which na na rena neon is milk resistant Nainan men difficult to tickle brain hungry inside tender can ni Knani plan you hide tired of the reverse drowning Wilt twist Niang stuffed bird urine pinch nie sin bite tweezers nickel nirvana you lime Caracal ning Nim cow twist button new pus nong Nu nu nu girl warm BDSMThe malaria, the cowardly, Ouchi, and so on, the Lotus-retting-pang-peng-pa-Pai-irresolute pai faction climbing Pan Pan Pan-Pan is sentenced by the side executive fat throw roar planing gun robe run bubble pei embryo pui Bae pay accompany Per spray basin Bang Impeaches Cook Pempong shed boron canopy swelling peng Touch Billet Soft Perak batch of leather split pi beer spleen tired skin secluded fart pedagogical gardening article bias piece cheat drift drift scoop ticket skim the poor product hire ping ping flat with bottle evaluation screen slope pour a lot of bad soul forced meal profile Paving the PU pu Pak pu pu spectrum in the fall period bullying Qi qi seven sad paint qi qi qi, and qi qi, qi qi ride to the flag of the horse, Qi Qi, and then abandon the steam cry, pinch to negotiate the lead thousand move to sign Qian Qian Qian qian money pliers before the shallow cut embedded owe apology gun cavity Qiang Wall Qiang strong grab sled shovel knock Bridge see Joe Clever sheath pry up Qiao out of the nose, and timid steal Qin attack Pro Houguan Qin Qin to seize the birds Bed qin qing light hydrogen pour Qing Ching Cyanide feeling is please Qing Joan Poor autumn Chuchu for prisoners swimming area maggots qu body qu to take marriage caries interest to the circle zygomatic right aldehyde quan limbs Boxing Dog coupons advised lack of acetylene lame but Magpie monopolizing sure sparrow skirt Group then burn Shang flesh soil resist shout let disturb around the heat of the Ren Ren endure the toughness of the knife pregnancy thre throw still day Rong Rong melt Volume velvet redundant kneading soft meat ru coffin such as humiliation ru into the mattress soft Nanri Rui Rui run if weak sprinkle SA Gill sai three umbrella scattered mulberry throat The funeral of the sister sweep of the color of the SHA-Sen monk Sasha Sand kill brake sand silly screen tan Shan Sugiyama cut fan shirt Flash Shan allowance meal good Shantou fans shang injured Shang Shang on still dress shoot slightly burned Shao Shao small whistle Shao luxury credit snake tongue House Pardon the shooting of the Shin body of Arsenic, Shen, Shen Shi Chen, very kidney careful infiltration of the sound of nephews, Sheng the rope to win the remaining Sheng Master lost Lions Wet Poetry of the ten stone pick up the history of the Shi Shi, the beginning of the life of the sword The death of the Persimmon matter is addicted to the Shi-shi, the room of the visual Test received the first Shou Shou life sold by the lean animal vegetable hinge Comb to express the Shu Shu Shushu sparse book Redemption of the ripe potato sorghum rat genus Shu Shu shu number rinse the brush and fall off the handsome bolt tie cream double cool who water sleep tax suck blink Shun said the Shuo the son of the death of the Si-yu, the temple of the private division of the four-like feeding the song to send songs to chant to recite a somo, su Crisp vulgar vegetarian fast millet Curtailing plastic-------------------------although the Sui Dynasty with Sui marrow------------------------bare carbon exploration sigh charcoal Tang Tang Tong Wu Tang sugar If you lie down and run a hot-cut Tao Peach to escape the Tao to get a set of special rattan teng pain transcript ladder pick kick antimony lifting the hoof cry body for hellebore tiglate tears shaving drawer Day Tim Fill Tanaka lick out of the bar Tiao view jump affixed to the hall of the room listen to the hydrocarbon Ting Ting Court of a boat Tong Tong ketone pupil with Copper Tong Tong drum stab tube system pain steal head through convex bald image of the Martu Spit Rabbit Turbulent group of the leg shed Swallow tun buttocks Drag Tuo take off the Camel Pack camel elliptical extension saliva dug wow Frog wa sock crooked outside Pea Bend Bay play stubborn pills finish bowl pull night Wan Sigh wan WAN million wrist Wang Wang death net go to Wang Wang Yi Wei Wei Xiao Wei Wei Wai Wei Weiwei in order for Wei Dimension Reed Withered Committee pseudo Tail Wei is not Wei, Wei-wen, stomach-like to feed the Shing plague temperature mosquito wen smell the grain kiss steady Turbulence asked om Hong scroll vortex nest i wo lie in the Wu Wu Wu framed House No no-no-no-no-no-no, I don't takego cover noon dance insulted Dock e-fog, do not know the mistake of Xi selenium silicon clear hee-hee absorption tin sacrifice dilute interest of the Knee XI-XI west-Rhino possibly attack seat XI spouses XI-milling wash gap play fine blind shrimp box Xia under the jurisdiction of the gap Xia Xia shovel the first fairy fresh fiber Xian xian The Xianxian of the mouth and the mouth of the mouth is the gland stuffing of the trap of the limited line phase box set Incense boxes Xiang Xiangxiang Xiang Xiang detailed want to ring enjoyItem Alley Rubber Elephant to 萧硝霄 to cut the night Xiao Xiao Xiao school Shao laugh effect Wedge some break Scorpion shoes association carrying evil oblique threat harmonic write mechanical unloading crab xie crumbs core zinc Hin Xin xin Xin Heart Letter Peacemaker star Fishy Monkey slumber Xing sentence shape Shing awake Xing surname elder brother fierce chest Hungary feign male Shonghuixio shame rot smell rust show sleeve embroidery Xu Xu Xu need false Hush order animal pension flocculation, the Xuan Xuan, hanging Xuan choice ringworm glare Gorgeous boots xue xue Point snow Blood The feast of advice to seek the training of the flood and the news of the pressure of the Crow duck ah ya bud tooth aphid ya ya Dumb ya, the Yan Yan Swallow the salt strict research rock Yan Yan-yan, Yan, Yan Mesantitis along to cover the Eye Yan Weir Swallow condole to test the Yang Duck seedling Yang Yang the goat Yang Sun Oxygen yang itch Nourishing sample Yang Yao Yao Yao pan yao Bite ladle medicine to Yiu coconut choke yes ye ye also page tuck leaf drag axillary night liquid a one medical IBO iridium according to I Yi Relics Move the instrument of the pancreas suspect Yi Yee Yi chair ant leaning has b yi Yi Assumption yat oats disease also the ethnic Yi Yi-yi, yi-Yin Yin Yin yan yi The shade due to the black yin and yam yin Silver tea Baby Eagle Ching Fluorescent flies Ying win Ying Ying Ying Hard ying yo congestion carbuncle Yong-Yong Ciga Yong Swimming yong with a quiet good worry especially by postal uranium still oil Shang friends right woo glaze lure and young detour in Bon Yu Yu more Yu Yu yu fish and fishing to entertainment rain and Yu Yuyu jade area yu Yu Yin yu The more want to the prison Yu, Yu Motogaki the Yu pre-yu, Yuan Yuan injustice, Shong aid shafts Park staff round ape Yuan, the yuan is willing to complain the yuan Yue Yue Yue Yun Yun Cloud Yunyang uniform meteorite Yun Yun Wine together Ltd Halo Rhyme pregnant turn on the disaster slaughter load again in our save temporary praise dirty bury bad chisel algae jujube morning bath flea noise made soap stove dry responsibility Choice ze thief how to increase the hatred has given Slag rolling guillotine brake blink grid Squeeze I was a cheat pick Zhai Zhai Narrow debt Zhai Zhan-precipitous peak stick-stick cut rolling in the exhibition dip stack Zhan Zhan Zhang Yi Zhang Zhang Palm rise Zhang Zhang Miasma obstacle recruit Zhao find Marsh Zhao Zhao cover trillion Zhao turn zhe sting of germanium cane this Zhe zhen to be true to check the key to the diagnosis of the shock of the earthquake vibration Town array steamed to make the by of the whole saving Zheng Zheng Frame disease Zheng Branch branch squeak spider known limb lipid juice weaving direct colonization value niece Stop toe only aim paper Zhi Zhi to put the wisdom rank juvenile treatment stagnation in the Chi Zhong Zhong Ji-yi-yi-yi-yi-yi-yi-yi-yi-yi-ji-Zhong-Zhouzhou-yi-yi-yi-yi-Zhou-yi-yi-yi-zhu-zhi-chu-yi the column to help the decay of the storage cast Zhu Zhu, I wish to seize the claw to drag a special brick to earn Zhuan pile Zhuang makeup hit the big cone chasing the Zhun mang quasi-seize the Zhuo table to pick up the burning of the Zi Zi zi seed Self-stain character bristle Brown Zong Zong Zou take a beating rent the foot of a group of fathers curse block drill to the most guilty of the crime of the Zozzo of yesterday, the oak contrived sitting seat ';

$wordarr =str_split ($WORDSTR, 3);//utf-8 encoding, Chinese is 3 bits, if not utf-8 encoding, you need to convert, because the GD library only supports this one encoding

$capth _code= ';

$fontface = ' fzytk. TTF ';

/* Chinese Verification Code */

for ($i =0; $i <4; $i + +) {

$fontcolor =imagecolorallocate ($image, Rand (0,120), Rand (0,120), Rand (0,120));

$index =rand (0,count ($wordarr));

$CN = $wordarr [$index];

$capth _code.= $CN;

Imagettftext ($image, Mt_rand (20,24), Mt_rand ( -60,60), (40* $i +20), Mt_rand (30,35), $fontcolor, $fontface, $CN);

}

$_session[' Authcode ']= $capth _code;

Draw interference elements

Draw interference points

for ($i =0; $i <200; $i + +) {

Set the color of a light point

$pointcolor =imagecolorallocate ($image, Rand (50,200), Rand (50,200), Rand (50,200));

Imagesetpixel ($image, Rand (1,199), Rand (1,59), $pointcolor);

}

Draw interference Lines

for ($i =0; $i <3; $i + +) {

$linecolor =imagecolorallocate ($image, Rand (1,99), Rand (1,99), Rand (1,99));

Imageline ($image, Rand (1,199), Rand (1,59), Rand (1,199), Rand (1,59), $linecolor);

}

Output picture Information

Header (' content-type:image/png ');

Imagepng ($image);

Imagedestroy ($image);


This article is from "Tiger Brother's Blog" blog, please be sure to keep this source http://7613577.blog.51cto.com/7603577/1531696

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.