【发布时间】:2015-03-27 01:26:32
【问题描述】:
我正在为我的学校用户名和密码进行身份验证。学校有自己的后端脚本用于表单 POST。它允许一些具有特定名称的隐藏输入进行自定义,例如,成功时重定向页面。但是,我在该页面上不能有任何session_start() 或我的任何php 代码,因为在login.php 之后,登录页面被重定向到学校页面,然后被重定向回我的index.php。帖子值被传递给index.php,但在页面刷新时,它会返回登录页面,因为会话没有与帖子值一起保存。
对此的任何帮助都会非常有帮助。
Index.php
<?php
session_start();
$_SESSION['username'] = $_POST['sid'];
if(!isset($_SESSION['username'])){
header("Location: login.php");
} else {
?>
// HTML here
<?php
}
?>
Login.php
<form action="authenticator.pl" name="form1" method="POST">
// Using hidden inputs I specify which page to redirect to... These are specific hidden inputs that are accepted.
</form>
【问题讨论】:
标签: php session authentication forms-authentication