<?php
include("../config.php");
include_once("$cs_base_path/include/aloe/aloe_config.php");
$form_data = $_POST;
if (isset($_COOKIE['clearsite']['user_ID'])) {
$user_ID = $_COOKIE['clearsite']['user_ID'];
mysql_connect("$DBhost:$DBport",$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$user_level_query = "SELECT userlevel FROM user_data WHERE user_ID=\"$user_ID\"";
$user_level_result = mysql_query($user_level_query);
$user_level_row = mysql_fetch_assoc($user_level_result);
$user_level = $user_level_row['userlevel'];
mysql_close();
if ($user_level == 2) {
if (!empty($form_data['act'])) {
$mysqlerror = "";
mysql_connect("$DBhost:$DBport",$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
foreach ($form_data as $key => $value) {
if ($key != "act" and $key != "Update") {
$options_update_query = "UPDATE config SET value=\"$value\" WHERE name=\"$key\"";
$options_update_result = mysql_query($options_update_query);
$mysqlerror .= mysql_error();
};
};
mysql_close();
include("../config.php");
};
print "
<fieldset class=\"site_admin\">
";
if (!empty($form_data['act'])) {
print "<label><font class=\"admin_error\">Options Updated</font></label><br />";
};
print "
<form action=\"$ClearsiteBaseURL/include/admin/options.php\" method=\"POST\" onsubmit=\"docClickLoader.submitInto(this, 'targetArea', event)\">
<input type=\"hidden\" name=\"act\" value=\"update\">
<label for=\"hc_page_title\">Page Title</label><input id=\"hc_page_title\" type=\"text\" name=\"hc_page_title\" value=\"$hc_page_title\" size=\"30\"><br />
<label for=\"rrd_data_path\">RRD Directory</label><input id=\"rrd_data_path\" type=\"text\" name=\"rrd_data_path\" value=\"$rrd_data_path\" size=\"24\"><br />
<label for=\"use_ldap\">Use LDAP or Windows AD for authentication</label><input type=\"checkbox\" name=\"use_ldap\" value=\"yes\""; if ($use_ldap == "yes") { print " checked"; }; print " /><br />
<label for=\"ldap_server\">LDAP Server or Windows AD Server</label><input id=\"ldap_server\" type=\"text\" name=\"ldap_server\" value=\"$ldap_server\" size=\"30\"><br />
<label for=\"use_fping\">Use fping (required for Windows) instead of ping</label><input type=\"checkbox\" name=\"use_fping\" value=\"yes\""; if ($use_fping == "yes") { print " checked"; }; print " /><br />
<label for=\"fping_path\">fping Path</label><input type=\"text\" name=\"fping_path\" id=\"fping_path\" value=\"$fping_path\" size=\"24\" /><br />
<p><input type=\"image\" name=\"Update\" value=\"Update\" src=\"$ClearsiteBaseURL/images/update.png\"></p>
</form>
</fieldset>
";
} else {
print "<font class=\"admin_error\">You don't have permission to access this page.</font><p>";
};
} else {
print "<font class=\"admin_error\">Please Log In</font><p>";
};
?>