Reputation: 3967
I want to show different home page when user visit every time my site, means new html page on every new visit or repeat visit.
When user open a site the first time he/she see x.html next time y.html next z.html and so on.
Please help me
Upvotes: 0
Views: 203
Reputation: 448
You may use cookies to store information on user (client) side that he/she has already visited your site. Please refer to: http://php.net/manual/en/features.cookies.php for info about cookies in PHP. It requires that user accepts cookies in the browser. In the cookie you may keep info about already seen pages.
Yet another way is to store such information on server side but it may be risky because it is not obvious how to identify unique user on server side (combination of IP + browser - may not always work - users from the same private network may provide the same externally visible IP).
The last solution that comes to my mind is to force user to login to your page. Then, upon login, you may count a number of times the given user (identified by username) has been on your page and provide diffent page each time.
Upvotes: 2
Reputation: 3332
Create a script that will choose a different page at random.
Store the pages in an array
$pages = array('page1.php','page2.php','page3.php');
Get random number
$rand = mt_rand(0,2);
Use that random number to choose page from array
$rand_page = $pages[$rand];
Then show the page to the user
include($rand_page);
Upvotes: 1