ik heb een script maar hij slaat 2 stappen over.
PHP:
$form ='<form action="" accept-charset="UNKNOWN" enctype="application/x-www-form-urlencoded" method="post">
<td> </td>
<table border="0" cellspacing="1" cellpadding="3" width="100%" bgcolor="#000000">
<tbody>
<tr>
<td colspan="3"><strong> </strong></td>
</tr>
<tr>
<td>oude wachtwoord</td>
<td>:</td>
<td><input id="oud" name="oud" type="password"></td>
</tr>
<tr>
<td>nieuwe wachtwoord</td>
<td>:</td>
<td><input id="new1" name="new1" type="password" /></td>
</tr>
<tr>
<td>herhaal nieuwe wachtwoord</td>
<td>:</td>
<td><input id="new2" name="new2" type="password" /></td>
</tr>
<td><input id="go" name="go" type="submit" value="wijzig wachtwoord" /></td>
<tr>
</tr>
</tbody>
</table>
</form>';
if(isset($_POST['go'])) {
$dead = "false";
include("database.php")
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
session_start();
$username= $_SESSION['username'];
$oud= $_POST['oud'];
$oud = trim($oud);
$oud = md5($oud);
$query = "SELECT * FROM members WHERE username='$username'";
$sql=mysql_query($query) or die (mysql_error());
while ($obj=mysql_fetch_object($sql)) {
$pass = $obj->password;
// If result matched $myusername and $mypassword, table row must be 1 row
if($oud != $pass){
$mes = "het eerste wachtwoord is fout";
$dead = "true";
}
$new1 = $_POST['new1'];
$new2 = $_POST['new2'];
if($new1 != $new2){
$mes = "het de 2 wachtwoorden zijn niet hetzelfde wachtwoord is fout";
$dead = "true";
}
if(strlen($new1) <= 5 or strlen($new1) >= 21){
$mes = "wachtwoord is te kort of te lang(6-20)";
$dead = "true";
}
if($dead == "false"){
$new1 = trim($new1);
$new1 = md5($new1);
mysql_query("UPDATE members SET password = '$new1' WHERE username = '$username'");
echo'je wachtwoord is gewijzigt';
}
elseif($dead == "true"){
echo $mes;
echo $form;
}
}
}
if(!isset($_POST['go'])) {
echo $form;
}