Sinisterly
ad.php - Redirect php with 10 seconds html delay - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: ad.php - Redirect php with 10 seconds html delay (/Thread-ad-php-Redirect-php-with-10-seconds-html-delay)



ad.php - Redirect php with 10 seconds html delay - hacxx - 09-17-2020

A php file that will load a html for 10 seconds and redirects the user to the final url page.

How to execute
Copy the code below and save as ad.php

Code:
<?php

$url = $_GET["url"];

// ad here, add html between ""; that will be display for 10 seconds
echo "";

sleep(10);
header('Location: $url');
exit;

?>

To call the file
Code:
/ad.php?url=http://example.com



RE: ad.php - Redirect php with 10 seconds html delay - chunky - 09-17-2020

You should use urlencode() to make sure the url is encoded properly.


RE: ad.php - Redirect php with 10 seconds html delay - zardusfish - 04-21-2021

Why do we need this?

(09-17-2020, 06:23 PM)hacxx Wrote: A php file that will load a html for 10 seconds and redirects the user to the final url page.

How to execute
Copy the code below and save as ad.php

Code:
<?php

$url = $_GET["url"];

// ad here, add html between ""; that will be display for 10 seconds
echo "";

sleep(10);
header('Location: $url');
exit;

?>

To call the file
Code:
/ad.php?url=http://example.com



RE: ad.php - Redirect php with 10 seconds html delay - hacxx - 04-21-2021

(04-21-2021, 01:15 AM)zardusfish Wrote: Why do we need this?

The only purpose of this php script is to show a 10 second ad before redirecting to the final page. For example you have a blog or site and your post has a mediafire link then you format the url like the code below...

Code:
/ad.php?url=http://mediafire.com/saf3tg455jhg/mydownload.rar

And your users will see ad.php for 10 seconds before redirecting to the mediafire link.


RE: ad.php - Redirect php with 10 seconds html delay - zardusfish - 04-21-2021

Gotcha, thx

(04-21-2021, 01:24 AM)hacxx Wrote:
(04-21-2021, 01:15 AM)zardusfish Wrote: Why do we need this?

The only purpose of this php script is to show a 10 second ad before redirecting to the final page. For example you have a blog or site and your post has a mediafire link then you format the url like the code below...

Code:
/ad.php?url=http://mediafire.com/saf3tg455jhg/mydownload.rar

And your users will see ad.php for 10 seconds before redirecting to the mediafire link.



RE: ad.php - Redirect php with 10 seconds html delay - HackingRealm - 04-21-2021

I tried previously redirection in different ways but this way is better i guess. Thank you


RE: ad.php - Redirect php with 10 seconds html delay - fritz - 04-21-2021

Careful with that, using sleep function in a php web environment isn't very recommended.
It keep each process alive (php isn't multi thread), using a bit of memory with it, thus it might be more sensible to ddos for example.


RE: ad.php - Redirect php with 10 seconds html delay - Equinox - 04-21-2021

(04-21-2021, 01:15 AM)zardusfish Wrote: Why do we need this?

-snip-

For future reference, try not to gravedig threads. This thread was dead for seven months, and gravedigging is against Sinisterly's post etiquette


RE: ad.php - Redirect php with 10 seconds html delay - hacxx - 04-21-2021

(04-21-2021, 03:09 AM)fritz Wrote: Careful with that, using sleep function in a php web environment isn't very recommended.
It keep each process alive (php isn't multi thread), using a bit of memory with it, thus it might be more sensible to ddos for example.

Yes you are right. Having multiple requests to ad.php can lead to dos. This work best on small projects because there is a less volume of users and on high volume of users site the script should be in a different server. For example the site is setup at site1.com and ad.php on site2.com in a different server. Using this even if the site2.com server hangs the site1.com is working just fine.