Re: Logging visitors path and presenting this to visitors
| From: | Robert Cummings | Date: | Sat, 18 Feb 2006 05:09:51 +0000 |
| Subject: | Re: Logging visitors path and presenting this to visitors | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230678@lists.php.net to get a copy of this message | ||
On Fri, 2006-02-17 at 23:47, Peter Lauri wrote:
> Hi,
>
> I am about to create a feature that will help the visitor in his/her
> navigation of the page. I want to store the visitors last 10 pages that was
> visited so that this person easily can go back to a page he was at before,
> without using the BACK button. I see two solutions to this, but I am not
> sure on witch one to choose.
>
> 1. Create a session variable that contains the last 10 pages and update that
> variable for every page he/she visits.
>
> 2. Have a database table that contains this information that is related to
> the session ID.
>
> I am concerned that 2 will take resources from the server, but I would use
> an already created link to the database. So maybe the inserts and selects
> are neglectable?
>
> Number 2 can also be extended to an even better solution, when the user
> comes back, the data can be recovered if we set a cookie for this.
>
> However 1 is much easier to implement, but 2 can be extended to better
> functionality.
>
> Witch one would you choose?
It's volatile data that you have no desire to keep between sessions
(otherwise you wouldn't link it to the session) in which case unless
there's a LOT of it there's no point using another table -- especially
since it sounds like it will be loaded on every page. If you want
maintainability, use a nice associative array structure that can easily
be adapted later.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'