Re: (another, not entirely)sessions question

From: Date: Fri, 20 Jul 2001 11:42:21 +0000
Subject: Re: (another, not entirely)sessions question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58883@lists.php.net to get a copy of this message
Hi Conor! On Fri, 20 Jul 2001, Conor McTernan wrote: > Hey there, > > I'm currently writing a web app using php. I was just looking for some > advice on one aspect. On this site, users will be able to log in and post > messages, or articles, or replies etc, you get the idea. > > Anyway, I am storing some info about the users, the usual stuff, name, > email, password, all in mysql. I am also storing other info, such as when > they last posted, and how many times they have posted. > > When a user posts a new message, the message is sent to mysql and stored > in a table, at the same time, i also have to increment their total number > of posts. The way this is done is by selecting the posts field on their > userid, which i have to find using their username, which is set as a > session var, when the user logs in. This all results in a good few > queries to mysql. > > I was wondering would it be better to load all the user info, e.g. number > of posts, last post date, into session vars, or should i set a cookie on > the client side, or should i just continue with the queries. avoiding DB interaction is a good thing, and session storage is your friend as for cookies, you cannot trust them (e.g. despite I posted the maximum allowed 100 msgs I can send a cookie saying I'm "firstpost" and keep spamming) I guess if a user profile is not too big, you should have it available in session. -- teodor

« previous php.general (#58883) next »