• Ok,
    I have a script i currently use to create a photo gallery. here:
    http://opencast.com.au/talent/home.php
    At the top of my code i’ve started it with session start(); and works fine. but when i want to enter this in the php code section:
    if (!$_SESSION[“valid_user”])
    {
    // User not logged in, redirect to login page
    header(“location: login.php”);
    }
    // Display logout link
    echo “Sign-Out“;
    i upload, test and i get this page:
    http://opencast.com.au/talent/home.php?category_id=&parent_id=0&photo_id=2&countdisplay=1&start=0
    The error i get is a:
    Warning: Cannot modify header information – headers already sent by (output started at /home/o/openc/www/talent/home.php:5) in /home/o/openc/www/talent/photogallery/home.gallery.php on line 179
    i check line 179 which is this from the code i entered above:
    header(“location: login.php”);
    /////////////////
    The thing that confuses me is it seems to be trying to redo the session it already created after i click on one of the images and thus i get this error?
    can somone help me out? how do you insert a session variable in the middle of the script that ultimatley visualy creates a new page from the same php script on the same page?
    Basicly i want to create login after somone clicks on the image and then accesses that area.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Perhaps you need to place the entire address before “login.php”.

    Hey, I am currently trying to install an alicebot on my site and having very similar probs.
    I think it has something to do with having two sessions at the same time….
    I got rid of the alice bots user session which now allows it to work,
    I have also added the wordpress id of registered users to the alice bot.
    However I am having troubles working out how to display the wordpress session id…..

    in your php.ini file, change the session autostart value to zero.

    i.e.

    session.auto_start = 0

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP Sessions’ is closed to new replies.