$value){
if ( substr( $key, 0, $search_len) == $search_prefix) {
unset( $_SESSION[$key]);
}
}
}
if($_GET['error'] == 1){
$smarty->assign('passwort_pflichtfelder', "1");
$smarty->assign('passwort_error_text', "Es ist zu einem Fehler gekommen. Bitte füllen Sie alle Passwortfelder aus.");
}
if($_GET['error'] == 2){
$smarty->assign('passwort_pflichtfelder', "1");
$smarty->assign('passwort_error_text', "Das neue Passwort stimmt nicht mit der Passwortwiederholung überein!");
}
if($_GET['error'] == 3){
$smarty->assign('passwort_pflichtfelder', "1");
$smarty->assign('passwort_error_text', "Das alte Passwort ist falsch!");
}
$smarty->assign('passwort_pwd_alt', $_SESSION["passwort_pwd_alt"]);
$smarty->assign('passwort_pwd_neu', $_SESSION["passwort_pwd_neu"]);
$smarty->assign('passwort_pwd_wied', $_SESSION["passwort_pwd_wied"]);
}
if($action == 'step2'){
if(isset($_POST["pwd_alt"])){
$pwd_alt = $_POST["pwd_alt"];
$_SESSION["passwort_pwd_alt"] = $pwd_alt;
}
if(isset($_POST["pwd_neu"])){
$pwd_neu = $_POST["pwd_neu"];
$_SESSION["passwort_pwd_neu"] = $pwd_neu;
}
if(isset($_POST["pwd_wied"])){
$pwd_wied = $_POST["pwd_wied"];
$_SESSION["passwort_pwd_wied"] = $pwd_wied;
}
if($_SESSION["passwort_pwd_alt"] == '' OR $_SESSION["passwort_pwd_neu"] == '' OR $_SESSION["passwort_pwd_wied"] == ''){
$fehler = 1;
echo "";
}
if($_SESSION["passwort_pwd_neu"] != $_SESSION["passwort_pwd_wied"]){
$fehler = 1;
echo "";
}
$db = dbconnect();
$query1 = $db->query("SELECT count(*) Anz
FROM imt_user
WHERE imtuid='$uid'
AND passwort = md5('$pwd_alt')
") or die(mysql_error()); // Change users to the database where you keep your usernames, and likewise with username
$row1 = $query1->fetch_array();
if($row1[Anz] != 1){
$fehler = 1;
echo "";
}
if(!isset($fehler)){
$pw_neu_md5 = md5($pwd_neu);
$sql_update = $db->query("UPDATE imt_user
SET passwort='$pw_neu_md5'
WHERE imtuid='$uid'");
if($sql_update){
$smarty->assign('passwort_success', "1");
}else{
echo "Passwort nicht geändert. Systemfehler
";
}
}
}
$smarty->assign('action', "$action");
$smarty->display("$template/$templatename");
?>