Jump to content

Session end on its own.. Brain teaser


simeonC
Go to solution Solved by mac_gyver,

Recommended Posts

ok I have a manager.php file which is constructed as such

<?php 
require ("phpscript/stack_scripts.php");/// required add customer script
$title= "Total Auto Clinic";/// Title For page

?>
<?php 
$admin_view=mysql_query("SELECT * FROM repair_orders JOIN (serviced_vechicles) ON repair_orders.car_id=serviced_vechicles.car_id  WHERE repair_status='1'");
$inshop=mysql_num_rows($admin_view);
$fetch=mysql_fetch_array($admin_view);

?>


<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, maxium-scale=1.0, minimum-scale=1.0, initial-scale=1.0"/>
<meta name="viewport" content="width=device-width">
<?php include("css_stack.php") ?>
<title><?php echo $title?></title>
</head>

<body>


<div id="wrapper" >
                
                <?php include("structure/header.php") ?>
                <?php include("structure/nav.php") ?>
                <?php include("structure/contents.php") ?>
              	<?php include("structure/footer.php") ?>
</div>
   
 
 



    
<?php include("java_stack.php") ?>
</body>
</html>

if the user not logged  in as a manager it will display the login page..

<?php 
if (!isset($_SESSION['manager'])){
	include("content_structures/manager_signin.php");
	}else{
		///////////////////////////////////////////////
if (!isset($_GET['nav'])){
	echo   "nav is set";
	include("content_structures/current_service.php");
	
	}else {
		
		include("content_structures/".$_GET['nav'].".php");

		}
//it may vary from these three files
//
//include("content_structures/rev.php");
//include("content_structures/update_cars.php");
//include("content_structures/current_service.php");
//include("content_structures/update_info.php");
///////////////////////////////////////////////
		}
	





?>

else depending on which link is clicked that is the content which will display. Current_Service is set a default

 

the problem that I am having is when I login as the manager and select one of the available links in the nav bar my session is ended and I am returned to the login page. 

any help will be greatly appreciated..

 

 

Link to comment
Share on other sites

It is the first thing that is called required ("phpscript/stack_scripts.php") which is

<?php 
	session_start();
	error_reporting(E_ALL);
	include("connection.php");
	include("post.php");
	include("get.php");
	//include("session.php");
	//include("signature-to-image.php");
	//include('addcustomer.php');
	//include("add.php");
	//include("charges.php");
?>


and this is included on all pages until the finish product

Link to comment
Share on other sites

Ok I see your are requiring that file in manger.php. But I don't see you're including that file in the login page code you posted here. Is that just part of the code for the login page?

 

if the user not logged  in as a manager it will display the login page..

<?php if (!isset($_SESSION['manager'])){	include("content_structures/manager_signin.php");	}else{		///////////////////////////////////////////////if (!isset($_GET['nav'])){	echo   "nav is set";	include("content_structures/current_service.php");		}else {				include("content_structures/".$_GET['nav'].".php");		}//it may vary from these three files////include("content_structures/rev.php");//include("content_structures/update_cars.php");//include("content_structures/current_service.php");//include("content_structures/update_info.php");///////////////////////////////////////////////		}	?>
Link to comment
Share on other sites

  • Solution

it's possible that your links are changing the host-name/sub-domain in your url's (no www. vs www. in them) and the session id cookie no longer matches variation of the domain where it was set (by default the session id cookie only matches the host-name/sub-domain where it was set at.)

 

is the host-name/sub-domain in your you URL's consistent when navigating around on your site?

 

another possibility is your session_start is failing due to an error. you need to set the error_reporting/display_errors settings before any other statements (its best to actually put those settings in your php.ini.)

Link to comment
Share on other sites

Understood now the subdomain doesn't  change sub_domains.com/manager.php but they do change as i input some $_GET variables into them so it recognizes that content needs to change what is being displayed in this manner sub_domains.com/manager.php?nav=some text.

Link to comment
Share on other sites

it is being published locally hence no "www." wasn't to sure what that meant. also when i run it on dreamweaver the session is enabled and its being recognized not when i run my browser app's locally the session doesn't set. Well see upload files now.

Link to comment
Share on other sites

You should use your web browsers web developer tools to view the cookies set by your site.

 

You can check if the session cookie is being set, and whether or not the value of the session cookie is changing between requests.

You can also check the request headers, using these same developer tools, to determine if the cookie is being passed to the site on subsequent requests.

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.