忘记密码表格不再有效

时间:2014-02-19 23:04:56

标签: php

好的,所以在我的主机更新了他们的CP后,我必须将所有页面扩展名更改为.php,以便进行更多更改。现在,以下代码对我不起作用(是的,我知道mysql_query已经过时,使用PHP 5.3)

<?php 
define('INCLUDE_CHECK',true);

require 'connect.php';
require 'functions.php';
// Allowing MySQL Connection - Include_Check has to be TRUE
if($_POST['submit']=='Send') {
$email=$_POST['email'];
$email=mysql_real_escape_string($email);
$status = "OK";
$msg="";
if (!stristr($email,"@") OR !stristr($email,".")) {
Header("Location: login_panel/nosent.php");
$status= "NOTOK";}

if($status=="OK") {  // If e-mail is valid, status stays the same: query time!
$query="SELECT email,usr FROM tz_members WHERE email = '$email'";
$st=mysql_query($query);
$recs=mysql_num_rows($st);
$row=mysql_fetch_object($st);
$em=$row->email;// Switching $email to $em for the query.
 if ($recs == 0) { // $recs is 0, that means that address doesn't exist. Tell the guy to register ? Yes plz.
// Display the message
 Header("Location: login_panel/nosent.php");
exit; }

$pass = rand(1000,9999);
// Using the functions.php public: sendMail
send_mail(  'administrator@cod5showtime.url.ph',
                        $_POST['email'],
                        'Username: '.$row->usr,
                        'Password: '.$pass); 
mysql_query("UPDATE tz_members SET $row->pass = md5($pass) WHERE email = $email");
Header("Location: login_panel/sent.php");
}
}
?>

和HTML:

<form action="forgot.php" method="post">
<div class="grey">E-Mail Address:</div><br>
<input type="text" name="email" size="20" maxlength="40" value=""><br><br>
<input type="submit" name="submit" value="Send"></div>
</form>

虽然更改具有类似脚本的密码可以正常工作,但重置电子邮件不起作用。

我也有问题。标题没有发送,但我没有收到任何警告信息,为什么会有任何想法?

0 个答案:

没有答案