Monday, September 10, 2012

PHP random link

Ukoliko ste nekada imali potrebu da na internet prezentaciji postavite reklamne linkove, ali tako da istu poziciju deli više oglašivača, sledeći kod je pravo rešenje za vas:

<?
$random_url = array("http://www.hostirex.com/1.html",
"http://www.hostirex.com/2.html",
"http://www.hostirex.com/3.html",
"http://www.hostirex.com/4.html",
"http://www.hostirex.com/5.html",
"http://www.hostirex.com/5.html");


$url_title = array("Test1",
"Test2",
"Test3",
"Test4",
"Test5",
"Test6");


$url_desc = array("Test1 sadrzaj",
"Test2 sadrzaj",
 "Test3 sadrzaj",
 "Test4 sadrzaj",
 "Test5 sadrzaj",
 "Test6 sadrzaj");


srand(time());
$sizeof = count($random_url);
$random = (rand()%$sizeof);


print("<center><a href=\"$random_url[$random]\">$url_title[$random]</a> $url_desc[$random]</center>");
?>

 
 

1 comment:

  1. this is good blog.For Affordable Search Engine Optimization please contact us.we are offering very cheap SEO packages, For further information please click on above link.

    ReplyDelete