为什么在php中会有一个错误?(提示验证码错误)
reg.php代码:<?phpsession_start();if(@$_SESSION['code']==$code){$password_again=$_POST['...
reg.php代码:
<?php
session_start();
if(@$_SESSION['code']==$code){
$password_again=$_POST['password_again'];
$password=$_POST['password'];
$username=$_POST['username'];
$name=$_POST['name'];
if(@$password_again==$password){
mysql_connect(localnost,root,88888888)
or die("wrong!!\n");
mysql_select_db(login)
or die("wrong!!\n");
$sql="INSERT INTO login(name,username,password) VALUES('$name','$username','$password')";
$result=mysql_query($sql);
if($result){
echo '注册成功!!';
}else{
echo '注册失败!!';
}
mysql_free_result($result);
mysql_close();
}else{
echo '两次输入的密码不一样呀!!';
}
}else{
echo '输入的验证码不对呀!!';
}
?>
接上;
@header("Content-Type:image/png");
$_SESSION["code"] = $str;
$im=imagecreate($width,$height);
$back=imagecolorallocate($im,0xFF,0xFF,0xFF);
$pix=imagecolorallocate($im,187,230,247);
$font=imagecolorallocate($im,41,163,238);
mt_srand();
for($i=0;$i<1000;$i++)
{
imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height),$pix);
}
imagestring($im, 5, 7, 5,$str, $font);
imagerectangle($im,0,0,$width-1,$height-1,$font);
imagepng($im);
imagedestroy($im);
$_SESSION['code'] = $str;
?> 展开
<?php
session_start();
if(@$_SESSION['code']==$code){
$password_again=$_POST['password_again'];
$password=$_POST['password'];
$username=$_POST['username'];
$name=$_POST['name'];
if(@$password_again==$password){
mysql_connect(localnost,root,88888888)
or die("wrong!!\n");
mysql_select_db(login)
or die("wrong!!\n");
$sql="INSERT INTO login(name,username,password) VALUES('$name','$username','$password')";
$result=mysql_query($sql);
if($result){
echo '注册成功!!';
}else{
echo '注册失败!!';
}
mysql_free_result($result);
mysql_close();
}else{
echo '两次输入的密码不一样呀!!';
}
}else{
echo '输入的验证码不对呀!!';
}
?>
接上;
@header("Content-Type:image/png");
$_SESSION["code"] = $str;
$im=imagecreate($width,$height);
$back=imagecolorallocate($im,0xFF,0xFF,0xFF);
$pix=imagecolorallocate($im,187,230,247);
$font=imagecolorallocate($im,41,163,238);
mt_srand();
for($i=0;$i<1000;$i++)
{
imagesetpixel($im,mt_rand(0,$width),mt_rand(0,$height),$pix);
}
imagestring($im, 5, 7, 5,$str, $font);
imagerectangle($im,0,0,$width-1,$height-1,$font);
imagepng($im);
imagedestroy($im);
$_SESSION['code'] = $str;
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询