2

I Don't know right title of this question. Yesterday i found this site http://www.hyper-hippo.net/ and every i click link in post page, the link goto redirect page. How it's work? And that site create it in blogger. Maybe the script is same like adf.ly, but how to?

And how to make redirect page, when in address bar type ?url=www.google.com will go to redirect page and the link will go to google.com.

NimaNr
  • 532
  • 5
  • 20
  • I'm not that good in web-technologies. AFAIK, the redirect will happen from the server side. For instance you are contacting the adf.ly/qNMFHF45 , the server will send you a HTTP Redirect code 302 with the new URL (you-blog-link.com) the brwoser catches the 302 signal and contacts the new location now. Thus your blog gets loaded. – RC Brand Jan 19 '15 at 08:43

4 Answers4

1

perhaps I may help. in ASP.NET, we use AdRotator to redirect the page. Meaning you can have one page like the "hyper-hippo.net" build with the adRotator.

This is an example: in ASP.NET

$sql = mysql_query("SELECT * FROM sites WHERE sites ='" . $_POST["sitess"] . "'");
$id = mysql_fetch_array($sql);

<p><a href="ad1.xml" target="_blank">View XML file</a></p>

This is another example in PHP :

$ads = array("ad code goes here", "more ad code", "more ad code");
shuffle($ads);
print $ads;

This is another one in HTML

<div id="rotator">
    <img class="ad" src="#" />
    <img class="ad" src="#" />
    <img class="ad" src="#" />
    <img class="ad" src="#" />
</div>

This is another one in JS + HTML

<div id="rotator">
    <img class="ad" src="ad_banner1.png" />
    <img class="ad" src="ad_banner2.png" />
    <img class="ad" src="ad_bannerN.png" />
</div>

<script type="text/javascript">// Fisher-Yates Algorithm written by Gio Borje <http://www.giocc.com>
(function() {
    // Get the list of ads on your site
    var ads = document.getElementsByClassName("ad");

    // Used for swapping in the algorithm
    var tmp;

    // Random index to swap with
    var randomIdx;

    // Random sorting algorithm
    for (var i = 0; i < ads.length - 1; i++) {
        randomIdx = i + 1 + Math.floor(Math.random() * (ads.length - i));
        tmp = ads[randomIdx].src;
        ads[randomIdx].src = ads[i].src;
        ads[i].src = tmp;
    }
}​)();</script>

I Hope this Help!!!

McElie
  • 140
  • 3
  • 12
0

You can use meta tag in the head section of the html something like this

<meta http-equiv="refresh" content="0; url=http://example.com/" />
Mukesh Agarwal
  • 530
  • 4
  • 15
0

you can use a header() function like this:

if (isset($_GET['url'])){ //check if URL is set in adress
    $url = htmlspecialchars(filter_input(INPUT_GET, 'url'), ENT_COMPAT, 'UTF-8'); // XSS attack prevention 
    if(strpos($url,'http://')>0 ||strpos($url,'https://')>0){ // check if the address is http://example.com or example.com
        header('Location: '.$url.'/'); // redirection code of php
    } else {
        header('Location: http://'.$url.'/');
    }
}
NimaNr
  • 532
  • 5
  • 20
0

To do this follow these steps:

1. Link is to make using target blank.

Example:

Open link in a new window or tab:

<a href="alvinshortener.com/index.php?url=www.google.com" target="_blank">Visit </a>

inside index.php write:

<?php
if(isset($_GET['url'])){
header("Location: $_GET['url']");
}
?>
Asif Iqbal
  • 1,132
  • 1
  • 10
  • 23