FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Need this script

 


vignesh_natraj
i need a java script to rotate the start page so that each visitor is taken to a new page each time they visit.ie if someone visits my page they will be taken to another page which i can set and if they hit reload they will be taken to next page in the list.
Ducksteina
I don't know how to do it in JavaScript, but in PHP you just could create an array of URLs, choose one randomly and forward the browser to it easily. I can write an example if you want.
Stubru Freak
vignesh_natraj wrote:
i need a java script to rotate the start page so that each visitor is taken to a new page each time they visit.ie if someone visits my page they will be taken to another page which i can set and if they hit reload they will be taken to next page in the list.


Make an array with the url's.
if(a cookie is already set){
set cookie to cookie + 1
} else {
set a cookie with value 0
}
location.href = urlArray[cookieValue];
vignesh_natraj
Ducksteina wrote:
I don't know how to do it in JavaScript, but in PHP you just could create an array of URLs, choose one randomly and forward the browser to it easily. I can write an example if you want.

i actually tried javascript usind arays but it didn't work out so can you give an example in php
yjwong
PHP, with same functionality with the Javascript code above:
Code:

if(isset($_COOKIE['name'])) {
setcookie("name", "1", <unix timestamp>);
} else {
setcookie("name", "0", <unix timestamp>);
}
header("Location: $url_array[cookie_vals]");
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.