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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
<?php
/*
class Rank
{
public function __toString()
{
return $this->longname;
}
}
class Award
{
public function __toString()
{
return $this->name;
}
}
*/
class AdminCommon extends RUDI_Common
{
public function __construct()
{
parent::__construct();
$this->Update();
}
public function getRanks()
{
$result = $this->db->Query("SELECT * FROM rudi_ranks");
while(($row = $this->db->FetchObject($result,'Rank'))!=false)
{
$ranks[] = $row;
}
return $ranks;
}
public function getAwards()
{
$result = $this->db->Query("SELECT * FROM rudi_awards");
while(($row = $this->db->FetchObject($result,'Award'))!=false)
{
$awards[] = $row;
}
return $awards;
}
}
class AdminAdd
{
protected $db, $link, $id;
public $data;
public function __construct()
{
if(is_null($id))
{
decho("No ID");
return;
}
$this->id = $id;
$this->db = new RUDI_SQL();
$this->link = $this->db->Connect('localhost','hunkeler','proball');
$this->db->Select_db('rudi');
//$result = $this->db->Query("INSERT INTO rudi_unit_members VALUES()");
//$name = $this->db->FetchArray($result);
echo "Current soldier selected: '{$name['last_name']}, {$name['first_name']}'";
}
public function __set($var, $val)
{
//echo "UPDATE rudi_unit_members SET $var = '$val';";
//mysql_query("UPDATE rudi_unit_members SET $var = '$val';");
$this->id = addslashes($this->id);
$this->db->Query("UPDATE rudi_unit_members SET $var = '$val' WHERE member_id = '{$this->id}';");
}
}
class AdminModify
{
protected $db, $link, $id;
public $data;
public function __construct($id)
{
if(is_null($id))
{
decho("No ID");
return;
}
else
{
decho(get_class($this) . "received: $id" );
}
$this->id = $id;
$this->db = new RUDI_SQL();
$this->link = $this->db->Connect('localhost','hunkeler','proball');
$this->db->Select_db('rudi');
$result = $this->db->Query("SELECT last_name, first_name FROM rudi_unit_members WHERE member_id = '$id'");
$name = $this->db->FetchArray($result);
echo "Current soldier selected: '{$name['last_name']}, {$name['first_name']}'";
}
public function __set($var, $val)
{
//echo "UPDATE rudi_unit_members SET $var = '$val';";
//mysql_query("UPDATE rudi_unit_members SET $var = '$val';");
$this->id = addslashes($this->id);
$this->db->Query("UPDATE rudi_unit_members SET $var = '$val' WHERE member_id = '{$this->id}';");
}
}
?>
|