Hey because of jds post, I want all P-Server owner to check their signup and login pages. Passwords have to be saved encryped!!
If you save them as plain text put this in (you need to modify this to your cms)
First of all the SQL-Queries
dosignup-part
modify the the INSERT INTO users query,
delete password. replace it with passhash and secret to make it loke like that
dologin-part
global_included.php
If you save them as plain text put this in (you need to modify this to your cms)
First of all the SQL-Queries
Code:
ALTER TABLE `users` DROP COLUMN `password`; ALTER TABLE `users` ADD `passhash` varchar(32); ALTER TABLE `users` ADD `secret` tinyblob;
PHP Code:
$wantpassword = $_POST["password"];
$secret = mksecret();
$wantpasshash = md5($secret . $wantpassword . $secret);
delete password. replace it with passhash and secret to make it loke like that
Code:
INSERT INTO users (username, passhash, secret, ... VALUES (" .
implode(",", array_map("sqlesc", array($wantusername, $wantpasshash, $secret, ...
PHP Code:
// change $row with your var
$password = $_POST["password"];
if ($row["passhash"] != md5($row["secret"] . $password . $row["secret"]))
die();
PHP Code:
function mksecret($len = 20)
{
$ret = "";
for ($i = 0; $i < $len; $i++)
$ret .= chr(mt_rand(0, 255));
return $ret;
}