Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $mydomain = 'yourdomain.com';
- $host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST);
- $url = $_GET['url'];
- if ($host==$mydomain || isset($_GET['step']) && $_GET['step']==2) {//if using site directly, or already 2nd step
- $redirectUrl = $url;//referer is OK, go to real url
- }
- else {//1st step. redirect to 2nd step to change referer
- $redirectUrl = "?".http_build_query(array('step'=>2) + $_GET);
- }
- ?>
- <html>
- <head>
- <!-- HTTP redirect in 3 seconds, in case javascript does not work -->
- <meta http-equiv="refresh" content="3;url=<?=$redirectUrl?>" />
- </head>
- <script type="text/javascript">
- function openUrl(url)
- {
- var fakeLink = document.createElement('a');
- // Firefox & other browsers
- if (typeof(fakeLink.click) == 'undefined')
- {
- location.href = url;
- }
- // Internet Explorer
- else
- {
- fakeLink.href = url;
- document.body.appendChild(fakeLink);
- fakeLink.click();
- }
- return true;
- }
- //javascript redirect in 100 ms.
- setTimeout(function(){openUrl("<?=$redirectUrl?>");}, 100);
- </script>
- <body>
- <center>
- Redirecting...
- </center>
- </body>
- </html>
Add Comment
Please, Sign In to add comment