/    Sign up×
Community /Pin to ProfileBookmark

PHP User Database Columns

I am going to implement a user registration system on my website([url]www.sockigami.com[/url]). Please listen: I don’t want any code unless I ask, so you don’t have to waste your time writing code for me. I would just like some input on what some general columns in the database should be. Here’s what I have so far: Email, username, password (encrypted), models submitted, registration time, last login, and points. Is there anything obvious (or not so obvious) I am missing? Thanks for replying!

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — registration ip address might be useful, in case someone registers with someone elses email address and that person actually wants to do something about it... ?

a status field.

normally set to 1, you can set it to 2 to ban a user or to X to give the user extra (admin for example) rights.

a user rating> other users can rate models submitted. average modelscore gets stored for that user. (say I submitted 4 socks with an average rating of 4.5, my user rating would be 4.5 ? )

first middle lastname... optional.

profile field: user edittable, allows them to add some personal info/signature info to their account.

etc...
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — Thanks! I actually already had the status thing, I called it activation, but your ideas are great! Did you actually go to the website, because it's not working for me, my connection needs to reset the DNS cache I think.
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — For the rating, which I'm also doing for each model, do you think I should have total rating and the number of votes to do that, and then just divide, or an easier way?
Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — your link above contains a ) at the end:

http://www.sockigami.com/ the homepage works for me...

Parts of the site are indeed down however...
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — Fixed it! and did the models section work?
Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — say voting per model is possible

1 is lowest vote 5 is highest.

total the score per model in that model's row in the models table, keep track of the number of votes and divide by total score to get models average.

Save total of all votes for all models to users row, as wel as number of votes. recalculate average based on that.

example, all models by same user:

model 1: votes: 100 total: 425, rating 4.25

model 2: votes: 50 total: 195, rating:3.9

model 3: votes: 69 total: 326, rating:4.72

user: votes:219 total: 946, rating: 4,319

Just update both the user and model's tables when a user votes. :-)
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — Do you think I should actually have the rating column? It's just using the other columns to find the answer?
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — You basically have the same system I was going to use, but you typed it to me so I know I won't screw up ?
Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — Downloaded and zipped the visible parts of the website for those of you that can't view it.

open the zip and click index, the rest will explain itself ?

available at:

http://www.aarts-design.com/webdeveloper/downloads/Sock.zip

[SIZE=1]*thanks to sockigami for allowing me to spider the page...[/SIZE]

Have fun! :p
Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — Do you think I should actually have the rating column? It's just using the other columns to find the answer?[/QUOTE]
Whether you need the column? No.

It depends on how you want to use the code,

*1: If you're displaying the models, do you want the submitters rating to appear?

*
2: If your showing submitters profile, do you want individual ratings to appear?

*3: what happens when someone votes?

Rating only in modelstable:

*1 --> you have to recalculate the users rating every time you show a model to every user. Only requires 1 query to retrieve all ratings by user="user" per modelpage.

*
2 --> you have to query the membertable for member stats, and query the modeltable for rating stats. Have to recalculate the users rating.

*3 --> vote causes modeltable to be query'd once.

Rating in both tables:

*1 --> you have 2 querys to the database per model, no extra calculation required.

*
2 --> you have 1 query to the members table, models table query not required.

*3 --> vote causes both models and members tables to be updated.

You decide which will cause more processor load ?
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — What I meant was I know I need the votes and total columns, but do I need the rating column?
Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — No, the math needed to complete that is so easy it shouldn't have any impact on the server.[code=php]function get_rating($votes,$total)
{ return round(($total/$votes),2); }[/code]
?

Please listen: I don't want any code unless I ask, so you don't have to waste your time writing code for me.[/quote] hehehe :p
Copy linkTweet thisAlerts:
@chesemonkylomaauthorSep 07.2006 — I just didn't want the extra columns!!
Copy linkTweet thisAlerts:
@DJsACSep 07.2006 — I misinterpreted your question the first time...

I'm sorry, it won't happen again.. :eek:

I thought you meant without the rating + votes + total colums in user table, calculate the users rating on every page using stats from the models pages... :rolleyes:

Your solution was indeed better.
×

Success!

Help @chesemonkyloma spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...