integrated EVERYTHING!

This commit is contained in:
StockiP
2022-05-12 18:48:58 +02:00
parent 8e91e4a8f6
commit f1185ade0c
18 changed files with 424 additions and 27 deletions

47
logic/getUserData.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
include($_SERVER['DOCUMENT_ROOT'] . '/logic/testinput.php');
$data = json_decode(file_get_contents('php://input'));
getData($data->username);
function getData($email)
{
require($_SERVER['DOCUMENT_ROOT'] . '/config/setupDBAccess.php');
$sql = "SELECT `user_id`, `username`, `password`, `email`, `phone`, `salutation`, `firstname`, `lastname`, `address`, `role`, `created_at`, `plz`, `name` FROM `user` JOIN `cities` ON `plz` = `postalcode` WHERE `username` = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param("s", $email);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($user_id, $username, $password, $email, $phone, $salutation, $firstname, $lastname, $address, $role, $created_at, $plz, $name);
if ($stmt->num_rows == 1) {
if ($stmt -> fetch()) {
$data = array(
'user_id' => $user_id,
'username' => $username,
'password' => $password,
'email' => $email,
'phone' => $phone,
'salutation' => $salutation,
'firstname' => $firstname,
'lastname' => $lastname,
'address' => $address,
'plz' => $plz,
'city' => $name,
'role' => $role,
'created_at' => $created_at
);
$data = json_encode($data);
$response = $data;
} else {
$response = "failure";
}
} else {
$response = "failure";
}
$stmt->close();
$db->close();
echo $response;
}