我还有另一个问题。但是,这一次是用户确认。用户注册后,他们会收到一封电子邮件,链接为 mydomain.co.uk/confirm.php?username=(username)&id=(id)。那里的一切都有效,但是即使 id 和用户名正确,用户仍然没有得到确认。继承人的脚本:
<?php
$id = $_REQUEST['id'];
$username = $_REQUEST['username'];
$link = mysql_connect('localhost', 'website', 'mypasswordtroll');
if(!$link) {
die('could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('website', $link);
if (!$db_selected) {
die ('Cant use database : ' . mysql_error());
}
$result = mysql_query("SELECT * FROM unconfirmedusers WHERE username = '$username' and id = $id");
if(mysql_num_rows($result)==0){
$continue = false;
}
while($row = mysql_fetch_array($result))
{
$usr = $row['username'];
$pass = $row['password'];
$email = $row['email'];
$day = $row['day'];
$month = $row['month'];
$year = $row['year'];
}
if($continue == false){
echo '<div class="alert alert-error"><b>Oh man!</b> No such user or id found!</div>';
echo $result;
}else{
$query2 = "DELETE FROM unconfirmedusers WHERE id='$id' and username='$username'";
$query3 = "INSERT INTO users (username, password, email, day, month, year) VALUES ('$usr', '$pass', '$email', $day, $month, $year)";
$result2 = mysql_query($query2);
$result3 = mysql_query($query3);
echo '<div class="alert alert-success"><b>Great! </b>You can now log in!</div>';
}
?>
我找不到任何问题,而且我不知道哪个部分不正确...任何人都可以发现任何可以帮助我解决此问题的错误吗?