<?php
require_once($_SERVER['DOCUMENT_ROOT']."/_includes/init.php");
$po_page_title="Verifying your email address";
$code=$_GET["code"];
$message="<p>Information</p>";
if(!$code) {
$message="<p>Unable to verify your email address.</p>";
} else {
$o=new DBUsers();
$o->ValidateCode($num,$code);
if($num>0){
$message="<p>Thank you, your email address has been validated.</p>";
//This line of code runs
$o->UpdateVerified($code);
} else {
//But this is the message that appears????
$message.="<p>It looks like your email may already have been verified. If you haven't yet made a payment, please just login and you should be prompted to do so.</p><p>Many thanks</p>";
}
}
echo $message;
unset($o);
在我的本地主机上,我收到了感谢信息,它会按预期触发UpdatedVerified代码。
这是ValidateCode
function ValidateCode(&$num=0,$code="") {
if(empty($code)) return;
$sql="SELECT id FROM {$this->viewName} WHERE code='$code' AND verified=0 AND active=0";
DataObject::GetRecords($sql,$num);
}
更新代码
function UpdateVerified($code=""){
if(empty($code))return;
$sql="UPDATE $this->tableName SET verified=1,active=1 WHERE code='$code'";
DataObject::ExecuteSql($sql);
}
然而,当我在远程主机(Hostgator)上尝试相同的代码时,执行UpdatedVerified代码,因为我可以看到数据库中正在更新的数据,这是我期望发生的,但奇怪的部分是我得到了“看起来像你的电子邮件......”的消息。
页面没有运行两次,代码中的任何地方都没有刷新。我甚至尝试在朋友主机上运行此代码,它运行良好。
这让我感到困难了几天,从我的观点来看,代码运行正常,因为我看到它正常工作,但不是在实际的主机上,并且它不像代码做任何复杂的事情。 / p>