forked from pipiscrew/fullcalendar-php-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_user.php
43 lines (33 loc) · 979 Bytes
/
add_user.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
@session_start();
if (!isset($_SESSION["id"])) {
echo json_encode(1);
exit;
}
else {
date_default_timezone_set("UTC");
if ($_SESSION["login_expiration"] != date("Y-m-d"))
{
session_destroy();
echo json_encode(2);
exit;
}
}
if (!isset($_POST["event-title"])) {
echo json_encode(3);
exit;
}
include 'config.php';
$db = connect();
$sql = "INSERT INTO users (user_mail, user_password, user_level) VALUES (:user_mail, :user_password, :user_level)";
$stmt = $db->prepare($sql);
$stmt->bindValue(':user_mail' , $_POST['event-title']);
$stmt->bindValue(':user_password' , "_X#gza3pzab+xgRw");
$stmt->bindValue(':user_level' , 0);
$stmt->execute();
$res = $stmt->rowCount();
if($res == 1)
echo json_encode(100);
else
echo json_encode(0);
?>