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(0, 0); $this->userName = $connection->result->getValueByIndex(0, 1); $this->password = $connection->result->getValueByIndex(0, 2); 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; } }
?>
|