-
Notifications
You must be signed in to change notification settings - Fork 3
/
admin.php
233 lines (187 loc) · 7.06 KB
/
admin.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<?php
/**************************************************************************\
* PHPAdvocat *
* http://phpadvocat.sourceforge.net *
* By Burkhard Obergoeker <[email protected]> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
require("./include/phpadvocat.inc.php");
require("./include/dialog.php");
/* Get User Account from Session Vars */
$user = $_SESSION["dbuser"];
$passwd = $_SESSION["dbpasswd"];
$changecheck="";
/* initialize database */
$db = new www_db;
$db->connect($user, $passwd);
/********** handle updates *** begin ********************************/
if($_POST["admineditbutton"]) {
$title=$_POST["title"];
$name=$_POST["name"];
$prename=$_POST["prename"];
$organization=$_POST["organization"];
$number=$_POST["number"];
$street=$_POST["street"];
$zip=$_POST["zip"];
$city=$_POST["city"];
$phone=$_POST["phone"];
$fax=$_POST["fax"];
$email=$_POST["email"];
$bank=$_POST["bank"];
$bank_id=$_POST["bank_id"];
$account=$_POST["account"];
$vat_id=$_POST["vat_id"];
$vat_percent=toisonum($_POST["vat_percent"],$LOCALE);
$filebase=$_POST["filebase"];
$language=$_POST["language"];
/* this could be used for multiple clients */
$number=1;
$querystring = sprintf("update phpa_config set " .
"title='%s', ".
"name='%s', ".
"prename='%s', ".
"organization='%s', ".
"street='%s', ".
"zip='%s', ".
"city='%s', ".
"phone='%s', ".
"fax='%s', ".
"email='%s', ".
"bank='%s', ".
"bank_id='%s', ".
"account='%s', ".
"vat_id='%s', ".
"vat_percent=%s, ".
"filebase='%s', ".
"language='%s' ".
"where number=%s",
$title,
$name,
$prename,
$organization,
$street,
$zip,
$city,
$phone,
$fax,
$email,
$bank,
$bank_id,
$account,
$vat_id,
nullcorr($vat_percent),
$filebase,
$language,
$number);
//echo "<hr>".$querystring ."<hr>";
if (!$db->query($querystring)) {
$changecheck="Eintrag geändert";
}
}
/********** handle updates *** end *********************************/
echo "<HTML><HEAD><TITLE>PHPAdvocat - Administration</TITLE>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-15\">\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"include/phpadvocat.css\">";
echo "</HEAD>";
echo "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n";
/* Begin framework: table with two colunms, */
/* menu on left with suze 200, rest on right */
echo "<TABLE width=100%><TR><TD width=200 valign=top>\n";
$phpa_menue->account=$_SESSION["dbuser"];
$phpa_menue->selected = 5;
$phpa_menue->draw_menue();
echo "</TD><TD>\n"; /* end menue, start dialog */
/* display title */
echo "<CENTER><H1>Administration</H1></CENTER>\n";
/* display headline */
echo "<table width=100%><tr>\n";
echo "<td>" . date("d.m.Y", time()) . "</td>";
echo "<TD ALIGN=RIGHT>". $changecheck ."</TD>";
echo "</tr></table>\n";
print "<hr><center>";
echo "<table width=100% border=0>";
echo "<tr><td valign=top><center>";
$querystring =
sprintf("select * from phpa_config");
$db->query($querystring);
$db->next_record();
/* database connection for drop down list */
$dblist = new www_db;
$dblist->connect($user, $passwd);
/* beginning frame of dialog */
$admindialog = new htmldialog;
/* only show client-nr, hidden detail nr */
$admindialog->addinput("Nummer:",
sprintf("<input name=number type=hidden value=\"%s\">%s".
"<input name=detail type=hidden value=\"%s\">",
$db->record["number"], $db->record["number"],$detail));
/* display title */
$admindialog->addinput("Anrede/Titel:",
sprintf("<input name=title type=text size=10 value=\"%s\">\n",
$db->record["title"]));
/* display processregister */
$admindialog->addinput("Name, Vorname:",
sprintf("<input name=name type=text size=30 value=\"%s\">\n".
"<input name=prename type=text size=30 value=\"%s\">\n",
$db->record["name"],$db->record["prename"]));
/* display organization */
$admindialog->addinput("Organisation:",
sprintf("<input name=organization type=text size=50 value=\"%s\">\n",
$db->record["organization"]));
/* display street */
$admindialog->addinput("Straße/Nr.:",
sprintf("<input name=street type=text size=50 value=\"%s\">\n",
$db->record["street"]));
/* display zip/city */
$admindialog->addinput("PLZ/Stadt:",
sprintf("<input name=zip type=text size=6 value=\"%s\">\n".
"<input name=city type=text size=30 value=\"%s\">\n",
$db->record["zip"],$db->record["city"]));
/* display phone/fax */
$admindialog->addinput("Telefon/Fax:",
sprintf("<input name=phone type=text size=20 value=\"%s\">\n".
"<input name=fax type=text size=20 value=\"%s\">\n",
$db->record["phone"],$db->record["fax"]));
/* display email */
$admindialog->addinput("Email:",
sprintf("<input name=email type=text size=30 value=\"%s\">\n",
$db->record["email"]));
/* display Bank */
$admindialog->addinput("Bank:",
sprintf("<input name=bank type=text size=80 value=\"%s\">\n",
$db->record["bank"]));
/* display Bank-ID */
$admindialog->addinput("BLZ:",
sprintf("<input name=bank_id type=text size=15 value=\"%s\">\n",
$db->record["bank_id"]));
/* display account */
$admindialog->addinput("Konto:",
sprintf("<input name=account type=text size=20 value=\"%s\">\n",
$db->record["account"]));
/* display VAT-ID */
$admindialog->addinput("Umsatzsteuer-Nr.:",
sprintf("<input name=vat_id type=text size=40 value=\"%s\">\n",
$db->record["vat_id"]));
/* display VAT-ID */
$admindialog->addinput("Mehrwertsteuer-Satz:",
sprintf("<input name=vat_percent type=text size=10 value=\"%s\">%%\n",
tolocalnum($db->record["vat_percent"], $LOCALE)));
/* display directory for files */
$admindialog->addinput("Verzeichnis für Dateien:",
sprintf("<input name=filebase type=text size=60 value=\"%s\">\n",
$db->record["filebase"]));
/* display language no longer needed */
$admindialog->addinput("Sprache:",
sprintf("<input name=language type=text size=10 disabled value=\"%s\">\n", $LOCALE));
// sprintf("<input name=language type=hidden value=\"%s\">\n",
// $db->record["language"]));
/* button for saving data */
$admindialog->addinput("<input name=admineditbutton type=submit value=Sichern>","");
$admindialog->out(); /* End of display framework */
echo "</TD></TR></TABLE>\n"; /* end of table framework */
echo "</BODY></HTML>\n"; /* end of page */
?>