-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.php
36 lines (30 loc) · 900 Bytes
/
db.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
<?php
require_once "settings.php";
class DB
{
public $LINK;
private static $instance = null;
private function __construct()
{
try {
$dns = "sqlite:" . Settings::$DB_PATH;
$this->LINK = new PDO($dns);
return $this->LINK;
} catch (PDOException $e) {
}
}
public static function getInstance()
{
if (self::$instance === null) {
return self::$instance = new self();
} else return self::$instance;
}
public function get_param($uuid)
{
$query = $this->LINK->prepare("SELECT url, token FROM client WHERE waf_id=(SELECT waf_id FROM client WHERE uuid=:uuid)");
$query->bindParam(':uuid', $uuid, PDO::PARAM_STR);
$query->execute();
$result = $query->fetchall(PDO::FETCH_ASSOC);
return $result;
}
}