Page 1 of 1

How can I recognize that header() has opened actual page?

Posted: Tue Apr 18, 2006 11:36 pm
by LeXbOnD
I have a login page which calls the header('Location: SOMEPAGE.php') function if the login was correct.

My question is, how can i recognise that SOMEPAGE.php has been
opened with the header function and not with any other button, link or POST method?

The code needs this information in order to recognize if the page is loaded for the first time or not (first time is on call header).



I was thinking about to save this information in the session variables but I don't think this would be an optimal solution.
Any other proposition is welcome.

I am serching something (if it exists) like the condition $_SERVER['REQUEST_METHOD']=='POST' for $_POST variables.

Posted: Tue Apr 18, 2006 11:42 pm
by feyd
Set a session variable. There's no real other way that isn't easily hacked or faked.

Posted: Wed Apr 19, 2006 12:05 am
by hawleyjr

Posted: Wed Apr 19, 2006 1:45 am
by LeXbOnD
I tried it with headers_sent() it also gives true when you click on a link and on buttons.
This means it doesn't work 4 my problem.

I'll solve it with a session variable.


Thank you 4 your help.