如果用户帐户未激活,则重定向到不同页面
一段代码
$LoginRS__query=sprintf("SELECT user_handle, user_password FROM users_entity WHERE user_handle=%s AND user_password=%s AND activation_status='Active'",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $f12_database_connect) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['logged_in']="True";
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
数据库查询 activation_status="Active"
的用户。该字段具有两个值之一:“Pending”
或 “Active”
。如果状态为“待处理”,我想发送到另一个页面。该页面适用于尚未激活帐户的用户。如何获取结果并将其分配给变量?或者有更好的方法吗?
A snip of code
$LoginRS__query=sprintf("SELECT user_handle, user_password FROM users_entity WHERE user_handle=%s AND user_password=%s AND activation_status='Active'",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $f12_database_connect) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['logged_in']="True";
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
The database queries users that are activation_status="Active"
. That field has either of the two values which are "Pending"
or "Active"
. I want to send to another page if the status is "Pending"
. The page would be for users that haven't activated their account. How do grab that result and assign it to a variable? Or is there a better approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需选择数据而不参考activation_status并使用if语句检查它。
编辑:
您可能正在寻找的代码:
Just select the data without referring to the activation_status and check it with an if statement.
EDIT:
The code you are probably looking for:
这是解决方案和正确的编码...
This is the solution and proper coding...