我使用Jquery标签的页面,当我提交其中一个标签只提交该标签,其他标签保持不变(不提交)。我使用:PHP的开始会议后提交的表单在jQuery的标签页
$(document).on("submit","#basis_advertentie,#prijzen_huidige_jaar", function(event) {
$.ajax({
type:"POST",
url:this.getAttribute('id')+".php",
cache: false,
data: data,
success:function(data){
wijziging_nog_bevestigen = 0;
$(innertab).html(data);
}
});
});
另外我还检查用户是否有会话登录。
后提交我执行以下功能(重新)启动一个会话:
function sec_session_start() {
$session_name = 'sec_session_id'; // Set a custom session name
$secure = TRUE; //origineel was SECURE
// This stops JavaScript being able to access the session id.
$httponly = true;
// Forces sessions to only use cookies.
if (ini_set('session.use_only_cookies', 1) === FALSE) {
//header("Location: ../error.php?err=Could not initiate a safe session (ini_set)");
email_error("Could not initiate a safe session (ini_set)): ");
exit();
}
// 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.
}
后,我做的登录再检查一下:
function login_check($mysqli) {
// Check if all session variables are set
if (isset($_SESSION['user_id'],
$_SESSION['username'],
$_SESSION['login_string'])) {
$user_id = $_SESSION['user_id'];
$login_string = $_SESSION['login_string'];
$username = $_SESSION['username'];
// Get the user-agent string of the user.
$user_browser = $_SERVER['HTTP_USER_AGENT'];
if ($stmt = $mysqli->prepare("SELECT wachtwoord
FROM data_adverteerders
WHERE adverteerder_ID = ? LIMIT 1")) {
// Bind "$user_id" to parameter.
$stmt->bind_param('i', $user_id);
$stmt->execute(); // Execute the prepared query.
$stmt->store_result();
if ($stmt->num_rows == 1) {
// If the user exists get variables from result.
$stmt->bind_result($wachtwoord);
$stmt->fetch();
$login_check = hash('sha512', $wachtwoord . $user_browser);
if ($login_check == $login_string) {
// Logged In!!!!
return true;
} else {
// Not logged in
return false;
}
} else {
// Not logged in
return false;
}
} else {
// Not logged in
return false;
}
} else {
// Not logged in
return false;
}
}
问题是,出现以下错误:
警告:session_start()[function.session-start]:无法发送会话缓存限制器 - 已发送的头文件(输出开始于/home/huurhulp/domains/huurhulp.nl/public_html/wijz IGEN/basisgegevens_verhuur.php:5)中的线23 /home/huurhulp/domains/huurhulp.nl/public_html/inloggen/login_functions.php
警告:session_regenerate_id()[function.session-再生-ID]:不能重新生成会话ID - 标头已发送/ 24线上的/home/huurhulp/domains/huurhulp.nl/public_html/inloggen/login_functions.php
我该如何解决错误,我是否需要重新启动功能或我可以使用主页上已启动的功能(标签所在的位置)。
session_start()应该在你的php脚本的顶部。 – Grumpy