2018-06-11 18:15:21 +02:00
|
|
|
<?php
|
|
|
|
//<!--Register-->
|
|
|
|
require('../dbConnect.php');
|
|
|
|
|
|
|
|
$name = ($_POST['registerName']);
|
|
|
|
$pswd = ($_POST['registerPassword']);
|
|
|
|
$email = ($_POST['registerMail']);
|
|
|
|
|
2018-06-13 19:46:32 +02:00
|
|
|
$search_user = $database->prepare("SELECT ID FROM user WHERE user='$name '");
|
|
|
|
$search_user->execute();
|
|
|
|
$search_result = $search_user->get_result();
|
|
|
|
|
|
|
|
if ($search_result->num_rows == 0) {
|
|
|
|
$pswd = md5($pswd);
|
2018-06-11 18:15:21 +02:00
|
|
|
$stmt = $database->prepare("INSERT INTO user(user, email, password) VALUES (?,?,?)");
|
|
|
|
$stmt->bind_param("sss", $name, $email, $pswd);
|
|
|
|
$stmt->execute();
|
|
|
|
$stmt->close();
|
2018-06-13 19:46:32 +02:00
|
|
|
echo json_encode("Dein Account wurde erfolgreich erstellt!");
|
|
|
|
} else {
|
|
|
|
echo json_encode("Der Benutzername ist leider schon vergeben!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-11 18:15:21 +02:00
|
|
|
|
|
|
|
?>
|