atom feed2 messages in com.googlegroups.professional-phpRe: Problem with $_SESSIONS ...
FromSent OnAttachments
dbeeJan 10, 2008 10:06 am 
dbeeJan 10, 2008 10:22 am 
Subject:Re: Problem with $_SESSIONS ...
From:dbee (dara@gmail.com)
Date:Jan 10, 2008 10:22:20 am
List:com.googlegroups.professional-php

Hi Gary,

Thanks.

I do have ...

session_start();

in at the top of the page, so it's not that unfortunately...

Cheers,

Dara

On Jan 10, 6:08 pm, "Gary Every" <gev@gmail.com> wrote:

do you have session_start() in upload?

On Jan 10, 2008 11:06 AM, dbee <dara@gmail.com> wrote:

Hi,

I'm creating some on-the-fly sessions code and I'm having a problem getting my session variables to propagate

login.php:

$session_code = md5($albumname . 'randomtext');

// Log them in for this album $_SESSION["session_name"] = $session_code;

// Reroute to the upload page ... header("Location: http://mydomain.com/upload.php?session_name=$session_name");

upload.php:

$session_name = $_GET['session_name'];

// Check whether they are authenticated for this album if ($_SESSION['session_name'] == md5($session_name . 'randomtext') ) {

}

I can set the session variable on login.php no problem. But when I redirect to upload.php the $_SESSION array is empty.

Also, can anyone see a major flaw in using sessions in this manner ? The obvious one is that the actual session code will remain persistent. But since the timeout is only one hour it's not too much of an issue. The code is closed source of course so predicting the randomtext wouldn't be easy. I don't have time to go on and flesh out a proper sessions class ..

Anyway thanks,