Random Link

By log2 on Dec 20, 2004

This will show a random link when someone comes to your page

<? 

//set the urls 
$urls = array("http://google.com" ,"http://hotmail.com" ,"http://hawkee.com" ); 

//set the text links 
$text = array("Google" ,"Hotmail" ,"Hawkee"); 
        srand(time()); 

//set the number in (rand()%3); for however many links there are 
        $random = (rand()%3); 
echo ("<a href = \"$urls[$random]\">$text[$random]</a>"); 

?> 

Comments

Sign in to comment.
algmelo   -  May 21, 2010

I made an adjustment to rotate links in an iframe. Perfect! Thank's

 Respond  
biggerbyte   -  Jan 14, 2009

How do you make these rel="nofollow" and target="_new" ?

 Respond  
DarthReven   -  Dec 30, 2004

*store

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.