Welcome Guest, Not a member yet? Register   Sign In
Get last 2 access urls

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

(This post was last modified: 12-18-2014, 05:05 AM by InsiteFX.)

PHP Code:

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 )

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

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.

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.


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

(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:


Theme © iAndrew 2016 - Forum software by © MyBB