You are viewing our Forum Archives. To view or take place in current topics click here.
#11. Posted:
Database
  • Rising Star
Status: Offline
Joined: Sep 20, 200914Year Member
Posts: 721
Reputation Power: 32
Status: Offline
Joined: Sep 20, 200914Year Member
Posts: 721
Reputation Power: 32
First of all this is okay for learning the basics, but you have not added a note anywhere saying this will and should not be used in a real sittuation, because although you have striped slashes, you dont have enough security in there, include some salts and other hashing methods to sanitize the data.
#12. Posted:
GameDev14
  • Junior Member
Status: Offline
Joined: Jan 10, 201410Year Member
Posts: 80
Reputation Power: 3
Status: Offline
Joined: Jan 10, 201410Year Member
Posts: 80
Reputation Power: 3
Nicasus wrote It seems that you copied the majority of the code from a website.
[ Register or Signin to view external links. ]

Not even to mention that person explicitly says that he is having trouble with it (getting errors), and you think it's a good idea to use that code for a tutorial? The code you posted is full of errors and mistakes.

Few tips to improve this tutorial:
  • It wouldn't hurt to have something about how to actually create a database. If someone needs a tutorial for a login then they probably don't know much about databases either.
  • The password input field has the type "text" instead of "password". No one wants their password to be displayed on the screen as they enter it.
  • mysql_* commands are soon to be deprecated, for good reasons. At least switch to mysqli_* commands for basic tutorials, but preferably to MySQLi OO or PDO. They also have good methods to sanitize inputs.
  • Simply checking if a user has a username registered, with even an already deprecated function, is not good enough. On every page the login details should be run through the database to see if they actually exist or are still the same.

I suggest you look into PHP some more before posting tutorials. At least follow another tutorial and try it out to make sure it actually works.


Z61 wrote This is hardly a tutorial.
And this is hardly feedback. Next time, don't bother posting if you have nothing useful to say.


I actually didn't copy from the site you linked, it is alike but i wouldnt steal someone else's work and say its mine. And i mentioned above that i should of included mysqli instead of just MySql. Like i said this is one of my first tutorials so some things that should of been added didnt cross my mind
#13. Posted:
GameDev14
  • Junior Member
Status: Offline
Joined: Jan 10, 201410Year Member
Posts: 80
Reputation Power: 3
Status: Offline
Joined: Jan 10, 201410Year Member
Posts: 80
Reputation Power: 3
Database wrote First of all this is okay for learning the basics, but you have not added a note anywhere saying this will and should not be used in a real sittuation, because although you have striped slashes, you dont have enough security in there, include some salts and other hashing methods to sanitize the data.


Okay i will edit the post and add how to encrypt the password
#14. Posted:
Database
  • Rising Star
Status: Offline
Joined: Sep 20, 200914Year Member
Posts: 721
Reputation Power: 32
Status: Offline
Joined: Sep 20, 200914Year Member
Posts: 721
Reputation Power: 32
GameDev14 wrote
Database wrote First of all this is okay for learning the basics, but you have not added a note anywhere saying this will and should not be used in a real sittuation, because although you have striped slashes, you dont have enough security in there, include some salts and other hashing methods to sanitize the data.


Okay i will edit the post and add how to encrypt the password


good job, and also dont do md5, that is crackable, use blowfish.
#15. Posted:
7en
  • Wise One
Status: Offline
Joined: Aug 16, 201211Year Member
Posts: 598
Reputation Power: 29
Status: Offline
Joined: Aug 16, 201211Year Member
Posts: 598
Reputation Power: 29
I thought this was important enough to write up. Here's how to generate a secure hash:salt. I hope I never see another md5() hash in the context of passwords ever again; it wasn't designed with security in mind. NOTE, password_hash is only available in PHP >=5.5.0


<?php
   $password = 'example';
   // Example password. Madhex.

   $cost = 9;
   /* Complexity of hash algorithm. As you can see, resource exhaustion is doubled per increment. Don't set over 10 unless you have either;
   a) A low-traffic site
   b) A powerful server
   Try experimenting with it. Running on a local WAMP stack, I got the following results..
   $cost = 9:  0.076004981994629s
   $cost = 10: 0.15000009536743s
   $cost = 11: 0.29000115394592s
   $cost = 12: 0.59000086784363s
   $cost = 13: 1.1800019741058s
   $cost = 14: 2.3600029945374s
   $cost = 15: 4.7210068702698

   In comparison, the server was actually unable to calculate the time taken to produce an md5() hash. */

   $salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);
   /* Salt must be 22 chars long for use with password_hash. Generate this string seperately because it will need
   to be saved to the DB alongside the hash for obvious reasons. */

   $options = ['cost' => $cost, 'salt' => $salt, ];
   $hash = password_hash($password, PASSWORD_BCRYPT, $options);

?>


EDIT - Just for the hell of it, I had to run md5(/random_pass/) 5500 times before the server even registered the time taken. For you security geeks, that equates to 20,000,000 passwords/second. Stahp. Using. md5().
#16. Posted:
UnrealEgg
  • Powerhouse
Status: Offline
Joined: May 30, 201014Year Member
Posts: 438
Reputation Power: 49
Status: Offline
Joined: May 30, 201014Year Member
Posts: 438
Reputation Power: 49
On the topic of password hashing, I found [ Register or Signin to view external links. ] recently and it's a great read, also has code.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.