Random Text Link Script

December 18, 2008 · 106 Views · Filed Under Scripts 

This is a very simple script that will insert a random text link in a desired location. All you have to do is copy the text below and paste it in notepad and name it “random.php”.

<?
$random_url = array("http://www.google.com/1",
                    "http://www.google.com/2",
                    "http://www.google.com/3",
                    "http://www.google.com/4",
                    "http://www.google.com/5");
 
$url_title = array("Google Link 1",
                   "Google Link 2",
                   "Google Link 3",
                   "Google Link 4",
                   "Google Link 5");
srand(time());
$sizeof = count($random_url);
$random = (rand()%$sizeof);
print("<a href="$random_url[$random]">$url_title[$random]</a>");
?>

Then, insert the following code in your php file where you want the link to appear.

<?php include ("random.php"); ?>

Enjoy!

Comments

Leave a Reply