Results 1 to 5 of 5

Thread: PHP Login "This page contains POST DATA..."

  1. #1
    Join Date
    Nov 2007
    Location
    USA
    Posts
    170
    Thanks
    8
    Thanked 22 Times in 22 Posts

    Default PHP Login "This page contains POST DATA..."

    Ok so I have a login form on my homepage where users can login (obviously), but when I refresh the page it pops up with the "This page contains POST DATA.." dialog...I dont want this to happen though. Is there any way to fix this or am I going about this wrong in the first place? Help is always appreciated, thanks!

    EDIT: Also if I may ask, where is a good/correct place to put session_destroy(); ?
    Last edited by Moshambi; 08-28-2008 at 08:15 PM.

  2. #2
    Join Date
    Aug 2008
    Posts
    5
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    This is normal that when you refresh webpage containing POST data your browser asks you "This page contains POST DATA.. Do you want...". I don't think you can change this behaviour.

  3. #3
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    You can work around this by redirecting the user to the page again after the form has been submitted.

  4. #4
    Join Date
    Nov 2007
    Location
    USA
    Posts
    170
    Thanks
    8
    Thanked 22 Times in 22 Posts

    Default

    so techietim how would I go about that...say just use like a filler page? Kinda like how on some sites it says "You are Now Logged In please wait for you browser to redirect you" or something like that. Because I would like them to be on the same page just logged in...

    Thanks for your help!

  5. #5
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    79
    Thanks
    0
    Thanked 15 Times in 15 Posts

    Default

    Once you have validated the user's credentials, and updated the sessions you'd set a redirection header for the same page before any html is outputted.

    PHP Code:
    <?php

    // check user credentials

    // log them in

    // they're now logged in, let's redirect them to this same page
    header("Location: http://example.com/myloginpage.php");

    ?>
    The better solution would probably to separate the script into two different pages. This depends on the setup though. I don't know enough about your situation to recommend one thing over another.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •