ad.php - Redirect php with 10 seconds html delay

electrify

Well-Known Member
465
89
28
2019
1,480
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
 
3 comments

Hyperz

Well-Known Member
2,285
307
83
2009
645
Never use sleep in server-side front-end code. It can easily be exploited because it ties up server resources for the duration of the script's execution time. Someone could exploit this and use it to DoS/DDoS your server. Handle it in Javascript instead.

JavaScript:
setTimeout(function(){
    const params = new URLSearchParams(window.location.search);
    const url = params.get('url');
    // verify the URL...
    window.location.href = url;
}, 10000);
 
Top Bottom