-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdirectives.php
More file actions
82 lines (71 loc) · 1.89 KB
/
directives.php
File metadata and controls
82 lines (71 loc) · 1.89 KB
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
80
81
82
<?php header("Access-Control-Allow-Origin: *");
include 'model.php';
class db {
public static function clean($string){
global $conn;
return $conn->escape_string($string);
}
public static function looper($sql){
global $conn;
$q = $conn->query($sql);
$n = mysqli_num_rows($q);
$rs=array();
if($n<=0){
return 0;
} else {
while($r = mysqli_fetch_object($q)){
$rs[] = $r;
} return $rs;
}
//foreach ($asd as $v){ }
}
public static function get($col,$sql){
global $conn;
$q = $conn->query($sql);
$n = mysqli_num_rows($q);
if($n<=0){
return 0;
} else {
while($r = mysqli_fetch_array($q)){
return $r[$col];
}
}
}
public static function json($sql){
global $conn;
$q = $conn->query($sql);
$n = mysqli_num_rows($q);
$rs=array();
if($n<=0){
return 0;
} else {
while($r = mysqli_fetch_array($q)){
$rs[] = $r;
} return json_encode($rs);
}
}
public static function counts($sql){
global $conn;
$q = $conn->query($sql);
return $n = mysqli_num_rows($q);
}
public static function udi($sql){
global $conn;
$q = $conn->query($sql);
if($q){
return true;
} else {
return false;
}
}
public static function redirect($url){
global $conn;
return "<script>document.location.href = '$url';</script>";
}
public static function out(){
@$role = $_SESSION['role'];
@$id = $_SESSION['admin_id'];
session_unset();
session_destroy();
}
}