-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
420 lines (386 loc) · 16.5 KB
/
settings.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<?php
session_start();
if (!isset($_SESSION["username"])) {
header("location:admin_login.php");
exit;
}
include "include/connect.php";
include "user.php";
include "include/gensettings.php";
$op = 0;
$selected3 = "";
$selected7 = "";
$selected99 = "";
$selected9 = "";
$selected10 = "";
$selected11 = "";
$selected15 = "";
//authorized
if ($uri == "admin") {
if (isset($_POST['op'])) {
$css = $_POST['template'];
$hour_allow = $_POST['hour_allow'];
$rate = $_POST['rate'];
$sat = isset($_POST['sat']) ? 'on' : '';
$sun = isset($_POST['sun']) ? 'on' : '';
$auto_id = $_POST['auto_id'];
$auto_deadline = $_POST['auto1'];
$header_title = $_POST['header_title'];
$overdue_price = $_POST['overdue_price'];
$search_output = $_POST['search_output'];
$location2 = isset($_POST['location2']) ? $_POST['location2'] : '';
$author_card = $_POST['author_card'];
$title_card = $_POST['title_card'];
$rec_per_page = $_POST['rec_per_page'];
$default_school = $_POST['school_code'];
$book_preview = $_POST['bp'];
$sql = "UPDATE settings set css='$css',hour_allow='$hour_allow',auto_id='$auto_id',";
$sql .= "header_title='$header_title',auto_deadline='$auto_deadline',rate='$rate',sat='$sat',";
$sql .= "sun='$sun',location2='$location2',author_card='$author_card',title_card='$title_card',";
$sql .= "overdue_price='$overdue_price',search_output='$search_output',rec_per_page='$rec_per_page',";
$sql .= "default_school='$default_school',book_preview='$book_preview'";
mysql_query($sql) or die("cant execute query" . mysql_error());
$alert = '<strong><font color=red>The settings changed!</font></strong>';
//script for file upload logo
include "class.php";
$send_now = new multiple_upload; //create instance
//set some values This is the whole path to! the upload dir
$send_now->uploaddir = "images/"; //set server upload dir
$send_now->max_files = 10; //set max files to upload
$send_now->max_size = 25000000; //set max file-size
$send_now->permission = 0777; //set wanted permission
$send_now->notallowed = array("exe" . "mp3"); //exclude some file-types
$send_now->show = true; //show errors
$send_now->files = &$_FILES; //get $_FILES global values
//todo: know what are these for
//$send_now->cid = $cid; //set the category id
//$send_now->domid = $domid; //set the domain id
//$send_now->sequel = $sequel;
//$send_now->bilang = $bilang;
//validate on size and allowed files
$ok = $send_now->validate();
if ($ok) {
$ok = $send_now->execute();
}
if (!$ok && $send_now->show) {
//echo perhaps some errors
$i_errors = count($send_now->errors);
echo "Error report, sending files to server <br />";
for ($i = 0; $i < $i_errors; $i++) {
echo $send_now->errors[0][$i] . " <br />";
echo $send_now->errors[1][$i] . " <br />";
}
} else {
}
}
//for getting default school
$sql2 = "SELECT * FROM settings";
$nyoy = mysql_query($sql2, $connect) or die("cant execute query for default school");
$row = mysql_fetch_array($nyoy);
$dschool_code = $row['default_school'];
//$book_preview=$row['book_preview'];
//css
if ($css == "style.css") {
$selected1 = 'selected="selected"';
}
if ($css == "style1.css") {
$selected2 = 'selected="selected"';
}
if ($css == "style2.css") {
$selected5 = 'selected="selected"';
}
//auto id
if ($auto_id == 1) {
$selected3 = 'checked="checked"';
}
if ($auto_id == 0) {
$selected4 = 'checked="checked"';
}
//auto deadline
if ($auto_deadline == 1) {
$selected6 = 'checked="checked"';
}
if ($auto_deadline == 0) {
$selected7 = 'checked="checked"';
}
//Fine Rate
if ($rate == 1) {
$selected8 = 'checked="checked"';
}
if ($rate == 0) {
$selected9 = 'checked="checked"';
}
//araw inclusion
if ($sat == "on") {
$selected10 = 'checked="checked"';
}
if ($sun == "on") {
$selected11 = 'checked="checked"';
}
//search output style
if ($search_output == 1) {
$selected12 = 'selected="selected"';
}
if ($search_output == 2) {
$selected13 = 'selected="selected"';
}
//book preview
if ($book_preview == "on") {
$selected98 = 'checked="checked"';
}
if ($book_preview == "off") {
$selected99 = 'checked="checked"';
}
//echo $auto_deadline;
//detail location
if ($location2 == "on") {
$selected15 = 'checked="checked"';
}
if ($author_card == "on") {
$selected16 = 'checked="checked"';
}
if ($title_card == "on") {
$selected17 = 'checked="checked"';
}
} else {
$msg_mo = "You are not allowed to access this page!";
$op = 2;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
<?php echo $header_title; ?>
</title>
<link rel="stylesheet" type="text/css" href="css/<?php echo $css; ?>" />
</head>
<body>
<div class="header">
<div class="logo">
<div id="Layer1"><img src="images/<?php echo $logo; ?>" /></div>
<?php echo " " . $header_title; ?>
</div>
</div>
<div class="navbg">
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="home.php" id="current" title="Home">Home</a></li>
<li><a href="admin.php" title="Search">Search</a></li>
<li><a href="admin_add_new.php" title="Add book">Add book</a></li>
<li><a href="barrower.php" title="Borrower">Borrower</a></li>
<li><a href="inventory.php" title="Inventory">Inventory</a></li>
<li><a href="settings.php" title="Settings">Settings</a></li>
<li><a href="help1.php" title="Help">Help</a></li>
<li><a href="logout.php" title="Logout">Logout</a></li>
</ul>
</div>
</div>
<div class="maincontent">
<div class="floatelft">
<h2>Settings
<?php if ($uri == "admin") {
echo '<a href="create_account.php">Accounts</a>';
} else {
echo "Accounts";
}
?>|
<?php if ($uri == "admin") {
echo '<a href="groups.php">User Groups</a>';
} else {
echo "User";
}
?>|
<?php if ($uri == "admin") {
echo '<a href="school.php">Participating School(s) </a>';
} else {
echo "Participating School(s)";
}
?>|
<?php if ($uri == "admin") {
echo '<a href="material_type.php">Material Type</a>';
} else {
echo "Material Type";
}
?>
</h2>
<?php if ($op == 0) {?>
<form action="settings.php" method="post" name="supportform" enctype="multipart/form-data">
<table width="100%" border="0">
<tr>
<td width="20%"> </td>
<td width="2%" align="right"> </td>
<td> </td>
<td colspan="2">
<?php echo $alert; ?>
</td>
</tr>
<tr>
<td width="20%" align="right">Name/Header:</td>
<td width="2%"> </td>
<td colspan="2"><input name="header_title" type="text" id="header_title" value="<?php echo $header_title; ?>"
size="40" class="dilaw" /></td>
</tr>
<tr>
<td align="right">Logo:</td>
<td> </td>
<td width="58%" valign="middle"><img name="" src="images/<?php echo $logo; ?>" width="40"
height="40" alt="" />
<input type="file" name="file[]" id="file[]" class="dilaw" /></td>
<td width="20%"> </td>
</tr>
<tr>
<td align="right">Template:</td>
<td> </td>
<td><select name="template" id="template">
<option value="style.css" <?php echo $selected1; ?>>Default Green</option>
<option value="style1.css" <?php echo $selected2; ?>>Blue</option>
<option value="style2.css" <?php echo $selected5; ?>>Ubuntu</option>
</select></td>
<td></td>
</tr>
<tr>
<td align="right">Hours allowed for borrowed books:</td>
<td> </td>
<td><input name="hour_allow" type="text" id="hour_allow" value="<?php echo $hour_allow; ?>"
size="5" class="dilaw" /></td>
<td> </td>
</tr>
<tr>
<td align="right">Auto setting of borrowers ID</td>
<td> </td>
<td>
<input type="radio" name="auto_id" value="1" <?php echo $selected3; ?>/>
ON
<input type="radio" name="auto_id" value="0" <?php echo $selected4; ?>/>
OFF</td>
<td> </td>
</tr>
<tr>
<td align="right">Auto deadline for books borrowed</td>
<td> </td>
<td colspan="2"><input type="radio" name="auto1" value="1" <?php echo $selected6; ?>/>
ON
<input type="radio" name="auto1" value="0" <?php echo $selected7; ?>/>
OFF </td>
</tr>
<tr>
<td align="right">Book Preview</td>
<td> </td>
<td colspan="2"><input type="radio" name="bp" value="on" <?php echo $selected98; ?>/>
ON
<input type="radio" name="bp" value="off" <?php echo $selected99; ?>/>
OFF </td>
</tr>
<tr>
<td align="right">Default School for Search</td>
<td> </td>
<td colspan="2">
<select name="school_code" id="school_code">
<?php
$sql = "SELECT * from school order by school_code";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$code = $row['school_code'];
if ($dschool_code == $code) {
echo '<option selected="selected" value="' . $row['school_code'] . '">' . $row['school_name'] . '</option>';
} else {
echo '<option value="' . $row['school_code'] . '">' . $row['school_name'] . '</option>';
}
}
?>
</select></td>
</tr>
<tr>
<td align="right">Fines Rate </td>
<td> </td>
<td colspan="2"><input type="radio" name="rate" value="1" <?php echo $selected8; ?>/>Per Day
<input type="radio" name="rate" value="0" <?php echo $selected9; ?>/>
Per Hour </td>
</tr>
<tr>
<td align="right">Cost</td>
<td> </td>
<td colspan="2"><input name="overdue_price" type="text" class="dilaw" id="overdue_price" value="<?php echo $overdue_price; ?>"
size="5" /></td>
</tr>
<tr>
<td align="right">Days Inclusion </td>
<td> </td>
<td colspan="2">
<input type="checkbox" name="sat" value="on" <?php echo $selected10; ?>>Including Saturday
<input type="checkbox" name="sun" value="on" <?php echo $selected11; ?>>Including Sunday
</td>
</tr>
<tr>
<td align="right">Search output style: </td>
<td> </td>
<td><select name="search_output" id="search_output">
<option value="1" <?php echo $selected12; ?>>Complete</option>
<option value="2" <?php echo $selected13; ?>>List</option>
</select></td>
<td> </td>
<tr>
<td align="right">Location Detail</td>
<td> </td>
<td colspan="2"> <input type="checkbox" name="location2" value="on" <?php echo $selected15; ?>/>
Location </td>
</tr>
<tr>
<td align="right">Card Catalog </td>
<td> </td>
<td colspan="2"> <input type="checkbox" name="author_card" value="on" <?php echo $selected16; ?>>
Author Card
<input type="checkbox" name="title_card" value="on" <?php echo $selected17; ?>/>
Title Card </td>
</tr>
</tr>
<tr>
<td align="right">Record per page:</td>
<td> </td>
<td><input name="rec_per_page" type="text" class="dilaw" id="rec_per_page" value="<?php echo $rec_per_page; ?>"
size="5" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="button" id="button" value="Change all" class="btn" /></td>
<td>
<input name="op" type="hidden" id="op" value="1" /> </td>
</tr>
</table>
</form>
<?php }?>
<p><a href="index.php"></a></p>
<?php if ($op == 2) { ?>
<table width="100%" border="0" cellpadding="5" cellspacing="5">
<tr>
<td align="right"><a href="home.php">back to Home Page</a></td>
<td colspan="2" align="left">
<?php echo $msg_mo; ?>
</td>
<td align="center"> </td>
</tr>
<tr>
<td align="left" bgcolor="#FFFFFF"> </td>
<td align="center" bgcolor="#FFFFFF"> </td>
<td align="center" bgcolor="#FFFFFF"> </td>
<td align="center" bgcolor="#FFFFFF"> </td>
</tr>
</table>
<?php }?>
<hr />
<p> </p>
<p> </p>
</div>
</div>
<div class="lowercontent"></div>
<div class="footer">
<p>
<?php echo $footer; ?>
</p>
</div>
</body>
</html>