hellosheikh
hellosheikh

Reputation: 3015

How to detect if it is the user's first visit in Cakephp

i am working on a Cakephp 2.x ..i have implemented a login logout system on my website so i want to know that Is there a way to detect if a user is visiting my website for the first time, and if so, redirect them to a timesettings or a 'tour' page and and if they are not a first time visitor, redirect to the dashboard..

first i though about cookies but they can be deleted, the user can use a different pc,change browser etc. neither i can try using an ipaddress.. so i want to know how can i track the user so when he login first time on my website he can see the tour only for that time and then never ..if you have done this then please share the code or share me the tutorial or give me some explanation .. because it can be possible as i have seen in facebook.they does this ...

for your information i'let you know that i am using authcomponent for login logout or cokies etc ///

Upvotes: 0

Views: 841

Answers (2)

Boštjan Pišler
Boštjan Pišler

Reputation: 852

You could also write a variable to session on registration and delete it after he finishes the tour.

Write to Register

$this->Session->write('first_login', true);

and then delete it later with:

$this->Session->delete('first_login');

Upvotes: 3

swiecki
swiecki

Reputation: 3483

Simply have a variable in your users table that defaults to 0 when the user first registers for the site. Check this variable whenever users log in. If it's their first login (variable is still 0) switch it to 1 (so it only happens once) and forward them to your tour page.

Upvotes: 1

Related Questions