[英]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. 我正在开发一个网站,当用户/成员首次登录该网站时,它会显示一个教程页面,就像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). 如果他们必须登录到您的网站,则可能要在用户表中添加一个名为“ inital_page_viewed”(默认= false)的额外字段。
Once they login the first time and view this page, update this field to true. 他们首次登录并查看此页面后,请将此字段更新为true。 Only display the page if the field is set to false. 仅当字段设置为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'. Cookies对于普通访问者来说是个好主意,但是,如果他们清除cookie并返回到页面,他们将获得“教程页面”。
Its worth bearing in mind the new EU cookie law as well, (not sure if this applies to your website). 值得一提的还有新的欧盟Cookie法,(不确定是否适用于您的网站)。 http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/the_guide/cookies.aspx 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. 使用PHP在教程页面上设置cookie。
http://php.net/manual/en/function.setcookie.php http://php.net/manual/zh/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. 如果已发送cookie,则将用户转发到实际网站,而不是停留在教程页面上。
eg 例如
if (isset($_COOKIE["tutorial"]))
header('Location: main.php');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.