-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_config.php
89 lines (75 loc) · 2.83 KB
/
edit_config.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
<?php
# ------------------------------------------------
# License and copyright:
# See license.txt for license information.
# ------------------------------------------------
include_once('config.php');
$Is_Auth = User_Auth();
if (empty($config['admin_pass'])) {
$auto_auth = TRUE;
$Is_Auth = TRUE;
}
if (($Is_Auth) || ($auto_auth)) {
# Get the absolute directory info
$abs_directory_array = explode('/',$_SERVER['SCRIPT_FILENAME']);
if (sizeof($abs_directory_array) <= 2) {
$abs_directory = "/";
}
else {
$abs_directory = "";
for ($i=1; $i < (sizeof($abs_directory_array)-1); $i++) {
$abs_directory = $abs_directory . "/" . $abs_directory_array[$i];
}
$max_i = sizeof($abs_directory_array) - 1;
$abs_file = $abs_directory_array[$max_i];
}
# Top template
include('templates/open.page.php');
# Save data?
print "<br>\n";
if ($_REQUEST['action'] == "save") {
# Clean the data
$config_fields = get_db_fields('InfResp_config');
foreach ($_REQUEST as $name => $value) {
$name = strtolower($name);
if ($config_fields['hash'][$name] == TRUE) {
$form[$name] = MakeSafe($value);
}
}
if (!(is_numeric($form['add_sub_size']))) { $form['add_sub_size'] = 5; }
if (!(is_numeric($form['subs_per_page']))) { $form['subs_per_page'] = 25; }
if (!(is_numeric($form['last_activity_trim']))) { $form['last_activity_trim'] = 6; }
if ($form['last_activity_trim'] > 120) { $form['last_activity_trim'] = 0; }
# Save the data
DB_Update_Array('InfResp_config', $form);
# Grab the new data
$query = "SELECT * FROM InfResp_config";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
$config = mysql_fetch_assoc($result);
# Prep the data
$max_send_count = $config['max_send_count'];
$last_activity_trim = $config['last_activity_trim'];
$charset = $config['charset'];
# Fix the session
$_SESSION['l'] = md5(WebEncrypt($config['admin_user'], $config['random_str_1']));
$_SESSION['p'] = md5(WebEncrypt($config['admin_pass'], $config['random_str_2']));
# Done!
print "<center><H2>Changes Saved!</H2></center>\n";
}
# If our password is empty print an warning message!
if (empty($config['admin_pass'])) {
print "<center><H2>Warning: Your admin password is not set!</H2></center>\n";
}
# Display config template
include('templates/edit.config.php');
# Display back to admin button
include('templates/back_button.config.php');
# Display the bottom template
copyright();
include('templates/close.page.php');
}
else {
admin_redirect();
}
DB_disconnect();
?>