php - Sessions are not working after redirection -


here code setting sessions in user-authentication.php:

session_start(); $_session['admin_name'] = $name; $_session['sbc_admin'] = "y"; $_session['admin_email'] = $email;  header("location:includes/user-auth.php"); 

and here's code check whether sessions set or in user-auth.php:

session_start();     if (isset($_session["sbc_admin"])) {         $admin = $_session["sbc_admin"];         $name = $_session["admin_name"];         $email = $_session["admin_email"];     } else {         header("location:../index.php"); } 

after redirection, session variables lost. have tried few tricks it's still not working.

take session_start(); , place @ top of of code. want 1 of, if not, first method run.

i tend create file called lib.php called header.php document. lib file contains object creation, functions, etc. first bit of code on page is:

<?php session_start(); //the rest of code here 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -