所以我让index.php (root)
那个用户提交一个表单,它在页面加载时重新生成一个 session_id 并存储在隐藏的输入中。
在root index.php
文件中输入数据后,它们将被发送到profile page
具有:
session_start(); // Bring in old sessionID
$sess_id = session_id();
// If no sessionID redirect back home.
if(empty($sess_id)) {
header('Location: ../index.php');
}
// If don't enter, then reload page, redirect back home
elseif(empty($_POST['firstNm']) || empty($_POST['lastNm'])) {
header('Location: ../index.php');
}
// If sessionID first send off this data inputted from ../index.php then regenerate session id and update db
else {
// Connect to db
$_SERVER['DOCUMENT_ROOT'] = 'SiteRoot/';
// Grabs a new user's : username, pass, email from default [index.php] once submitted
require_once($_SERVER['DOCUMENT_ROOT'].'cfg/'.'dbi.php');
require_once($_SERVER['DOCUMENT_ROOT'].'registration/'.'inituserCredentialsGrab.php');
// After submitting original values, update new session ID in database since original was viewable via source hidden inputs
require_once($_SERVER['DOCUMENT_ROOT'].'registration/'.'newUserSessIDInitReg.php');
}
这个文件基本上得到了所有的初始输入。获取通过查看源...可见的初始 session_id 并重新生成它。重新生成后提交到数据库。
问题是,如果我转到RELOAD
该页面,它似乎又重新生成了 id。我该如何解决这个问题,这样无论我在当前浏览器会话期间刷新多少次,它都不会执行regenerate_id
?