md5 krypterings hjælp
hej jeg har et login system hvor jeg gerne vil have lavet md5 kryptering på passwords, men kan ikke rigtig få det til at fungerer... Hilsen ReneDK<?php
//see if action=check
if($_GET['action'] == 'check')
{
//check if everything is filled in
if($_POST['Fname'] == '' || $_POST['Lname'] == '' || $_POST['Uname'] == '' || $_POST['Email'] == '' || $_POST['Pword'] == '')
{
//if everything is not filled in than print out "please fill in all the field"
echo error("blank");
exit;
}
else
{
//check if the passwords match
if($_POST['Pword'] !== $_POST['CPword'])
{
//if they dont match than print out "passwords dont match"
echo error("password");
exit;
}
else
{
//if they match, see if the user exists
$result = mysql_query("SELECT * FROM easystart_brugere
WHERE Uname='{$_POST['Uname']}' || '{$_POST['Email']}' ") or die(mysql_error());
$row = mysql_fetch_array( $result );
//if row uname equals blank than create the user
if($row['Uname'] == '')
{
//create the user
$enc = md5($_POST['Pword']);
mysql_query("INSERT INTO easystart_brugere(url, url_1, url_2, url_3, url_4, url_5, url_6, url_7, url_8, url_9, url_10, url_11, url_12, url_13, url_14, url_15, url_16, url_17, url_18, url_19, Fname, Lname, Uname, Email, Pword)
VALUES('{$_POST['url']}', '{$_POST['url_1']}', '{$_POST['url_2']}', '{$_POST['url_3']}', '{$_POST['url_4']}', '{$_POST['url_5']}', '{$_POST['url_6']}', '{$_POST['url_7']}', '{$_POST['url_8']}', '{$_POST['url_9']}', '{$_POST['url_10']}', '{$_POST['url_11']}', '{$_POST['url_12']}', '{$_POST['url_13']}', '{$_POST['url_14']}', '{$_POST['url_15']}', '{$_POST['url_16']}', '{$_POST['url_17']}', '{$_POST['url_18']}', '{$_POST['url_19']}', '{$_POST['Fname']}', '{$_POST['Lname']}', '{$_POST['Uname']}', '{$_POST['Email']}', '{$
}') ")
or die(mysql_error());
//redirect to login.php?action=registered
header("Location: login.php?action=registered");
}
else
{
echo error("user");
}
}
}
}
//function error
function error($error)
{
//if error is equal to blank than write "fill in all the fields"
if($error == 'blank')
{
echo "<font size=1 face=verdana color=red>Alle felter på nær www.adresserne SKAL fyldes ud!";
}
//if error is equal to password than write "the passwords dont match
if($error == 'password')
{
echo "<font size=1 face=verdana color=red>Dine password passer ikke sammen!";
}
//if error is equal to user than write "the username is already registered"
if($error == 'user')
{
echo "<font size=1 face=verdana color=red>Brugernavn eller E-mail adresse er allerede i brug!";
}
}
?>
