① phpweb 网站进入后台的时候:请输入和图片上显示一致的验证码,点击验证码图片可更换一张。可我没输错
大哥 我可以很明确的告诉你 如果一个问题在网络讨论的很少 这个问题除非特别特别难 不过大多应该基本不是问题 可能会难住你一阵子 但最后你解决后你才会发现这个问题你多么的简单 自己是多么的愚蠢 思路想错了 呵呵 所以你这个问题很容易找到答案 你整了一堆没用的 一句话本地网络的原因 网络不给力 我很怀疑你的验证码是不是没用同步 你每次输入的验证码其实已经变了 建议你在拼音的时候输入 别用搜狗打字母然后按enter输验证码 这样验证码会跳一次 会改变 如果你网络不行没有刷新你就看不到 自然会错 如果你用搜狗输入法 你先点击一下shift然后输入验证码 输入后你用鼠标点击登录 别按到enter键了 不然验证码会跳的 别瞎折腾了 问题没那么严重 不要轻易装系统 电脑里面装的软件重装一次不容易
② PHP验证码 实现点击刷新
随机产生的验证码放在一个文件1中
在另一个文件中引用文件1
<img src="code.php" onClick="this.src='code.php?nocache='+Math.random()" style="cursor:hand" alt="点击换一张"/>
实现点击图片自动刷新图片
③ phpweb 网站进入后台的时候:请输入和图片上显示一致的验证码,点击验证码图片可更换一张。可我没输错。
终结版:
1时间,时区设置是否正确。
2清空浏览器缓存。
3你是否通过路由器上网,请去掉路由器试试,如果可以,请升级路由器固件或者更换路由器。
我估计你那个是第三条了
④ php中验证码的那个“换一张”的链接怎么写
基本思路就是,写个Ajax,当点击“换一张”时,请求一个生成验证码的PHP程序文件。当请求成功时,用javascript代码把验证码替换诚心的就可以了。
⑤ 修改获取验证码图片到本地的PHP程序
最近项目不是很大,所以时间比较的空间,昨天琢磨着写点东西,想起了前几天电信公司投票选微笑天使的活动,投票是要填写验证码的,想了下想写个投票作弊程序,可是等我放假回来,人家活动已经结束了,昨天突然想起来,就写了一个获取验证码图片到本地的PHP程序,以备今后有类似的投票活动可以直接拿来使用。
程序采用了PHP的GD库,原理很简单,就是先建立一张空白图片,然后把验证码的图片使用PHP
GD库中的imagecreatefromjpeg函数建立一个image对象,最后计算图片的长宽,再次使用PHP内置的image复制到一开始建立的空白图片上去。
全部代码如下:
header("Content-type:image/png");
set_time_limit(0);//设置PHP超时时间
$url
=
$_GET['url'];
$url
=
"http://vcer..com/verify";
$imginfo
=
GetImageSize
(
$url
);
$imgw
=
$imginfo
[0];
$imgh
=
$imginfo
[1];
$bg
=
imagecreatetruecolor($imgw,$imgh);
$image
=
imagecreatefromjpeg($url);
imagecolorallocate($image,255,255,255);
image($bg,$image,0,0,
0,0,$imgw,$imgh);
imagedestroy($image);
ImagePng($bg);
此处的代码支持验证码格式为jpg的格式,如果是png或者gif的格式可以参考第二页。
通过上一页一个获取验证码图片到本地的PHP程序,对于验证码为jpg格式的图片是可以正常输出的,对于png、gif的验证码则不能正常使用,今天稍微修改一下PHP代码,使其可以支持png、gif、jpg三种格式的验证码。
PHP判断图片的格式可使用php内置的exif_imagetype函数,非常方便,
关于exif_imagetype的详细使用方法可以访问:http://php.net/manual/en/function.exif-imagetype.php
header("Content-type:image/png");
set_time_limit(0);//设置PHP超时时间
$url
=
$_GET['url'];
$url
=
"http://vcer..com/verify";
if(empty($url)){
echo
"没有图片";
die;
}
$imginfo
=
GetImageSize
(
$url
);
$type
=
exif_imagetype($url);
$imgw
=
$imginfo
[0];
$imgh
=
$imginfo
[1];
$bg
=
imagecreatetruecolor($imgw,$imgh);
if($type==IMAGETYPE_GIF){
$image
=
imagecreatefromgif($url);
}elseif($type==IMAGETYPE_JPEG){
$image
=
imagecreatefromjpeg($url);
}elseif($type==IMAGETYPE_PNG){
$image
=
imagecreatefrompng($url);
}
imagecolorallocate($image,255,255,255);
image($bg,$image,0,0,
0,0,$imgw,$imgh);
imagedestroy($image);
ImagePng($bg);
⑥ 编写验证码点击“看不清,换一张”是怎么实现的,全代码是什么,需要什么控件
1、编写php验证码生成文件verification.php。
⑦ 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);
?>
⑧ 用PHP技术制作验证码遇到的问题。
用JS,<input type="text" name="yzm" size=5 /> <a href="#"><img src="yzm.php" onclick="this.src='yzm.php?id='+Math.random();" /></a> 如看不清楚,请点击图片刷新
这个是我写过的,给你点启发吧
⑨ php生成的图片验证码,换一张时IE6不支持,ie7可以
修改如下:
<img id="yzm" name="yzm" src="img.php" />
<a href=# onclick="yzm.src='img.php?t='+(new Date().getTime());return false;">看不清楚,换一张</a>
⑩ Zend_Captcha生成的验证码,点击换一个怎么弄 - PHP框架开发
首先谢谢斑斑用这个changeCaptcha()函数去AJAX请求哪个页面呢?请求生成验证码的页面么? 不可能吧那另外再写个生成验证码页面么?还有我是在表单里面用验证码的[ol][*][*]? ?? ???$captcha = $form->addElement(\'captcha\', \'captcha\', array([*]? ?? ?? ?? ?\'captcha\' =>??array(??[*]? ?? ?? ?? ?? ? // First the type...??[*]? ?? ?? ?? ?? ? \'captcha\' => \'Image\',[*]? ?? ?? ?? ?? ? // Length of the word...??[*]? ?? ?? ?? ?? ? \'wordLen\' => 4,[*]? ?? ?? ?? ?? ? \'fontsize\'=>16,[*]? ?? ?? ?? ?? ? \'width\' => 100,[*]? ?? ?? ?? ?? ? \'height\' => 60,[*]? ?? ?? ?? ?? ? \'dotNoiseLevel\'=>2,[*]? ?? ?? ?? ?? ? \'timeout\' => 300,??[*]? ?? ?? ?? ?? ? \'font\' => APPLICATION_PATH . \'/../public/img/Faktos.ttf\',??[*]? ?? ?? ?? ?? ? \'imgDir\' => APPLICATION_PATH . \'/../public/img/code/\',??[*]? ?? ?? ?? ?? ? \'imgUrl\' => \'/img/code/\',[*]? ?? ?? ?? ?),[*]? ?? ?? ?? ?\'label\' => \'seccode\'[*]? ?? ???));[*][/ol]