blob: 9f65568cd0cc3f5a8a30f6bec9f642d5b3f16e7f (
plain) (
blame)
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
|
<?php
require("conf/sql.php");
$sql_queries = 0;
$sql_connected = false;
function sql_connect() {
global $sql_server, $sql_user, $sql_password, $sql_database, $sql_connected;
if ($sql_connected == true) return;
if (!@mysql_connect($sql_server, $sql_user, $sql_password)) {
$title = "Cannot connect to SQL server";
$error = "An error has occurred with the SQL server !";
require("tpl/general/empty.php");
}
mysql_select_db($sql_database);
mysql_query("SET NAMES 'utf8'");
$sql_connected = true;
}
function sql($r) {
global $sql_queries, $sql_connected;
if ($sql_connected != true) sql_connect();
$sql_queries++;
if ($a = mysql_query($r)) {
return $a;
} else {
$title = "SQL error.";
$request = $r;
$sql_error = mysql_error();
require("tpl/general/sqlerror.php");
}
}
function esca($v) {
if (get_magic_quotes_gpc()) {
return stripslashes($v);
} else {
return $v;
}
}
function escs($v) {
sql_connect();
return mysql_escape_string($v);
}
function esc($v) {
return escs(esca($v));
}
|