Does anyone have a redirection system in the style from this site ?
Does anyone have a redirection system in the style from this site ?
The page code itself can help you solve the problem. There you'll see the JS for you to use as a basis for your application.
here is the download URL:
function download() {
url = QueryString("url")
// Remove o "http://" caso exista (apenas para não colocar duas vezes)
url = url.replace("http://", "")
// Adciona o "http://"
url = "http://" + url
top.document.location = url
}
</script>
Analyze counter code
<script language="JavaScript">
//<![CDATA[
var xtx=20;
function IniciaRegressivo() {
if (xtx > 0) {
document.getElementById('botao').innerHTML = '<div class="protetor-botao"><a>Aguarde '+
x +' segundos</a></div>';
xtx = xtx - 1;
setTimeout("IniciaRegressivo();", 1000);
} else {
document.getElementById('botao').innerHTML = '<div class="protetor-botao"><a
ef="javascript:download();">Fazer Download</a></div>';
} }
//]]>
</script>
and you do not perform these functions. The code is very explanatory.
I would also like to do this redirection in PHP, as the example below:
<?php
$url = $_GET['url'];
if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
header('Location: '.$url);
} else {
die('Não é uma url');
}
This is the most suitable because you can record access metrics, such as date and time of access or even IP.
You can do this:
1) If you want to obfuscate your link, use the base64_encode
base64_encode('http://google.com');
2) If you need to pass the parameter to the script, for example
http://meusite.com/redirecionar.php?l=aHR0cDovL2dvb2dsZS5jb20=
Get the link inside the script. you can use something like:
$link = base64_decode($_GET['l']);
3) To redirect, do not use the header()
function if you are going to display some output before, this will generate an error, you need Javascript
window.location = '<?php echo $link; ?>';
A simple way to implement what you're looking for with JavaScript might be:
<html>
<script>
function redirect() {
var match = /\?url=(.+)/.exec(window.location);
if (match)
window.location = match[1];
}
</script>
<body onload="redirect();"></body>
</html>
Open this page as www.exemplo.com/redirect.htm?url=http://www.google.com/
.
You can take advantage of the same idea to make the waiting code or similar things.