View Full Version : Add session data to database... How to?

05-28-2011, 07:14 AM

I am putting together an idea for my site.

Its the 'planning' phase now, so any input is helpful.

My plan is to have the site register the session to the database.

I am looking to achieve this:

member joins at the sign up page.
if they visit again within 7 days, no '/test.jpg' page loads
if they visit on day 8, then '/test.jpg' loads, that is a Light Box.
if they visit for the first time since joining, and after there seven days, then the '/test.jpg' loads.
the '/test.jpg' page will only ever load once, not twice etc

What would i need to register into the database? The unique 'username'? And the sign up date?

Any ideas on where i could find a tutorial would be great... I need help for these:

register session into database for 'username', and 'sign up date'
php check the database and 'if true' or 'if false' then 'echo /test.jpg'?
then register to database that '/test.jpg' has loaded once
php check the database and 'if true' then never load '/test.jpg'

If there is an easier way to achieve what i am looking for please let me know.

I am an absolute beginner at this complex coding, so any php idea or tutorial is helpful, please assume i don't know anything so you can help.


05-28-2011, 10:23 AM
I use server side sessions, stored on the server. Then when I return to my website, it recognises my browser via the session data and then it compiles the page output accordingly.

Just like when we return to this site after a few days; it doesn't require a login because it identifies your browser and loads according to the session data on the server.


05-28-2011, 11:18 AM

thanks for your input, i am going to use a database entry...

please see my post: http://www.codingforums.com/showthread.php?p=1095453#post1095453