-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.inc.php
41 lines (37 loc) · 1.14 KB
/
db.inc.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
<?php
function strip_to_num($str)
{
if(strlen($str)>0)
{
if(is_numeric($str[0])) return $str[0] . strip_to_num(substr($str,1));
else return strip_to_num(substr($str,1));
}
}
function sql_scrub($query)
{
if (!$query || $query=="" || $query===0 || is_null($query)) return "NULL";
// Stripslashes
if (get_magic_quotes_gpc()) $query = stripslashes($query);
// Quote if not integer
if (!is_numeric($query)) $query = "'" . mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $query) . "'";
return $query;
}
function sql_scrub_noquote($query)
{
if (!$query || $query=="" || $query===0 || is_null($query)) return "NULL";
// Stripslashes
if (get_magic_quotes_gpc()) $query = stripslashes($query);
// Quote if not integer
if (!is_numeric($query)) $query = mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $query);
return $query;
}
$db = pg_connect(getenv('DATABASE_URL'));
if (!$db) {
$to = "";
$subject = "Error - DB Connection";
$msg = "DB Connection Failed:\n";
$headers = "From: [email protected]\r\nReply-To: [email protected]\r\nX-Mailer: PHP/".phpversion();
//mail($to,$subject,$msg,$headers);
die;
}
?>