1

Topic: Capturing the destination uri

I've got complete and utter mind block on this one, so just wanted to check. smile

In header.php, can you call:

basename($_SERVER['PHP_SELF'])

to capture the destination uri and then use that with the header function to insert a delay and then load the page after the delay, rather than loading it straight away, or does another var or method need to be used?


Cheers,

Matt

Re: Capturing the destination uri

I think you'll need to give an example of what you want to do wink
I'm inclined to say yes, but that depends on how/what you're trying to redirect.

3

Re: Capturing the destination uri

An example would be if one is viewing the index and clicks on one of the topic links, to have an if clause at the top of header.php which would go something like:

if ($test == $condition)
{
    header("Location: '.basename($_SERVER['PHP_SELF']).' Refresh: '.$delay.'");
}

so that you would actually end up going to the page you requested, but only after the delay specified.


Cheers. smile

Re: Capturing the destination uri

I don't think that's possible with an HTTP header. I think you want a meta refresh tag wink

5

Re: Capturing the destination uri

So I'd need to do something along these lines?

if ($test == $condition)
{
    echo '<meta http-equiv="refresh" content="'.$delay.';URL='.basename($_SERVER['PHP_SELF']).'"/>';
}

Cheers.

Re: Capturing the destination uri

That sounds better tongue

7

Re: Capturing the destination uri

Cheers. smile

8 (edited by MattF 2007-11-12 04:45)

Re: Capturing the destination uri

Trying to introduce lags through those methods leads to some quirky results. big_smile Ended up just using the sleep function and pausing the script for the delay period. big_smile Will there be any detrimental side effects using that method? (Other than the obvious self inflicted DoS condition if used to excess big_smile)?

Thanks again. smile

Re: Capturing the destination uri

No wink

10

Re: Capturing the destination uri

would this help a little javascipt for delay on redirect?

<script language=javascript>
setTimeout("location.href='[/index.php]'", 45);
</script>
My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

11

Re: Capturing the destination uri

Smartys wrote:

No wink

Cheers. smile big_smile

12

Re: Capturing the destination uri

quaker wrote:

would this help a little javascipt for delay on redirect?

<script language=javascript>
setTimeout("location.href='[/index.php]'", 45);
</script>

Cheers. I've sorted it via other means, but that one might come in handy at some future point. smile

13 (edited by quaker 2007-11-12 22:20)

Re: Capturing the destination uri

i put that code on my simple upload script since it would only redirect to a page. that said you have uploaded a file! so i wanted it to display that message then after 45ms it would go back to the main page.


Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!