简体   繁体   中英

Creating a page that displays only once on a login

I'm developing a website that when a user/member logins into the website for the first time it shows a tutorial page, just like Twitter.

If anybody could point me in the right direction or even supply the code (If it's not too long) I'd really appreciate it.

Thanks

Will

If they have to login to your website, you might want to add an extra field in your users table called something like 'inital_page_viewed' (default = false).

Once they login the first time and view this page, update this field to true. Only display the page if the field is set to false.

Cookies are a good idea for normal visitors, however if they clear their cookies and go back to the page they will get the 'tutorial page'.

Its worth bearing in mind the new EU cookie law as well, (not sure if this applies to your website). http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx

Use PHP to set a cookie on the tutorial page.

http://php.net/manual/en/function.setcookie.php

If the cookie has already been sent have the user forwarded to the actual website instead of staying on the tutorial page.

eg

if (isset($_COOKIE["tutorial"]))
header('Location: main.php');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM