C:\xampp\htdocs\kptv\admin\php\inc\passwords.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
<?php
include_once("datapasswords.php");

class 
Passwords extends DataPasswords {

    function 
LoadPasswordByUserName($connection) {
         if(
$connection == NULL)
            return 
15;
        
$query "SELECT * from passwords where UserName = '" $this->userName "' LIMIT 1;";
        if(
$connection->query($query)) {
            if(
$connection->result->rows 0) {
                
$this->id $connection->result->getValueByIndex(00);
                
$this->userName $connection->result->getValueByIndex(01);
                
$this->password $connection->result->getValueByIndex(02);
                return 
1;
            }
            else
                return 
0;
        }
        return 
16;
    }

    function 
AddPassword($connection) {
         if(
$connection == NULL)
            return 
15;
          
$query "INSERT INTO passwords VALUES(0, '" $this->userName "','" $this->password "');";
           if(
$connection->query($query)) {
               return 
1;
           }
           return 
0;
    }

    function 
UpdatePassword($connection) {
        if(
$connection == NULL)
            return 
15;

        
$query "UPDATE passwords set `Password` = '" $this->password "' where id = " $this->id " LIMIT 1;";
        if(
$connection->query($query)) {
            return 
1;
        }
        return 
16;
    }
}

?>
x

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