【发布时间】:2014-09-02 19:26:14
【问题描述】:
所以,我创建了一个脚本,一个用于登录,一个用于重置用户密码。
代码如下:
<!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>
<title>Forgot your password?</title>
</head>
<body>
<?php
error_reporting(0);
$email=$_POST['email'];
if($_POST['submit']=='Send')
{
mysql_connect('localhost','username','password') or die(mysql_error);
mysql_select_db('softlrdl_testlogon');
$query="select * from users where email='$email'";
$result=mysql_query($query) or die(error);
if(mysql_num_rows($result))
{
echo "User exist";
}
else
{
echo "No user exist with this email id";
}
}
?>
<?php
mail(to,subject,message,headers,parameters)
if(mysql_num_rows($result))
{
$code=rand(100,999);
$message="Your activation link is: http://forgot.site.com/forgot.php?email=$email&code=$code
mail($email, "Password Reset Link", $message);
echo "Email sent";
}
else
{
echo "No user exist with this email id";
}
?>
</body>
</html>
我得到的错误是:
Parse error: syntax error, unexpected T_IF in /home/softlrdl/public_html/forgot/forgot.php on line 28
我不知道是什么原因造成的......
提前感谢您的帮助
【问题讨论】:
-
mail()函数后缺少分号 -
你应该将你的代码复制到dreamviewer中,它会以红色显示语法错误。它将帮助您找到错误
标签: php html login forgot-password