Jump to content

$_SESSIONS works on one page but not the other.


Recommended Posts

OK so, I have a login page within the directory /Pages/page_id=4.php , within that page it POSTS to loginverify.php, which is in ../Scripts/loginverify.php , and within that code it redirects you if the login is successful, and that page is ../Pages/page_id=5.php , now on this page it will display the session user's name where i want it to, but if you are an admin it redirects you to a copy of the page (page_id=9.php) with just context edited, and then the Variables Don't work, i even put an if statement that checks if $_SESSION is !$_SESSION to display a code and it did, so i don't know what it is. Here is the preview of the code. Yes I have made sure session_start() is there and before the html tag.

 

loginverify.php -

 

//Login Successful

session_regenerate_id();

$member = mysql_fetch_assoc($result);

$_SESSION['SESS_ID'] = $member['ID'];

$_SESSION['SESS_NAME'] = $member['Name'];

$_SESSION['SESS_EMAIL'] = $member['Email'];

session_write_close();

header("location: ../Pages/page_id=5.php");

exit();

}

//Login Failed

if($result != 1) {

echo ('You Either Have Not Registered or the Supplied E-Mail, Does NOT, Match the Given Password.');

}

?>

 

page_id=5.php -

<?php

session_start();

$admin = $_SESSION['SESS_ID'];

if(!isset($_SESSION['SESS_ID'])){

header('location: page_id=4.php');

}

if($admin==1 || $admin==2){

header("location: ../Pages/page_id=9.php");

}

?>

//Then the Context, Which Works

 

page_id=9.php -

<?php

session_start();

if(!session_start()){

die('Oh Crap Were Going Down...');

}

if(!$_SESSION){

die('Yes Indeed, Failure...');

}

$admin = $_SESSION['SESS_ID'];

 

if(!isset($_SESSION['SESS_ID'])){

header('location: page_id=4.php');

}

 

if($admin!=1 || $admin!=2){

header("location: ../Pages/page_id=5.php");

}

?>

// Context, Page Works Just Not SESSION Stuff.

 

That is all I have, please help, if you need more things i will be happy to respond.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.