How to force all the visitors to redirect to one page first then can continue to the other page
I have a member area page example http://mywebsite.com/private/members.php
and there is a gallery page which I place the link on the members.php
which is http://mywebsite.com/private/premium.php
what I want to make is that w开发者_C百科hen they already logged in if they visit the first time either they go directly to http://mywebsite.com/private/premium.php
or clicked the premium.php
from members.php page they will be redirect to this page first example http://mywebsite.com/private/announcement.php
then they can click on the link to continue after they read my announcement first
I know this will be so annoying and complicate (maybe) but I just want them to see my announcement first before get to the premium.php page.
Thanks
You can simply add a javascript (jquery for instance) popup with overlay on your /premium.php on load. I reckon would be a better way. Alternatevely you can send them to announcment page from /premium.php using header. On announcement page when they click next set a session variable. (Put next button in a form). On premium page check for that session variable. If it's not set - header redirects them to announcement page, otherwise they stay on /premium.php Still think simple modular poup would be better way to go about your announcement thingy.
if you have a login history table, you can check the update_dt
on your last announcement and compare it to the login_dt
of a users last login. If they have not logged in since the last announcement, you can direct them to your page.
I would have probably create a bridge table to tie the announcement and users together. This table would store the primary key for the user table, the primary key from the announcement table, and a either a boolean field to indicate that the user has seen the announcement, or a date/time field to show when they read the announcement. (or both if you want)
When the users hit your premium page, you can check to see if the user has read the announcement by querying this table. If the announcement has not been read, it will be a simple header redirect to take them to the correct page.
If you want them to see your announcement every time after a certain time-period, you would go set a cookie for some time (say 10 days) and see if it's there (if not, it's expired and you show your announcement again).
If you want them to see it the first time they click it after they registered on your site, I would add a Database-table with a tinint
which is 0
if they didn't and is changed to 1
if they did.
In the case your described, I wouldn't use an other site (your announcement.php
) but check it they read your announcement on the premium.php
-site. If they did (the row-value is set to 1
), they see the site.
If not (the row-value is 0
), they see your announcement and you set the mentioned tinyint
in your Database to 1
. After they saw it they can click on a link (which will redirect them to the premium.php
-site, so basically reload the page) and then check again if the row-value is 1
(which will be the case). So they only see your announcement once.
精彩评论