700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > PHP绘图函数生成图片验证码

PHP绘图函数生成图片验证码

时间:2020-04-17 02:35:25

相关推荐

PHP绘图函数生成图片验证码

后端开发|php教程

screenshot,lt,gt,Score,NAME

后端开发-php教程

PHP绘图函数生成图片验证码

钱袋子源码,vscode代码提交git,ubuntu全屏太小,nginx取代tomcat,sqlite免费版下载,前端3d动画用什么框架,python 爬虫的方向和出路,php 5.4 curl,安徽seo优化网络,asp 网站源码,网页目录目录源代码,管理模板lzw

<?php session_start(); // Set some important CAPTCHA constants define(CAPTCHA_NUMCHARS, 6); // number of characters in pass-phrase define(CAPTCHA_WIDTH, 100); // width of image define(CAPTCHA_HEIGHT, 25); // height of image// Generate the random pass-phrase$pass_phrase = ""; for ($i = 0; $i < CAPTCHA_NUMCHARS; $i++) { $pass_phrase .= chr(rand(97, 122)); } // Store the encrypted pass-phrase in a session variable$_SESSION[pass_phrase] = SHA($pass_phrase); // Create the image$img = imagecreatetruecolor(CAPTCHA_WIDTH, CAPTCHA_HEIGHT); // Set a white background with black text and gray graphics$bg_color = imagecolorallocate($img, 255, 255, 255);// white$text_color = imagecolorallocate($img, 0, 0, 0); // black$graphic_color = imagecolorallocate($img, 64, 64, 64); // dark gray// Fill the background imagefilledrectangle($img, 0, 0, CAPTCHA_WIDTH, CAPTCHA_HEIGHT, $bg_color); // Draw some random linesfor ($i = 0; $i < 5; $i++) { imageline($img, 0, rand() % CAPTCHA_HEIGHT, CAPTCHA_WIDTH, rand() % CAPTCHA_HEIGHT, $graphic_color); } // Sprinkle in some random dotsfor ($i = 0; $i

在页面中使用这个生成验证码的脚本

opengl源码,离线语音合成ubuntu,去掉tomcat端口号,爬虫python 入门,e滁州php招聘,马鞍山市seo推广公司lzw

Guitar Wars - Add Your High ScoreGuitar Wars - Add Your High Score 0) && ($screenshot_size <= GW_MAXFILESIZE)) {if ($_FILES[screenshot][error] == 0) { // Move the file to the target upload folder$target = GW_UPLOADPATH . $screenshot; if (move_uploaded_file($_FILES[screenshot][ mp_name], $target)) { // Write the data to the database$query = "INSERT INTO guitarwars (date, name, score, screenshot) VALUES (NOW(), $name, $score, $screenshot)"; mysqli_query($dbc, $query); // Confirm success with the userecho

Thanks for adding your new high score! It will be reviewed and added to the high score list as soon as possible.

.net在线考试源码,小牛课堂ubuntu教程,tomcat怎么连记事本,58同城爬虫协议,php博客视频教程外包,天津推广seolzw

; echo

Name: . $name .

; echoScore: . $score .

; echo

; echo

<< Back to high scores

; // Clear the score data to clear the form$name = ""; $score = ""; $screenshot = ""; mysqli_close($dbc); } else { echo

Sorry, there was a problem uploading your screen shot image.

; }} } else {echo

The screen shot must be a GIF, JPEG, or PNG image file no greater than . (GW_MAXFILESIZE / 1024) . KB in size.

; } // Try to delete the temporary screen shot image file @unlink($_FILES[screenshot][ mp_name]);}else { echo

Please enter all of the information to add your high score.

;} } else {echo

Please enter the verification pass-phrase exactly as shown.

; } }?><formenctype="multipart/form-data"method="post"action=""><inputtype="hidden"name="MAX_FILE_SIZE"value="" />Name:<inputtype="text"id="name"name="name"value="" />

Score:<inputtype="text"id="score"name="score"value="" />

Screen shot:

Verification:

‘).addClass(‘pre-numbering’).hide();

$(this).addClass(‘has-numbering’).parent().append($numbering);

for (i = 1; i <= lines; i++) { $numbering.append($(\).text(i)); }; $numbering.fadeIn(1700);}); });

以上就介绍了PHP绘图函数生成图片验证码,包括了方面的内容,希望对PHP教学有兴趣的朋友有所帮助。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。