Javascript 无法获得存储会话,我缺少什么?
我有一张表格,上面有用户签名。当用户填写所有详细信息时,他单击submit按钮。Ajax请求提交表单并将所有细节放入数据库中。如果没有出现任何错误,将打开一个带有两个(付款)按钮的隐藏div。点击理想或PayPal按钮后,colorbox打开并显示“概览页面”。现在我想通过$\u SESSION['user\u id']显示数据库中的用户信息。但不知何故,我没有存储会话orso,因为“概述页面”是空的 我不确定我错过了什么,任何提醒都会很棒 这是表单:Javascript 无法获得存储会话,我缺少什么?,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,我有一张表格,上面有用户签名。当用户填写所有详细信息时,他单击submit按钮。Ajax请求提交表单并将所有细节放入数据库中。如果没有出现任何错误,将打开一个带有两个(付款)按钮的隐藏div。点击理想或PayPal按钮后,colorbox打开并显示“概览页面”。现在我想通过$\u SESSION['user\u id']显示数据库中的用户信息。但不知何故,我没有存储会话orso,因为“概述页面”是空的 我不确定我错过了什么,任何提醒都会很棒 这是表单: <div class="conten
<div class="content main container" id="goShowOrderForm">
<div class="content main box">
<div id="udidOrderForm" class="order form">
<form action="post" id="orderForm" name="form">
<label for="email">Email</label>
<input type="email" class="input-fullwidth" name="email">
<div class="two-column">
<label for="password">Password</label>
<input type="password" name="password">
</div>
<div class="two-column right">
<label for="repassword">Confirm Password</label>
<input type="password" name="re_password">
</div>
<input type="hidden" name="token" value="<?php echo $_SESSION['guest_token'] ?>">
</form>
<div class="orderFormActions">
<input type="submit" class="button darkblue order" name="submitNewStep" id="submitNewStep" value="Nu afrekenen">
<div class="button red cancel" id="cancelUdidOrder">Afbreken</div>
</div>
</div>
</div>
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = SECURE;
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
ini_set('session.use_only_cookies', 1);
// Gets current cookies params.
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams["lifetime"],
$cookieParams["path"],
$cookieParams["domain"],
$secure,
$httponly);
// Sets the session name to the one set above.
session_name($session_name);
session_start(); // Start the PHP session
session_regenerate_id(); // regenerated the session, delete the old one.
}
编辑#2-打开颜色框的部分(javascript)
在刷新会话lik之前,需要检查会话状态
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = SECURE;
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
ini_set('session.use_only_cookies', 1);
// Gets current cookies params.
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams["lifetime"],
$cookieParams["path"],
$cookieParams["domain"],
$secure,
$httponly);
// Sets the session name to the one set above.
if (session_id() == '') {
session_name($session_name);
session_start(); // Start the PHP session
session_regenerate_id();
}
}
sec_session_start()的代码代码>?很抱歉。刚刚编辑了我的问题。sec_session_开始部分已编辑。您说您没有存储会话,但您已经存储了该会话。请发布打开的代码colorbox@HüseyinBABAL我编辑了我的问题。包含代码。当您尝试打开概览页面时,它正在加载order overview.php
page。您能告诉我$user\u id=$\u会话['user\u id']之后var\u dump($user\u id)
的输出吗代码>?我只是想确定你的课程是否正确开始,我已经用我的课程替换了这个。它不再加载概述页面,并给出GET 500(内部服务器错误)错误请告诉我确切的错误。您使用的是哪个版本的PHP?确切错误:GET 500(内部服务器错误)jquery.js:7845(consolelog)。Colorbox无法打开内容。我正在使用最新的PHPOk your is right colorbox无法打开,因为php页面出现错误。您需要在firebug consoleOk的网络选项卡中检查错误日志或ajax响应,这是因为您在php页面上有错误。尝试在浏览器上直接转到概览页面。第页上写的错误是什么?
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = SECURE;
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
ini_set('session.use_only_cookies', 1);
// Gets current cookies params.
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams["lifetime"],
$cookieParams["path"],
$cookieParams["domain"],
$secure,
$httponly);
// Sets the session name to the one set above.
session_name($session_name);
session_start(); // Start the PHP session
session_regenerate_id(); // regenerated the session, delete the old one.
}
$(document).on('click', '#pay_ideal', function(){
$.colorbox({
width: 500,
height: 350,
speed: 350,
closeButton: false,
href:"order-overview.php"
});
});
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = SECURE;
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
ini_set('session.use_only_cookies', 1);
// Gets current cookies params.
$cookieParams = session_get_cookie_params();
session_set_cookie_params($cookieParams["lifetime"],
$cookieParams["path"],
$cookieParams["domain"],
$secure,
$httponly);
// Sets the session name to the one set above.
if (session_id() == '') {
session_name($session_name);
session_start(); // Start the PHP session
session_regenerate_id();
}
}