国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > PHP > 正文

php實現點擊可刷新驗證碼

2020-03-22 18:29:03
字體:
來源:轉載
供稿:網友
$this- checkimage = @imagecreate($this- width,$this- height); $back = imagecolorallocate($this- checkimage,255,255,255); $border = imagecolorallocate($this- checkimage,0,0,0); imagefilledrectangle($this- checkimage,0,0,$this- width - 1,$this- height - 1,$back); // 白色底 imagerectangle($this- checkimage,0,0,$this- width - 1,$this- height - 1,$border); // 黑色邊框 private function setDisturbColor() for ($i=0;$i =200;$i++) $this- disturbColor = imagecolorallocate($this- checkimage, rand(0,255), rand(0,255), rand(0,255)); imagesetpixel($this- checkimage,rand(2,128),rand(2,38),$this- disturbColor); private function writeCheckCodeToImage() for ($i=0;$i =$this- codenum;$i++) $bg_color = imagecolorallocate ($this- checkimage, rand(0,255), rand(0,128), rand(0,255)); $x = floor($this- width/$this- codenum)*$i; $y = rand(0,$this- height-15); imagechar ($this- checkimage, rand(5,8), $x, $y, $this- checkcode[$i], $bg_color); function __destruct() unset($this- width,$this- height,$this- codenum); 包含文件 imgcode.php
php session_start(); require_once('CreateImg.html' target='_blank'>class.php'); $image = new ValidationCode('80','20','4'); //圖片長度、寬度、字符個數 $image- outImg(); $_SESSION['validationcode'] = $image- checkcode; //存貯驗證碼到 $_SESSION 中 前臺文件 demo.php
php session_start(); $test = $_POST['test']; $test = strtoupper(trim($test)); $submit = $_POST['submit']; if(isset($submit)){ if($test==$_SESSION['validationcode']){ echo 'true'; } else { echo 'false';
meta http-equiv="content-type" content="text/html;charset=utf-8" script language="javascript" function newgdcode(obj,url) { obj.src = url+ ' nowtime=' + new Date().getTime(); //后面傳遞一個隨機參數,否則在IE7和火狐下,不刷新圖片 /script body img src="imgcode.php" alt="看不清楚,換一張" align="absmiddle" / form method="POST" name="form1" action="image.php" input type="text" name="test" br / input type="submit" name="submit" value="提交" /form /body /head /html 以上就是為大家介紹的php點擊驗證碼即可刷新的全部代碼,希望對大家的學習有所幫助。PHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁津县| 洛川县| 久治县| 关岭| 东方市| 通渭县| 安多县| 潼南县| 桐庐县| 淳化县| 安西县| 赤城县| 芮城县| 明光市| 神农架林区| 南丹县| 鱼台县| 万年县| 公主岭市| 滦南县| 务川| 孙吴县| 枣阳市| 江源县| 尚志市| 洞口县| 离岛区| 宁明县| 嘉黎县| 石嘴山市| 巴中市| 昌吉市| 永昌县| 岫岩| 策勒县| 信丰县| 格尔木市| 巴彦淖尔市| 秦皇岛市| 绥德县| 军事|