Problem with Session_start()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • conryf
    New Member
    • Apr 2007
    • 1

    #1

    Problem with Session_start()

    I'm having a problem with my session variables. I have a basic login script that contains:

    [PHP]
    session_start() ;
    ...

    $_SESSION['uname'] = $username;
    $_SESSION['utype'] = $uType;
    [/PHP]

    The user is then redirected to a menu page that I modified to verify that the session variables were still accessible there. Here is the page:

    [PHP]
    <?
    session_start() ;
    if(!session_is_ registered(myus ername)){
    header("locatio n:main_login.ph p");
    }

    ?>

    <html>
    <body>
    Login Successful
    <?
    $name = $_SESSION["uname"];
    echo "Hello ". $name;
    ?>
    <br>
    <a href="browse.ht ml">Browse</a>
    <br>
    <a href="Logout.ph p">Logout</a>
    </body>
    </html>
    [/PHP]

    Then the user is diected to a search page, the page uses AJAX and accessing a couple of scripts, none of which use the session vaiables before it access this script:

    [PHP]
    <?php
    session_start() ;
    $login = $_SESSION["uname"];
    $utype = $_SESSION["utype"];
    ....
    [/PHP]

    I use the username later and they come up as empty strings.

    What baffles me is that, on the middle, 'menu' page the session variables are initiated the same way but in that instance they come out right, but in the next page, they come up blank. I'm using vista and firefox, I don't get any errors but both the session variables come up blank. Any ideas? Thanks!
Working...