尝试了来自堆栈溢出和internet的各种解决方案,但似乎都没有效果。我的php注册页面是一个模态窗口形式。我正在寻找的是把用户从他重定向到登录表单的页面。
注册链接:
<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-lg">SIGN UP</a>登记处理:
<?php
ob_start();
session_start();
require_once("config.php");
require_once("all_functions.php");
$cust_email = stripslashes($_POST['cust_email']);
$cust_password = stripslashes($_POST['cust_password']););
$res = mysql_query("SELECT * FROM register WHERE cust_email = '$cust_email'");
if (mysql_num_rows($res)>0)
{
echo 'That email is already registered';
exit;
}
mysql_query("INSERT INTO register (`cust_email`, `cust_password`)
VALUES
('$cust_email', '$cust_password')");
$_SESSION['valid_user'] = $cust_email;
header("Location: http://tre.com/");
exit;
?>函数来检查用户是否已登录。
<?php
function check_valid_user()
// see if somebody is logged in and notify them if not
{
global $_SESSION;
if (isset($_SESSION['valid_user']))
{
return $_SESSION['valid_user'];
}
else
{
return false;
}
}
?>发布于 2013-08-11 06:54:53
您可以使用$_SERVER['HTTP_REFERER']从用户注册的位置获取地址,并以任何一种方式将其应用于直接将用户从注册表单中带回到以前的页面,而无需使用任何消息。
header("Location:" . $_SERVER['HTTP_REFERER']);但是,如果您想显示一条消息,可以使用以下代码
echo '<meta http-equiv=REFRESH CONTENT="0; url='.$_SERVER['HTTP_REFERER'].'">
Your registration was sucessfull you will be redirected automatically. If not, please <a href="'.$_SERVER['HTTP_REFERER'].'">click here</a>.';希望它能帮上忙
发布于 2013-08-11 06:02:33
试试这个:
header('Location: ' . $_SERVER['HTTP_REFERER']);https://stackoverflow.com/questions/18169206
复制相似问题