-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdata-action.php
79 lines (48 loc) · 1.26 KB
/
data-action.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @package
*
* @copyright Copyright (C) 2019, All rights reserved.
* @license MIT License version or later; see licensing/LICENSE.txt
*/
session_start(); // Starting Session
require_once("class.user.php");
$auth_user = new USER();
if (isset($_POST['operation'])) {
$message = array();
if ($_POST['operation'] === "submit_login") {
$login_user = strip_tags($_POST['login_user']);
$login_password = strip_tags($_POST['login_password']);
if($auth_user->doLogin($login_user,$login_password))
{
$message["success"] = "Successfully Login";
}
else
{
$message["error"] = "Error Login" ;
}
}
if ($_POST['operation'] === "submit_register") {
$reg_studentnum = strip_tags($_POST['reg_studentnum']);
$reg_password = strip_tags($_POST['reg_password']);
$reg_cpassword = strip_tags($_POST['reg_cpassword']);
$reg_email = strip_tags($_POST['reg_email']);
if($reg_password === $reg_cpassword)
{
if($auth_user->register($reg_studentnum,$reg_password,$reg_email))
{
$message["success"] = "Successfully Register";
}
else
{
$message["error"] = "Error Register" ;
}
}
else
{
$message["error"] = "Password Not Match" ;
}
}
echo json_encode($message,true);
}
?>