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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.