simeonC Posted October 30, 2013 Share Posted October 30, 2013 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.. Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/ Share on other sites More sharing options...
Ch0cu3r Posted October 30, 2013 Share Posted October 30, 2013 In all pages that uses sessions you must be calling session_start(). I do not see this function being called in the codes you have posted. Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456233 Share on other sites More sharing options...
simeonC Posted October 30, 2013 Author Share Posted October 30, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456250 Share on other sites More sharing options...
Ch0cu3r Posted October 30, 2013 Share Posted October 30, 2013 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");/////////////////////////////////////////////// } ?> Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456252 Share on other sites More sharing options...
Solution mac_gyver Posted October 30, 2013 Solution Share Posted October 30, 2013 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.) Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456253 Share on other sites More sharing options...
simeonC Posted October 30, 2013 Author Share Posted October 30, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456274 Share on other sites More sharing options...
simeonC Posted October 30, 2013 Author Share Posted October 30, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456276 Share on other sites More sharing options...
simeonC Posted October 31, 2013 Author Share Posted October 31, 2013 No luck any help any one please i hate this there is no syntax error but there is an error somewhere Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456281 Share on other sites More sharing options...
objnoob Posted October 31, 2013 Share Posted October 31, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456293 Share on other sites More sharing options...
mentalist Posted October 31, 2013 Share Posted October 31, 2013 NB: Generally you'll find cokies in the Settings dialog. Quote Link to comment https://forums.phpfreaks.com/topic/283443-session-end-on-its-own-brain-teaser/#findComment-1456312 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.