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
https://forums.phpfreaks.com/topic/127092-solved-session-not-passing-in-url/
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.