ignore_user_abort(TRUE) - please help

hi, I want to redirect user to another website, even if user clicks STOP button after a small intveral of time (5 seconds)… I am trying the following code, but it doesnt redirect

<?php

	ignore_user_abort(TRUE);
	set_time_limit(0);
	  
	for ($i = 1; $i <= 5; $i++) {
	 sleep(2);
	 if($i == 5) {
		header('Location: http://www.yahoo.com/');		
	 }
	}
?>

how can I achieve this, All I want is set redirect user after 5 seconds even if they hit STOP button… please help…

It’s not “almost” impossible; it’s IMPOSSIBLE. Sure, you can make it more difficult, but it’s not worth the time: the people that you are really worried about - those people who will steal your code / content and set up clone sites - will not be stopped by your trivially undone techniques. Logic is on their side; you cannot stop them. At all. Ever.

Your time is much better spent elsewhere. Abandon this doomed crusade to hide your code and channel that effort into making a great website. If you are concerned about other people stealing your content, there are services such as Copyscape that can help you tackle that problem. Rather than trying to prevent theft, focus on detection and recovery.

Much of this reply assumes that your reason for hiding your source code is to prevent theft of content. If you have another motive, tell us why you want to protect your source code and you may receive other suggestions.

I’m not sure if this is foolproof, but you might try

if (console) { alert('FireBug is enabled!'); }

I understand its almost impossible to stop code fro stealing, however with techniques like sessions etc we can somehow make it difficult to show code. I have managed to hide in IE and FF…

anyhow is there anyway to close XUL window of Firebug ? I know like Yahoo and GMail they check if the console of Firebug is open to detect, but if console it no open, they cannot even detect…

Is there anyway to close XUL window of Firebug ?

regards

And for a reason - 4580 Response(s) :eek2:

When you and I are talking on the phone and you hang up I can talk all I want but you’ll never hear it.

The same goes for the stop button in the browser, it breaks the connection between the client and the server so the server can do send all it wants, but the client will never receive it.

That being said you can achieve what you want by putting a meta redirect in the <head> of your HTML :slight_smile:

Seeing this thread made me smile, and reminded me about this thread on another forum. There was lots of discussion, and even some proofs of concept, but ultimately it is impossible. We now call that discussion the Infinite Thread - have a read if you’re bored and have a few hours to spare. :lol:

The console object does not necessarily have to be Firebug.
Safari/ Chrome and IE 8 have built-in consoles.

@janu: no, you cannot close the Firebug window.


curl www.yourwebsite.com > yoursecretsourcecode.html

There is no way to hide source code of your website so stop trying.

Don’t put it on the Internet then.

There’s no way to stop the functionality of the Stop button.

Exactly! :slight_smile:

Last possibility would be javascript’s setTimout function.
Of course that doesn’t work if the browser of the visitor doesn’t support javascript or the visitor has turned it off …

thanks but meta refresh will also stop if users clicks STOP button. Is there anyway to run a script like redirection once user clicks stop in browser ?

what am trying to do, is display html code, with the help of ob_flush() it doesnt display my code (view source), however if users clicks stop, they can view source which I dont want…

is there anyway to RUN a javascript with AJAX or any solution even id user clicks stop button…

thanks gain for your replies…

You can’t.
ignore_user_abort only assures that the script will not end when PHP detects the user has aborted the connection. The connection, once aborted by the user, is gone.