33 lines
898 B
PHP
33 lines
898 B
PHP
|
<?php
|
||
|
require '../config/function.php';
|
||
|
|
||
|
if(isset($_POST['updatepassword']))
|
||
|
{
|
||
|
$password = validate($_POST['password']);
|
||
|
$passwordconfirm = validate($_POST['passwordconfirm']);
|
||
|
$userid = validate($_POST['userid']);
|
||
|
|
||
|
if($password != $passwordconfirm)
|
||
|
{
|
||
|
redirect('profile.php','Kennwörter stimmen nicht überein','danger');
|
||
|
}
|
||
|
elseif($password != '' || $passwordconfirm != '')
|
||
|
{
|
||
|
$query = "UPDATE tbl_students SET password='$password' WHERE id='$userid'";
|
||
|
$result = mysqli_query($conn, $query);
|
||
|
|
||
|
if($result){
|
||
|
logoutSession();
|
||
|
redirect('../index.php','Kennwort erfolgreich geändert','success');
|
||
|
} else{
|
||
|
redirect('profile.php','Es ist ein Fehler aufgetreten','danger');
|
||
|
}
|
||
|
}
|
||
|
else{
|
||
|
redirect('profile.php','Bitte fülle alle Felder aus','danger');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
|