-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathajax.php
executable file
·39 lines (35 loc) · 1.02 KB
/
ajax.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
<?php
use Orange\User;
session_start();
include_once('config.php');
require 'vendor/autoload.php';
if(isset($_GET['process']) && $_GET['process'] !== ''){
if($_GET['process'] !== 'login-process' && !User::login_check()){
//echo $_GET['process'];
$message =json_encode([
'respond' => 'No',
'message' => 'Please refresh <script>location.reload();</script>',
]);
echo json_encode([
'status' => 'sessionexpired',
'message' => $message,
]);
header("Refresh:0");
}else {
if (file_exists(PROCESSES_PATH . $_GET['process'] . '.php')) {
include_once(PROCESSES_PATH . $_GET['process'] . '.php');
} else {
http_response_code(404);
echo json_encode([
'code' => 404,
'error'=> $_GET['process'] . ' not found'
]);
}
}
}else{
http_response_code(400);
echo json_encode([
'code' => 400,
'error' => 'Bad request'
]);
}