-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
30 lines (23 loc) · 851 Bytes
/
index.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
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token , Authorization');
function __autoLoad($class) {
require("{$class}.class.php");
}
$_POST = json_decode(file_get_contents('php://input'), true);
$info = isset($_GET['info']) ? $_GET['info'] : 'login';
$user = isset($_POST['user']) ? $_POST['user'] : '';
$pass = isset($_POST['pass']) ? $_POST['pass'] : '';
$sapiens = new Sapiens();
$logar = $sapiens->login($user, $pass);
if(@!$logar['logado'] || $info == 'login') {
echo json_encode($logar);
exit;
}
if($info == 'notas') echo $sapiens->notas();
if($info == 'horarios') echo $sapiens->horarios();
?>