當前位置:首頁 » 編程語言 » php顯示驗證碼

php顯示驗證碼

發布時間: 2023-03-22 23:42:13

A. php驗證碼顯示問題 GD庫函數imagecreatetruecolor使用不了 求救

Call
to
undefined

function
imagecreatetruecolor()
in
...
提示是:調用未定義的函數imagecreatetruecolor
你的
gd庫
文件沒有打開。
先打開你的php.
ini文件

查找
;extension=php_gd2.dll
,把前面的分號去掉,如果沒有這句就加個(當然不要帶分號,分號是注釋掉的意思)然後保存退出。
如果沒有gd2.
dll文件
的話,就到網上下載一個
重新啟動apache伺服器。

B. 為什麼apache php無法顯示驗證碼

驗證碼一般需要安裝GD庫來支持的,你可以看一下你的php.ini文件中是否開啟了這一項,如果開啟後重啟Apache報錯,那麼還需要你安裝。
Windows中是一個.dll文件,放到相應的目錄就可以了。
Linux下安裝可能對PHP的版本之類的有要求,最好別安裝最新版本的GD庫。

C. PHP 驗證碼不顯示只有一個小紅叉的解決方法

最近想自學PHP
,做了個驗證碼,但不知道怎麼搞的,總出現一個如下圖的小紅叉,但驗證碼就是顯示不出來,原因如下
未修改之前,出現如下錯誤;

(1)修改步驟如下,原因如下,原因是apache許可權沒開,

(2)點擊打開php.int.,
搜索extension=php_gd2.dll
打開?去掉前面分號重啟apache,就OK了
,萬事大吉了。

希望各位朋友遇到這樣的問題的時候,能給與幫助

D. php驗證碼問題


<?php
有關生成驗證碼的代碼
?>
換成<img
src="yzm.php">
即可
yzm.php 上面
session_start()
前面的注釋也要去掉,而且裡面很多變數沒有定義,如果PHP.INI開了錯誤提示,就是出錯,提示變數不存在,就不會顯示驗證碼。
login.php裡面,空格
符應該是

不是
nbps
我寫好了,放在我網站上了,演示效果網址:
http://dev.qkweb.net/php/yzm/login.php
下載代碼的地址是:
http://dev.qkweb.net/php/yzm/20110701yzm.rar

E. 我的php代碼中登陸界面加一個驗證碼,如何實現

php登陸頁面+驗證碼的實現,參考如下:

1、首先新建一個php站點;

F. php中如何刷新驗證碼

我做的一個簡單的登錄界面有刷新驗證碼還有注冊功能 希望對LZ有幫助
這個是登錄界面 land.php
<?php
@include_once('global.php');
session_start();
$user = $_POST['username'];
$sql = sprintf("select * from `p_admin` where `username` = '%s'",$user);
//echo $sql;
$query = $db->query($sql);//調用golbal裡面的$db類
$fetch = $db->fetch_array($query);
if($_POST['sccode']==$_SESSION['rand']){
$state = $fetch ? md5($_POST['password'].$extra)==$fetch['password']:FALSE;//是否登錄成功 如果失敗了返回為空echo $state沒有結果
if(!$state)
echo"<script language=javascript>alert('用戶名或密碼錯誤');</script>";

else {
$_SESSION['id'] = $fetch['m_id'];
$_SESSION['shell'] = md5($fetch['username'].$fetch['password']);
$_SESSION['ontime'] = time();
//echo $_SESSION['id']."<br>";
//echo $_SESSION['shell'];
$action = new action();
$action ->get_show_msg('admin/admin_main.php', $show = '操作已成功!');
}
}else
echo "<script language=javascript>alert('驗證碼錯誤');</script>";

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>

<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>用戶登錄</title>
<link href="style/global.css" rel="stylesheet" type="text/css">
<link href="style/link.css" rel="stylesheet" type="text/css">
<link href="style/layoutid.css" rel="stylesheet" type="text/css">
<script language="javascript">
function chform (obj) {
if (obj.username.value == "") {
alert("請輸入用戶名!");
obj.username.focus();
return false;
}
if (obj.password.value == "") {
alert("請輸入密碼!");
obj.password.focus();
return false;
}
if (obj.sccode.value == "") {
alert("請輸入驗證碼!");
obj.sccode.focus();
return false;
}
return true;
}
function RefreshImage(id)
{
document.getElementById(id).src ='Confirm.php?'+Math.random(1);
}
</script>
</head><body>
<!--用戶登錄開始-->
<div class="login">
<form id="form1" name="form1" method="post" action="" onsubmit="return chform(this)">
<ul>
<li class="loginbtbj fright" style="background-image: url("images/hydl.gif");"><a title="" href="javascript:%20close();"><img src="images/close.gif" alt="關閉" align="right" border="0" height="18" width="18"></a></li>
<li class="fyellowxx fcenter">
.............................................................................................................
</li>
<li class="padleft43">
用戶名:<input name="username" size="15" style="width: 150px;" type="text">
</li>
<li class="padleft43">
密碼:<input name="password" size="15" style="width: 150px;" type="password">
</li>
<li class="padleft43">
驗證碼:<input name="sccode" size="6" style="width: 50px;" type="text"><img id="re_confirm" onclick="RefreshImage('re_confirm')" src="Confirm.php">
<a title="看不清?" href="#" onclick="RefreshImage('re_confirm')">看不清?</a> <a href=register.php >注冊</a>

</li>
<li class="fyellowxx fcenter">
.............................................................................................................
<br>
<input name="Submit" src="images/dl.gif" style="border: 0pt none; width: 80px; height: 31px;" type="image">
</li>
</ul>
</form>
</div>
<!--用戶登錄結束-->
</body></html>
這個是驗證碼的程序 confirm.php 圖片什麼的代碼我就不穿了 LZ可以借鑒下 有一點需要注意 就是這個confirm文件裡面不能報錯 我在這卡了很久
因為header這個之前不能輸出文本 所以如果報錯 就會無法顯示驗證碼
<?php
session_start();
$random='';
for($i=1;$i<5;$i++){
$random .= dechex(rand(1,15));}
$_SESSION['rand']=$random;
$im = imagecreatetruecolor(40,20);
$bg = imagecolorallocate($im,0,0,0);
$te = imagecolorallocate($im,255,255,255);
imagestring($im,rand(1,6),rand(1,6),rand(1,6),$random,$te);
header("Content-type: image/jpeg");
imagejpeg($im);
?>

G. php中文驗證碼無法顯示

session_start();
$image=imagecreatetruecolor(200,60);//創建畫布
$color=imagecolorallocate($image,mt_rand(157,255),mt_rand(157,255),mt_rand(157,255));//隨機顏色
//$color=imagecolorallocate($image,255,255,255);
imagefill($image,0,0,$color);//填充顏色
//中文驗證碼
$fontface="simhei.ttf";//確保相同目錄下有該字體
$strdb=array('好','多','人','在','學','習');
for($i=0;$i<4;$i++){
$fontsizecolor=imagecolorallocate($image,mt_rand(0,150),mt_rand(0,150),mt_rand(0,150));
$codex=iconv("GB2312","UTF-8",$strdb[mt_rand(0,5)]);//iconv不能轉數組取任意下標
imagettftext($image,mt_rand(20,24),mt_rand(-30,30),(40*$i+20),mt_rand(30,35),$fontsizecolor,$fontface,$codex);//如果用$code的話就生成1+2+3+4是個漢字的驗證碼了

}

//干擾點
for($i=0;$i<200;$i++){
$pointcolor=imagecolorallocate($image,mt_rand(50,200),mt_rand(50,200),mt_rand(50,200));
imagesetpixel($image,mt_rand(1,100),mt_rand(1,20),$pointcolor); //雪花
}
//干擾線
for($i=0;$i<3;$i++){
$linecolor=imagecolorallocate($image,mt_rand(50,200),mt_rand(50,200),mt_rand(50,200));
imageline($image,mt_rand(1,99),mt_rand(1,99),mt_rand(1,99),mt_rand(1,99),$linecolor);
}
ob_clean();
header("Content-type:image/png");
imagepng($image);
imagedestroy($image);

H. php驗證碼顯示不出來

輸出圖像imagejpeg($iamge);
單詞拼寫錯誤,應該是 $image

熱點內容
c語言中a10什麼意思 發布:2024-04-27 10:45:43 瀏覽:58
物聯網中ftp是什麼意思 發布:2024-04-27 10:41:17 瀏覽:985
銀行密碼保護在哪裡 發布:2024-04-27 10:25:23 瀏覽:188
tomcat源碼導入eclipse 發布:2024-04-27 10:25:15 瀏覽:194
android的api 發布:2024-04-27 10:23:39 瀏覽:683
官式訪問 發布:2024-04-27 10:04:00 瀏覽:521
國產高配置有哪些 發布:2024-04-27 09:18:26 瀏覽:948
建行手機app忘記密碼如何修改 發布:2024-04-27 08:58:59 瀏覽:393
蟻群演算法的數學模型 發布:2024-04-27 08:58:39 瀏覽:994
androidactivity生命 發布:2024-04-27 07:33:48 瀏覽:84