Re: remove page referrer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/11/07, Stut <stuttle@xxxxxxxxx> wrote:
> Please include the list when replying.
>
> Shahrzad wrote:
> > Mercyyy  Stut  for your reply,
>
> No problem.
>
> > For the reason of sessions ,,,, I want no one can back to previous
> > page,if somebody temptates to do that, either this error occur :
> > "HTTP/1.0 404 Not Found" or that page reload again .
> > Can I do this with javaScript or something else?
>
> There are some nasty evil hacks that can achieve this, but you really
> don't want to.
>
> There are two possible solutions to your problem...
>
> 1) Write your code in such a way that it doesn't matter if someone goes
> back to a previous page and resubmits it.
>
> 2) Use the session to keep track of what page the user is on. That way
> if they do hit the back button you can tell them they've not allowed to
> do that and provide a link to the page they should be one.
>
> The first option is the best because the second is very poor UI design.
>
> Is there a reason why the user cannot go back to a previous page? What
> is technically stopping you handling that situation?
>
> -Stut
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    What about the following?

L> page1.php
<?
session_start();
if($_SESSION['already_submitted'] == True) {
    header("Location: page2.php");
}
// Continue with your existing code from the first page.
?>

L> page2.php
<?
session_start();
$_SESSION['already_visited'] = True; // Set this now.
// Continue with the rest of your code from the second page.
?>

    For as long as that session remains active, any time the user
attempts to reload that page, they'll be forwarded to a page of your
choice (in this case, page2.php).  If you absolutely want a 404 error,
you can either spoof one or legitimately create one --- by forwarding
them to a page that does not and will not ever exist on your server.
Not a very elegant solution, but it will work.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished....

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux