add files

This commit is contained in:
tbS
2025-08-02 13:10:21 +02:00
commit aa4fa9ae0f
702 changed files with 103724 additions and 0 deletions

66
db/passwort_aenderung.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
include_once '../config/config.php';
$errors = [];
$data = [];
if($_SERVER["REQUEST_METHOD"] == "POST") {
// username and password sent from form
if (isset($_POST['passwort'])) {
$myusername = mysqli_real_escape_string($db,$_POST['benutzer']);
$mypassword = mysqli_real_escape_string($db,$_POST['passwort']);
//$mypassword = md5($mypassword);
$mypassword = hash_hmac('md5', $mypassword, $secretKey);
$sql = "SELECT * FROM admin WHERE username = '$myusername' and passcode = '$mypassword'";
$result = mysqli_query($db,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
//$active = $row['active'];
$count = mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == 1) {
$mypassword = mysqli_real_escape_string($db,$_POST['passwort1']);
//$mypassword = md5($mypassword);
$mypassword = hash_hmac('md5', $mypassword, $secretKey);
$sql = "UPDATE admin SET passcode='$mypassword' WHERE username = '$myusername'";
$db->query($sql);
if (mysqli_error($db)){
$errors['passwort'] = "Passwort konnte nicht geändert werden!";
}else {
$data['success'] = true;
}
}else {
$errors['passwort'] = "Aktuelles Passwort falsch!";
$data['errors'] = $errors;
}
}
if (!empty($errors)) {
$data['success'] = false;
$data['errors'] = $errors;
}
echo json_encode($data);
}