Jump to content

[SOLVED] session not passing in URL


lanmind

Recommended Posts

See this simple page:

 

http://www.dockhawk.com/html.html

 

To me it seems the session value isn't being passed (on my browser at least). Any idea why? PHP:

 

<?php

session_start();

// get token variables
$token_session = $_SESSION['token'];
$token_url = $_GET['token'];

// compare them
$comparison = $token_session == $token_url;

// set the token to a new value to ensure it is only used once.

$_SESSION['token'] = uniqid(md5(microtime()), true);

echo 'Token in session [' . $token_session .']<br>';
echo 'Token from URL [' . $token_url . ']<br><br>';
echo 'Are they equal? ' . ($comparison ? 'Yes' : 'No') . '.<br>';

if (!$comparison) {
  die('Invalid token.');
} else {

  echo 'Valid token.';

}

?> 

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.