C:\xampp\htdocs\kptv2\admin\php\inc\db\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
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
<?php
class Db {
    var 
$connection# stores resource identifier for current connection
    
var $currentDate#stores the system date and time at the moment of instanciation
    
var $currentTime;
    var 
$currentDb;
    var 
$adminEAdress#stores the email adress where debug errors are sent
    
var $serverAdress#stores the adress on witch the server is running

    
function Db()
    {
        global 
$HTTP_SERVER_VARS;
        
$this->connection NULL;
        
$this->currentDate date("Y-m-d");
        
$this->currentTime date("H:i:s");
        return 
true;
    }

    function 
setAdminEAdress($email="")
    {
        global 
$admin_email;
        
$email =="" $this->adminEAdress $admin_email $this->adminEAdress $email;
        return 
true;
    }

    function 
err_dbConnection()
    {
        
$content $this->currentDate "at" $this->currentTime " database connection error ";
        echo(
$content);
        return 
25;
    }

    
// called on a die operation on a select
    
function _dbSelectError()
    {
        
$content $this->currentDate "at" $this->currentTime " database select error ";
        return 
false;
    }

    
// called on die operations on SQL queries
    
function _dbSQLError($sql$error)
    {
        
$content =  $this->currentDate "at" $this->currentTime " sql error occured ";
        
$content .= "Database reply" trim($error) . "\n";
        
$content .= "SQL query : " $sql "<br>";
        echo(
$content);
        return 
false;
    }

    function 
_sendMail($content$to ""$subject ""$headers ""$cc ""$bcc =""$html false)
    {
        global 
$HTTP_SERVER_VARS;

        if(
$headers == "")
        {
            
$headers "From Automated Script Debugger System at " $this->serverName "\"\nReply-To: ";
            
$headers .= "\"Automated Script Debugger System at " $this->serverName "\"\nX-Mailer: \"";
        }
        if(
$subject == "")
            
$subject "Script Error";
        if(
$html)
            
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
        if (
$cc != "")
            
$headers .= $cc;
        if (
$bcc != "")
            
$headers .= $bcc;

        
$to == "" $to $this->adminEmail TRUE;
        
$HTTP_SERVER_VARS["SERVER_ADDR"] == "127.0.0.1" $send FALSE $send TRUE;
        if (
$send)
            @
mail($to$subject$body$headers);
        else
            echo 
nl2br($body) . "<br>";
    }
}
?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586