HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 30th, 2012, 02:19 PM
searayman searayman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 4 searayman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 9 sec
Reputation Power: 0
Cookies

I am taking what I have learned my last semester to try and build my own website. I am working on a login for different users and want to know what the best practice would be.

If I use cookies to check if a user is logged in what data should I store in the cookie after the user signs in to check. I figured I wouldnt want it to be just there user name because anyone could just make that cookie themselve and log in as that user....

Any ideas woudl be greatley appreciated. I am not storing really any sensitive material on my website so it does not need to be bank secure.

Reply With Quote
  #2  
Old July 30th, 2012, 02:48 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,864 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 21 h 20 m 24 sec
Reputation Power: 813
Hi,

First of all, you should make up your mind if you actually want to offer user registration. Saying that security isn't that important for you sounds like this is going in a wrong direction.

If you just want to make the page customizable, then you don't need user accounts. Simply store the values in cookies. But if you do want to store personal information like email addresses, password information etc., then security is important.

Login information is usually stored in sessions. The functions for that are most probably already built-in in your language (whatever it is you are using).

As I already said, security is in fact very important. So you really should know how everything works before you actually start with the implemention. A particularly critical issue is of course password managment, because there's a lot you can do wrong here. And since users tend to reuse their passwords everywhere, you want to make sure you don't f*** up in securing them.

Never store passwords in plaintext or as simple hashes. The absolute minimum is to use salted hashes. A better apporach is to use specialized algorithms like PBKDF2 or bcrypt.

Reply With Quote
  #3  
Old July 30th, 2012, 03:10 PM
searayman searayman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 4 searayman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 9 sec
Reputation Power: 0
Quote:
Originally Posted by Jacques1
Hi,

First of all, you should make up your mind if you actually want to offer user registration. Saying that security isn't that important for you sounds like this is going in a wrong direction.

If you just want to make the page customizable, then you don't need user accounts. Simply store the values in cookies. But if you do want to store personal information like email addresses, password information etc., then security is important.

Login information is usually stored in sessions. The functions for that are most probably already built-in in your language (whatever it is you are using).

As I already said, security is in fact very important. So you really should know how everything works before you actually start with the implemention. A particularly critical issue is of course password managment, because there's a lot you can do wrong here. And since users tend to reuse their passwords everywhere, you want to make sure you don't f*** up in securing them.

Never store passwords in plaintext or as simple hashes. The absolute minimum is to use salted hashes. A better apporach is to use specialized algorithms like PBKDF2 or bcrypt.


thanks, I do need a login because I am keeping track of certain data that a user would want to be able to pull up on any computer.

I will explore sessions in html and perl.

Thank you!

Reply With Quote
  #4  
Old July 30th, 2012, 03:19 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,864 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 21 h 20 m 24 sec
Reputation Power: 813
Quote:
Originally Posted by searayman
thanks, I do need a login because I am keeping track of certain data that a user would want to be able to pull up on any computer.


This can be done with cookies or sessions without a real login.

An actual login with password authentication is only necessary if you are storing critical data or user identification is very important (like when users are allowed to submit content).

Reply With Quote
  #5  
Old July 30th, 2012, 08:01 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,931 E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 48 m 54 sec
Reputation Power: 7053
If he wants to track data for the user across multiple computers then a registration system makes more sense than storing it in cookies.
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #6  
Old July 30th, 2012, 09:54 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,864 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 21 h 20 m 24 sec
Reputation Power: 813
I disagree. Since he said the data isn't critical and he doesn't want to put much effort in security, I think a registration system is actually a bad idea. It's too complicated and will most likely be insecure, exposing all user data (email addresses, passwords) to the next best script kiddie.

I'd rather use public user profiles in this case (the data can be saved in a profile and reloaded -- the ID is stored in a cookie or session). Then you don't have to worry about password hashing etc., and every user knows his data isn't protected.

If, on the other hand, you want to store private data, then of course you should use a registration system.

So it depends. But what you should never do is to offer a registration system and at the same not really care about security. That's just dangerous and also dishonest with respect to the users.

I think data should be either public or private, but not "halfway private"

Reply With Quote
  #7  
Old August 9th, 2012, 12:16 PM
AvsH AvsH is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Dec 2006
Location: IL, USA
Posts: 584 AvsH User rank is Sergeant (500 - 2000 Reputation Level)AvsH User rank is Sergeant (500 - 2000 Reputation Level)AvsH User rank is Sergeant (500 - 2000 Reputation Level)AvsH User rank is Sergeant (500 - 2000 Reputation Level)AvsH User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 17 h 51 sec
Reputation Power: 20
1) COOKIES and SESSIONS are not HTML related, they are a client-side thing that you should use a language like PHP to handle.

With that said, I do a number of things for my cookies/sessions.

There is a number of ways you can handle this, you can have a field like $_COOKIE['user'] that returns the user's username, or whatever unique identifier you have, this way you can always grab their data per page, and if this is empty you can assume they are not logged on?

I always have a SESSION part inside of the "users" table in my database that I have md5 / sha1 (hashing encryptions) that store non-personal and critical data and store this into the cookie. this way I can always use that to grab the entire user after - which once "logged in" the normal / common data I grab (username, first_name, access lvl (admin|user|etc.)) can all get stored into my SESSION (not cookie) and then I can grab that all the time.

it's all a preference on you and how you want to use / manage your system.

Reply With Quote
  #8  
Old August 9th, 2012, 02:19 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,832 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 20 h 43 m 39 sec
Reputation Power: 4192
Quote:
Originally Posted by AvsH
COOKIES and SESSIONS are not HTML related, they are a client-side thing that you should use a language like PHP to handle.

Don't you mean "server-side"?
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Cookies

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap