1)The current code has a check for the cookie on every page, which is not so unusual, what is unusual is that on every page, a call is made to the DB to authenticate the user. In apps I've written before, I authenticate from the user/pass combo in the DB once, then create a session and then on each page I validate the session.
- Which method do you think works better?
defintely use sessions, one trip to db to autheticate, store relevant needed data in the session
2) Cookies, the current code uses cookies, but stores no info other than the username. It uses the username to then call the DB (as described above) and get all info about the user, such as access permissions. There are a lot of things that I feel should be in a session. The access permissions, user type, etc. So that when they click on a page, that data is already stored in a session and no DB call is required to retrieve it.
- Which method do you think works best?
again sessions to store the data
3) There are pages of CGI code that need to be called depeding on the equipment the user is using. These cgi calls are stored in BLOB fields in the DB. The consensus here is that they would be better off in include files, rathter than calling the DB everytime.
- Would an include file be less taxing on the server than a call to the DB. yes...no connections need to be made, data to be retrieved etc....includes are much better here
4) Dates - currently, dates are being stored as epoch dates (INT) which I find strange. I asked the sysadmin about using date or datetime instead, but he thought it was less load on the DB to store as INT and then have PHP convert the date than to store as DATE and have the Query perform Date Calculations.
- Which method would you use and does it really cause that much more load on the DB if you do date calcs in the query?
i tend to use date/timestamp in the db, but it does depend on the application, never use INT though, usually date if not timestamps
hth