Sessions not being passed properly

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron C

    Sessions not being passed properly

    I'm having a problem passing SESSION variables from page to page. Right
    now, I have this code at the top of my page:

    if(!$_SESSION['logged_in']) include "login.php" ;

    This is the code for the login form:
    if($submit != "") {
    $login_results = loginCheck($ema il, $password);
    if($login_resul ts) {
    session_start() ;
    $_SESSION['logged_in'] = "true";
    $login_values = mysql_fetch_arr ay($login_resul ts);
    foreach($login_ values as $index => $value) {
    $_SESSION[$index] = $value;
    }
    }
    else displayLoginFor m(displayLoginF ailure());
    }
    else displayLoginFor m();
    ....
    ....
    Another form appears down here -> submitting reloads page.


    Upon going back to this page again once the SESSION variables were set,
    I'm sent back to the login screen again. I checked, and the SESSION
    variables don't exist anymore after reloading the screen. This sounds
    like a globals problem, but I thought those only applied to GET, POST,
    and the like. Any ideas what could be going on here?

    Thanks,
    Aaron

    P.S. I'm going straight to the boards tonight instead of doing my own
    research, as I'm pressed for time with a school project due, so please
    ezcuse the newbie question.
  • Bill Karwin

    #2
    Re: Sessions not being passed properly

    Aaron C wrote:[color=blue]
    > P.S. I'm going straight to the boards tonight instead of doing my own
    > research, as I'm pressed for time with a school project due, so please
    > ezcuse the newbie question.[/color]

    Dude, that's not cool. It's inappropriate to ask other people to do
    your homework for you, whether they are on the net or not.

    Besides, you posted to mailing.databas e.mysql, with a PHP question that
    has nothing to do with MySQL! Poor net etiquette, at the very least.

    Anyway, try googling for "php session tutorial".

    Bill K.

    Comment

    • Bill Karwin

      #3
      Re: Sessions not being passed properly

      Aaron C wrote:[color=blue]
      > P.S. I'm going straight to the boards tonight instead of doing my own
      > research, as I'm pressed for time with a school project due, so please
      > ezcuse the newbie question.[/color]

      Dude, that's not cool. It's inappropriate to ask other people to do
      your homework for you, whether they are on the net or not.

      Besides, you posted to mailing.databas e.mysql, with a PHP question that
      has nothing apparently to do with MySQL! Poor net etiquette, at the
      very least.

      Anyway, try googling for "php session tutorial".

      Bill K.

      Comment

      • Aaron C

        #4
        Re: Sessions not being passed properly

        I'm sorry, I accidentally posted to the wrong newsgroup.

        BTW, I was not trying to get anyone to do any homework for me. I was
        just looking to see if anyone had had a similar problem.

        I do appreciate you're steering me in the right direction, though, as
        your suggestion helped.

        Thanks,
        Aaron


        Bill Karwin wrote:[color=blue]
        > Aaron C wrote:[color=green]
        > > P.S. I'm going straight to the boards tonight instead of doing my own
        > > research, as I'm pressed for time with a school project due, so please
        > > ezcuse the newbie question.[/color]
        >
        > Dude, that's not cool. It's inappropriate to ask other people to do
        > your homework for you, whether they are on the net or not.
        >
        > Besides, you posted to mailing.databas e.mysql, with a PHP question that
        > has nothing apparently to do with MySQL! Poor net etiquette, at the
        > very least.
        >
        > Anyway, try googling for "php session tutorial".
        >
        > Bill K.[/color]

        Comment

        Working...