You are here: checking database or session? « All PHP « IT news, forums, messages
checking database or session?

Posted by Mike on 10/10/89 11:39

I'm developing a site that a user registers, logs in and for some
pages, has to subscribe.

Basically, the user registers and then when they log in I set a session
say AUTH=yes.

Then every page the user goes to I can check the AUTH session and if
yes then display the page else request a login.

Now I will have a flag in the database that when a user subscribes the
field PAID=yes.

What would be the best way to check the user has paid at the top of
every page that requires a subscription.

I have thought of 2..

1) When the user logs in and the AUTH=yes is set, the database is also
checked for the PAID field and if PAID=yes then set a session say
USERHASPAID=yes. Then on ever page required I just check the session
USERHASPAID.

2) When the user logs in and AUTH=yes is set, the users unique id is
also stored to a session. Then on every page requiring subscription
the database is searched for the users unique id and PAID=yes.

I know they both will work but I was just wondering which would be the
prefered method.

Thanks

Mike

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация