-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
54 lines (35 loc) · 970 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php define('BASEPATH', dirname(__FILE__));
header('Content-Type: text/plain; charset=UTF-8');
error_reporting(0);
require_once 'consulta.class.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET'):
if(isset($_GET['count'])):
$count = $_GET['count'];
else:
$count = 3;
endif;
if(isset($_GET['orderby'])):
$orderby = $_GET['orderby'];
else:
$orderby = 'id';
endif;
if(isset($_GET['direct'])):
$direct = strtoupper($_GET['direct']);
else:
$direct = 'DESC';
endif;
unset($_GET['limit']);
unset($_GET['orderby']);
unset($_GET['direct']);
if ($_GET):
$consulta = new Consulta;
$consulta->select('usuarios' , $_GET, $count, $orderby, $direct);
endif;
if(empty($_GET)):
$consulta = new Consulta;
$consulta->select('usuarios' , null, $count, $orderby, $direct);
endif;
endif;
if ($_SERVER['REQUEST_METHOD'] == 'POST'):
exit('Não é permitido o método POST em nossos servidores');
endif;