bird_man11 Posted February 4, 2009 Share Posted February 4, 2009 Just wondering if anyone could help me out. i have a link which when clicked on should send you to a page and start a new session and log you in, problem is that if the link is external from the browser (eg. from word) it seems to start the session but the session variables are all empty, but if the link is copy and pasted into the browser, or clicked from a page in the browser it worked fine. thanks in advance Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/ Share on other sites More sharing options...
Brian W Posted February 4, 2009 Share Posted February 4, 2009 Some code for the page that makes the session would probably help us help u. Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754822 Share on other sites More sharing options...
bird_man11 Posted February 4, 2009 Author Share Posted February 4, 2009 sorry that might help heres the code <? session_start(); include 'includes/connect.php'; include 'classes/userclass.php'; if(($_POST['username'] != '') || ($_GET['hashedkey'] != '')){ $_SESSION['loggedUser'] = new user(); if($_SESSION['loggedUser']->login($_GET['hashedkey'], $_POST['username'], $_POST['password'])){ header('Location:divisions.php'); } else { header('Location:index.php'); } } ?> $_SESSION['loggedUser']->login sets $_SESSION['loggedUser']->sessionActive = true if there is a match in the database Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754829 Share on other sites More sharing options...
Brian W Posted February 4, 2009 Share Posted February 4, 2009 I'm thinking that your email client (Outlook or yahoo.com or whatever) is messing up your link and not passing ?hashedkey=exampleblablablabla which you use as $_GET['hashedkey']. Check that when you click the link in your email that the url looks how you expect it. Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754832 Share on other sites More sharing options...
bird_man11 Posted February 4, 2009 Author Share Posted February 4, 2009 yeh i have checked that, its actually in a excel spreadsheet, and i have copied and pasted the links from the spreadsheet into the browser and that seems to work Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754841 Share on other sites More sharing options...
Brian W Posted February 4, 2009 Share Posted February 4, 2009 but does the url look correct when you click on the link from the excel spread sheet? Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754845 Share on other sites More sharing options...
bird_man11 Posted February 4, 2009 Author Share Posted February 4, 2009 yeah, if i stop the redirect it is the same in the address bar Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754846 Share on other sites More sharing options...
PFMaBiSmAd Posted February 5, 2009 Share Posted February 5, 2009 It's likely that the hostname/subdomain www. is being used for some of the URL's and not others and the session cookie settings are not setup to work with and without the www. Link to comment https://forums.phpfreaks.com/topic/143850-session-dropping-out/#findComment-754925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.