Discussion:
web page expired
hadi
2014-06-16 01:41:47 UTC
Permalink
How to redirect the user in web page expired can someone give me example
where to place the redirect code ?

my code

header("location:logout.php");

thanks.
Ashley Sheridan
2014-06-16 07:24:31 UTC
Permalink
Post by hadi
How to redirect the user in web page expired can someone give me example
where to place the redirect code ?
my code
header("location:logout.php");
thanks.
As was mentioned in the other thread, this header (and it should really
be 'Location' instead of 'location') requires an absolute URL. It can
work with a relative one, but may produce inconsistent results. Also,
you can only use it if there's been no output at all sent to the browser
in this session. That means not even a single space or new line.

You can test if it's ok to redirect using the headers_sent() function
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hadi
2014-06-17 17:26:25 UTC
Permalink
As was mentioned in the other thread, this header (and it should really be
'Location' instead of 'location') requires an absolute URL. It can work with a
relative one, but may produce inconsistent results. Also, you can only use it if
there's been no output at all sent to the browser in this session. That means
not even a single space or new line.
You can test if it's ok to redirect using the headers_sent() function
Ash,

Here is my php code. I don’t know where shell I use it in my code, I mean where to place it in the code can you please help here.
When the user click back button from page4.php to page3.php web page expired happen, so where to place the redirection ?



Test2.php

<html>
<body>

<form action="test3.php" method="post">
Username: <br><input type="text" name="username"></br>

<input type="submit" name = 'submit1' value= 'Login'>
</form>

</body>
</html>

Test3.php

<?php
session_start();
?>

<html>
<body>

<?php
$username = $_POST['username'];
$_SESSION['username']= $_POST['username'];

echo "<br> Hi $username.</br>";

?>

<form action="test4.php" method="post">
<input type="submit" name = 'submit' value= 'click me'>
</form>

</body>
</html>

Test4.php

<?php
session_start();
$username = $_SESSION['username'];
echo "<br> Hi $username.</br>";

?>
Post by hadi
How to redirect the user in web page expired can someone give me
example where to place the redirect code ?
my code
header("location:logout.php");
thanks.
As was mentioned in the other thread, this header (and it should really be
'Location' instead of 'location') requires an absolute URL. It can work with a
relative one, but may produce inconsistent results. Also, you can only use it if
there's been no output at all sent to the browser in this session. That means
not even a single space or new line.
You can test if it's ok to redirect using the headers_sent() function
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...