Jump to content

Recommended Posts

is this enough?

$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$_POST['password'] = mysql_real_escape_string($_POST['password']);
$_POST['password2'] = mysql_real_escape_string($_POST['password2']);
$_POST['hidden'] = mysql_real_escape_string($_POST['hidden']);
$_POST['username'] = htmlentities($_POST['username']);
$_POST['email'] = htmlentities($_POST['email']);
$_POST['password'] = htmlentities($_POST['password']);
$_POST['password2'] = htmlentities($_POST['password2']);
$_POST['hidden'] = htmlentities($_POST['hidden']);

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327031
Share on other sites

Just in case, you should also strip_tags it ( http://ca.php.net/manual/en/function.strip-tags.php )

 

$name = strip_tags($name);

 

Also, for a maximum protection, use sha1() instead of md5()

 

$pass = sha1($pass);

 

Then, to authenticate, verify if it matches the one in the database :

 

if (sha1($_POST[pass]) === $database_pass)

    {...}

else

    {...}

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327058
Share on other sites

You should use the strip tags to strip all the scripts from the username

 

strip_tags()

http://www.php.net/strip_tags

 

And you might want to use the trim to stop people from having users like "h      e      l    l    o  "

trim()

http://www.php.net/trim

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327083
Share on other sites

And you might want to use the trim to stop people from having users like "h      e      l    l    o  "

trim()

http://www.php.net/trim

trim only clears whitespace at the begining and end of the string. it does not clear whitespace between characters

Link to comment
https://forums.phpfreaks.com/topic/65492-md5-password/#findComment-327103
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.