note 79580 added to function.mysql-real-escape-string

From: Date: Tue, 04 Dec 2007 13:30:48 +0000
Subject: note 79580 added to function.mysql-real-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-132791@lists.php.net to get a copy of this message
<?php $try_pass=md5($_POST['u_pass']); ?> I would also suggest to add a salt to the MD5 function. So that hackers are able to retreive all the data because of some application bug, they can't be able to get the pain text passwords using a code as follows: <?php define('SALT_LENGTH', 9); function generateHash($plainText, $salt = null) { if ($salt === null) { $salt = substr(md5(uniqid(rand(), true)), 0, SALT_LENGTH); } else { $salt = substr($salt, 0, SALT_LENGTH); } return $salt . sha1($salt . $plainText); } ?> Code from: http://phpsec.org/articles/2005/password-hashing.html ---- Server IP: 203.199.69.133 Probable Submitter: 220.227.202.209 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php Edit -- https://master.php.net/note/edit/79580 Del: integrated -- https://master.php.net/note/delete/79580/integrated Del: useless -- https://master.php.net/note/delete/79580/useless Del: bad code -- https://master.php.net/note/delete/79580/bad+code Del: spam -- https://master.php.net/note/delete/79580/spam Del: non-english -- https://master.php.net/note/delete/79580/non-english Del: in docs -- https://master.php.net/note/delete/79580/in+docs Del: other reasons-- https://master.php.net/note/delete/79580 Reject -- https://master.php.net/note/reject/79580 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132791) next »