Upload zu git.itlabs.at
This commit is contained in:
27
api/registration.php
Normal file
27
api/registration.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once("db_config.php");
|
||||
$postdata = file_get_contents("php://input");
|
||||
$request = json_decode($postdata);
|
||||
if(isset($postdata) && !empty($postdata))
|
||||
{
|
||||
$name = mysqli_real_escape_string($mysqli, trim($request->name));
|
||||
$pwd = mysqli_real_escape_string($mysqli, (int)$request->pwd);
|
||||
$email = mysqli_real_escape_string($mysqli, trim($request->email));
|
||||
$datum = now();
|
||||
$sql = "INSERT INTO user(login, name, password,email,created) VALUES ('{$login}',' {$name}','". password($pwd) . "','{$email}','{$datum}')";
|
||||
echo $sql;
|
||||
if ($mysqli->query($sql) === TRUE) {
|
||||
|
||||
|
||||
$authdata = [
|
||||
'name' => $name,
|
||||
'pwd' => '',
|
||||
'email' => $email,
|
||||
'login' => $login,
|
||||
'Id' => mysqli_insert_id($mysqli)
|
||||
];
|
||||
echo json_encode($authdata);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user