in reply to combining cookies and user registration - strategies?

Sounds like an okay idea. It might take some time and some work (and what website doesn't, right?), but you might have something going here. Now, the one thing that springs instantly into my mind is keeping track of data for non-registered users and registered users. Using a database, if you didn't want to have separate tables for registered and non-registered users, here's an idea I propose:


If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, reply to this node or /msg me to tell me what is wrong with the post, so that I may update the node to the best of my ability. If you do not inform me as to why the post deserved a downvote, your vote does not have any significance and will be disregarded.

  • Comment on Re: combining cookies and user registration - strategies?

Replies are listed 'Best First'.
Re: Re: combining cookies and user registration - strategies?
by Cabrion (Friar) on Feb 11, 2003 at 13:08 UTC
    Ugh, please don't pack your data columns like "anon_xxxx". Use the DBMS. Create an anonymous column of type boolean. You really need to normalize this table heavily. See any good SQL intro on rationalization/normalization. Otherwise you are going to take a serious performance hit. Consider these two tables: Users ("anon_xxx" used in id)
    id, data

    vs.

    Users (boolean flag)
    id, anon, data

    In the first example, to retrieve a given username, your perl code has to retrieve EVERY row, split the id field on "-" and check for a match.

    In the other example you simply ask the database for the row(s) "where id = $userid and anon = false". The database will be much faster because it can use indexes to skip a great deal of the records and quickly zero in on the user id of your choice. Remeber, a good database (ala Postgres) will be written in C and is optimized for grinding through large amounts of data efficiently.