-
Notifications
You must be signed in to change notification settings - Fork 3
/
db.inc.php
71 lines (63 loc) · 1.63 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
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
<?
// new version for connect.inc.php
// but is still in development :(
// and not finished :(
/*
require_once('cfg/_cfg.php');
require_once('cfg/_tables.php');
///////////////////////////////////////////////////////////////////////////////
function error_db($err=12)
{
global $g_baseadr;
if(_LOG_DB_ERRORS)
{
$str = 'err:'.$err."\t".mysql_error()."\r\n";
LogToFile(_LOG_DB_ERROR_FILE,$str);
}
if (!headers_sent($filename, $linenum)) // only in php > 4.3.0
{
header('location: '.$g_baseadr.'error.php?code='.$err);
}
else
{
// test -->
echo 'Headers already sent in '.$filename.' on line '.$linenum."\n".
'Cannot redirect, for now please click this <a ' .
'href="http://www.example.com">link</a> instead'."\n";
}
// pokud dojde k volani fce v prubehu zobrazovani php scriptu tak se jiz presmerovani neprovede.
// headers_sent ?
exit;
}
///////////////////////////////////////////////////////////////////////////////
function connect_db()
{
global $g_db;
@$spojeni=mysql_connect($g_db['server'],$g_db['user'],$g_db['pass'])
or error_db(11);
if ($spojeni)
{
mysql_select_db($g_db['name']);
}
}
///////////////////////////////////////////////////////////////////////////////
function close_db()
{
mysql_close();
}
///////////////////////////////////////////////////////////////////////////////
function correct_sql_string($str)
{
return mysql_real_escape_string($str);
}
///////////////////////////////////////////////////////////////////////////////
$db_query_cnt = 0;
function query_db($sql_query)
{
global $db_query_cnt;
$db_query_cnt++;
$result=mysqli_query($sql_query)
or error_db();
return $result;
}*/
?>