尝试了来自堆栈溢出和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:02:33
试试这个:
header('Location: ' . $_SERVER['HTTP_REFERER']);https://stackoverflow.com/questions/18169206
复制相似问题