Strange problem with PHP and sessions

Posted by Jhorra on Stack Overflow See other posts from Stack Overflow or by Jhorra
Published on 2010-04-27T04:42:34Z Indexed on 2010/04/27 4:53 UTC
Read the original article Hit count: 250

Filed under:
|
|
|

So the basis of this page is I set a session value when the page loads, and clear it on any other page they visit. Then the page can make an ajax call to download a file. If the session value matches the value I pass through the URL I allow them to download the file. If not I return a 404 error. I was having some weird issues, so I removed the 404 and set it to echo out the values instead to see what I was getting. Here is the top of the code on the page:

$code = $this->_request->getParam('code');
    $confirm = $_SESSION['mp3_code'];
    echo $code."-1-".$confirm;
    if($code != $confirm)
        echo $code."-2-".$confirm;//header("HTTP/1.1 404 Not Found");
    else
    {

Here is what displays on the page from the ajax call 12723430-1-12723430-2-

As you can see when it echos out the first time they exist, then somehow after I compare them and it fails you see that it echos out blank values like they suddenly ceased to exist. Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about zend-framework