Coding Global Background
Coding Global

Having trouble setting _SESSION ids for login

Archived a year ago
12 messages
3 members
Created a year ago
Updated a year ago
Open in Discord
D
DrippedCoffee
Verified
so i have this sending to the next page but the next page doesn't recognize that the session id is valid:

if (password_verify($password, $user_password)) {
session_start();
session_regenerate_id();
$_SESSION['logged_in'] = true;
$_SESSION['username'] = $user['username'];
header('Location: ../pages/backpages/Root.php');
exit;
}

The next page recieving the session id i have looking like this:

<?php
session_start();
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
header('Location: ../SignIn.php'); // Redirect to login if not logged in
exit;
}

any idea why it doesnt let me set session ids or could it be something in database settings?

Replies (11)