Jump to content

Session dropping out


bird_man11

Recommended Posts

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

sorry that might help :P 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

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

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.