Onbekend |
|
Ik heb een registerform.
Graag zou ik het password in md5 willen toevoegen aan de database. Iemand die mij kan helpen?
<?php
if($_SERVER["REQUEST_METHOD"] == "POST")
{
foreach($_POST as $veld => $waarde)
{
$$veld = $waarde;
}
$error_velden = array();
$verplichte_velden = array("username","password","firstname","surname","gender","residence","email");
foreach($verplichte_velden as $verplicht_veld)
{
if(empty($$verplicht_veld))
{
$error_velden[$verplicht_veld] = true;
print("<p class=\"error\">".$verplicht_veld." is niet ingevuld.</p> <br/>");
}
}
if(empty($error_velden))
{
$query = mysql_query("INSERT INTO users (us_username, us_password, us_firstname, us_surname, us_gender, us_residence, us_email)
VALUES('".$username."','".$password."','".$firstname."','".$surname."','".$gender."','".$residence."','".$email."')")
or die(mysql_error());
print("<p class=\"text\">Je bent succesvol geregistreerd. <br/>".
"Wacht nu tot je word geaccepteerd.</p>");
return;
}
}
?>
<?php if($_SERVER["REQUEST_METHOD"] == "POST") { foreach($_POST as $veld => $waarde) { $$veld = $waarde; } $verplichte_velden = array("username","password","firstname","surname","gender","residence","email"); foreach($verplichte_velden as $verplicht_veld) { if(empty($$verplicht_veld)) { $error_velden[$verplicht_veld] = true; print("<p class=\"error\">".$verplicht_veld." is niet ingevuld.</p> <br/>"); } } { $query = mysql_query("INSERT INTO users (us_username, us_password, us_firstname, us_surname, us_gender, us_residence, us_email) VALUES('".$username."','".$password."','".$firstname."','".$surname."','".$gender."','".$residence."','".$email."')") print("<p class=\"text\">Je bent succesvol geregistreerd. <br/>". "Wacht nu tot je word geaccepteerd.</p>"); return; } } ?>
Alvast bedankt .
|