• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get last 2 access urls

#1
Is there a way to get the last 2 urls a user access ?
Reply

#2
PHP Code:
$_SERVER['HTTP_REFERER'


This will return the URL that you just came from, you can then save it to an array etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
I found 1 way by using cookies .. not sure if that is the correct way ...
Reply

#4
Hi Grigore,

Yes, to store the last TWO urls you will need to use some kind of persistent storage mechanism. This could be cookies, or something else like in a database, or in "sessions" (which can be either cookie or database driven).

Keep in mind, anything in a cookie is pretty easy for someone else to sniff, so if your URLs contain sensitive information (which they shouldn't), such as a secret login code for example, then you are opening yourself up to a security risk.
Reply

#5
If you have a user who is logged in, you simple can track the urls he access and log it with a timestamp (table, logfile, ..).
If you have no login you do the same but theefore you have no personal data and of courese all anonymous users will be mixded together.

Reply

#6
store it in session, and it will be fine Smile
Follow us at https://twitter.com/LIBRETeamStudio to get a lot of new cool stuff
Reply

#7
(12-18-2014, 05:39 PM)libreteam_studio Wrote: store it in session, and it will be fine Smile


I agree with the rest. Store it in session and you will easily retrieve the last two urls.
Proprietor and Developer:

http://app-arsenal.com
http://senhosting.com
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.