php中用户登入和验证码验证问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 01:57:03
为什么我不制作用户登陆时,图片验证功能就可以,一制作用户登入时,图片验证就失效?为什么呀,请高手指点一下,谢谢了!
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theVal

我一般都用Zend,所以你的代码没有看太懂。只是浅浅的注意到里面有一段代码:
if (isset($_SESSION['PrevUrl']) && false) {
这里不出意外的话永远会是false吧。
但好像问题也不再这里。让我更没有明白的是你的$_SESSION['yzm']是在这个脚本执行以前就被写好的吗?因为我在这个脚本里除了最后一个if里面看到这个东西以外,就没有看到了。

你在验证之前,echo一下$_POST['yzm'] 和$_SESSION['yzm'],看看是你想得到的结果么?
另外$_SESSION['yzm']应该是在生成图片的文件里,在把随机生成的字符串(验证码)输入到图片里之前,先把该字符串存放到session变量里,然后在另一个页面取出来,拿这个和用户输入的验证码匹配,看验证是否通过。