从堆栈溢出和互联网尝试了各种解决方案,但似乎没有一个有效。我的 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;
}
}
?>