当用户注册我的网站并获得激活链接时,activate.php中不会显示任何内容。它只是空白。我该如何解决这个问题?
这是我的activate.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
//-----------------------------------------------------------------------------------------------------------------------------------
if ($_GET['id'] != "") {
include_once "scripts/connect_to_mysql.php";
$id = $_GET['id'];
$hashpass = $_GET['sequence'];
$id = mysql_real_escape_string($id );
$id = eregi_replace("`", "", $id);
$hashpass = mysql_real_escape_string($hashpass);
$hashpass = eregi_replace("`", "", $hashpass);
$sql = mysql_query("UPDATE members SET emailactivated='1' WHERE id='$id' AND password='$hashpass'");
$sql_doublecheck = mysql_query("SELECT * FROM members WHERE id='$id' AND password='$hashpass' AND emailactivated='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);
if($doublecheck == 0){
$msgToUser = "<br /><br /><h3><strong><font color=red>Your account could not be activated!</font></strong><h3><br />
<br />
Please email site administrator and request manual activation.
";
include 'msgToUser.php';
exit();
} elseif ($doublecheck > 0) {
$msgToUser = "<br /><br /><h3><font color=\"#0066CC\"><strong>Your account has been activated! <br /><br />
Log In anytime up top.</strong></font></h3>";
include 'msgToUser.php';
exit();
}
}
print "Essential data from the activation URL is missing! Close your browser, go back to your email inbox, and please use the full URL supplied in the activation link we sent you.<br />
<br />
admin@blahblah.com
";
?>
答案 0 :(得分:1)
答案 1 :(得分:0)
空白页几乎总是意味着发生致命错误,通常是未捕获异常的b / c。
前置
ini_set("display_errors","1");
ini_set("error_reporting",E_ALL | E_STRICT);
启用错误消息显示。
编辑:或死亡或退出声明的b / c ......: - /
答案 2 :(得分:0)
我可能在这里错了,但是在exit()调用之前不应该有变量 $ msgToUser 的 echo 吗? (它终止脚本而没有任何输出,因此是空白页面)
答案 3 :(得分:0)
在您的代码中:
$id = $_GET['id'];
$hashpass = $_GET['sequence'];
$id = mysql_real_escape_string($id );
$id = eregi_replace("`", "", $id);
$hashpass = mysql_real_escape_string($hashpass);
$hashpass = eregi_replace("`", "", $hashpass);
评论(删除这些)这些::
$id = eregi_replace("`", "", $id);
$hashpass = eregi_replace("`", "", $hashpass);
然后尝试,我不认为在mysql_real_escape_string()之后需要'''替换;
并在if-else梯形图中添加“Else”,并回显一些调试消息。
希望有所帮助。