Lol I felt like I should try one more time on my own instead of bothering everyone.
I don’t think it shows any JSON.
login script(process2.php):
$sql = "SELECT pw FROM users WHERE username = ?";
$stmt = mysqli_prepare($con, $sql);
$stmt->bind_param('s', $username);
$stmt->execute();
$stmt->bind_result($hashed_pwd); // Binds variables to a prepared statement for result storage
$stmt->fetch(); // Fetch results from a prepared statement into the bound variables
if (password_verify($pw, $hashed_pwd)) {
//session_id($_POST['user_session_id']); //starts session with given session id
// password verified
$_SESSION["user_session_id"] = $username;
$cookie_name = $_SESSION["user_session_id"];
$cookie_value = $cookie_name;
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
//header('Location: bootstrap.php');
die($cookie_value);
//return true;
//echo $_SESSION["user_session_id"];
} else {
echo 'Incorrect username or Password.';
//die('Incorrect username or Password.');
//return false;
}
bootsrap.php(where some of the profile stuff show up):
if(isset($_SESSION['user_session_id'])) {
$userLoggedIn = $_SESSION['user_session_id'];
//die($userLoggedIn);
} else {
die('Not logged in');
//header("Location: register.php");
}
$user_data_query = $con->prepare('SELECT username, email, profile_pic FROM users WHERE username = ?');
$user_data_query->bind_param("s", $userLoggedIn);
$user_data_query->execute();
$user_data_query->bind_result($username, $email, $img);
$user_data_query->fetch();
$user_data_query->close();
echo $username . "<br><br>";
echo $email . "<br><br>";