+ Reply to Thread
Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By essellar

Thread: Security

  1. #1
    kimwong99956 is offline x10Hosting Member kimwong99956 is an unknown quantity at this point
    Join Date
    May 2011
    Posts
    5

    Security

    I've often wondered what is best when it come to login id's. Should one put the login and password on the same table as the customer data (i.e. they are customer user id's) or should one put them in a completely seperate table,

    thoughts anyone

    Kim

  2. #2
    Gouri's Avatar
    Gouri is offline Community Paragon Gouri has a brilliant futureGouri has a brilliant futureGouri has a brilliant future
    Join Date
    Oct 2007
    Location
    India
    Posts
    4,502

    Re: Security

    Quote Originally Posted by kimwong99956 View Post
    I've often wondered what is best when it come to login id's. Should one put the login and password on the same table as the customer data (i.e. they are customer user id's) or should one put them in a completely seperate table,

    thoughts anyone

    Kim
    It is better to keep the login IDs table seperate.
    If you feel my post is useful then click to give Reputation (bottom left corner of this post)

    X10 Hosting | News and Announcements | Premium Hosting | VPS Hosting | Prime Membership

    Tech Community | Gouri

  3. #3
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Security

    You should not store passwords.

    You should store a hash (md5 [not the best], sha256, etc) of the password. Then when a user tries to log in, you hash his submitted password and compare that with the stored value.

    You can add a random salt value, stored either in a column the password table or prepended to the final hash value.

    If a user forgets his password, you cannot give him his old one. You never stored it. So you issue him a new one.
    Nothing is always absolutely so.

  4. #4
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Security

    Quote Originally Posted by descalzo View Post
    md5 [not the best]
    Easier to brute force, but in no way less secure if your database is secure. http://webdevrefinery.com/forums/top...hashing-myths/

    $finalHash = md5(md5($salt) . md5($password))
    Have a unique salt for every user - changed automatically whenever the user changes their password, too - and as long as your database isn't stolen, the passwords are safe. And lets face it, if someone has access to your database, you're in trouble anyway.

    ~Callum
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  5. #5
    kimwong99956 is offline x10Hosting Member kimwong99956 is an unknown quantity at this point
    Join Date
    May 2011
    Posts
    5

    Re: Security

    so why is it better to have login Id's in a seperate table

  6. #6
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Security

    Quote Originally Posted by kimwong99956 View Post
    so why is it better to have login Id's in a seperate table
    I would recommend putting them on the same table as their data, it's no less secure and easier for you.
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  7. #7
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,153

    Re: Security

    Quote Originally Posted by kimwong99956 View Post
    so why is it better to have login Id's in a seperate table
    That really depends on what you mean by "customer data" (and, to an extent, on what you mean by "database", since SQL-addressed relational databases aren't the only tool in the shed). If you are using a relational database, the object of the game is to normalize your data, at least to an extent. For the most part, in the applications I write the login table will have the user's login name (often, that's an email address rather than a screen handle), the "nonce" or "salt" for the hashed password, the hash value of the salt-plus-password (as often as not I'll use SHA 512 and encourage pass phrases) and a user ID. The rest of the data goes into other tables, since there may be several simultaneous values (multiple addresses, phone numbers, different names for different purposes, etc.).

    In general, any time you look at a category (column) of data and say to yourself "ooh, there could be two of those", it's time to break it out into a different table. There are some things I have seen multiples of often enough that I'll use separate tables right from the get-go rather than waiting for the other shoe to drop -- it's less work to build a battleship than to convert an outboard runabout into one later.
    misson likes this.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

+ Reply to Thread

Similar Threads

  1. Security
    By nathandtrone60 in forum Free Hosting
    Replies: 1
    Last Post: 09-11-2010, 12:22 PM
  2. Security Security Security
    By steev8ch in forum Free Hosting
    Replies: 8
    Last Post: 09-25-2009, 03:37 PM
  3. Security **
    By Corey in forum Service Alerts
    Replies: 7
    Last Post: 07-18-2006, 04:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers