Website URL
Session Not persist through pages
This is the login page… i started the seesion_start() function and stored a var 0 in $_session[‘admin’]. and header to the home page…
session_start();
$_SESSION['admin'] = 0;
error_reporting(1);
include('../config/config.php');
$data="SELECT * FROM `admin`";
$result = $mysqli -> query($data);
$row = $result -> fetch_array(MYSQLI_ASSOC);
$adminName = $row['Name'];
$password = $row['Password'];
$mes = "Session id: ".session_start();
$name = $_POST['name'];
$pass = $_POST['password'];
if(isset($_POST['btn'])){
if($adminName == $name && $password == $pass){
$_SESSION['admin'] = 1;
$mes = 'GOOD'.$_SESSION['admin'];
header("location:https://vinnovista.rf.gd/admin/home.php");
}else {
$mes = 'Password/Username Incorrect ';
}
}
on the home page …the $_session[‘admin’] is just null…Why??
As you can see below the page would just load ‘nope’…
session_start(); // Start the session
error_reporting(1);
if($_SESSION['admin']){
echo 'yes there is';
}else{
echo 'nope';
}
if($_SESSION['admin']!=1){
// header('location:index.php');
echo "not 1";
phpinfo();
echo $_SESSION['admin'];
}else{
?>
I would appreciate any feedback please…