function MoveUsersToShablon() { global $SAMSConf; global $SHABLONConf; global $USERConf; $DB = new SAMSDB(); if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } if (isset($_GET["id"])) { $id = $_GET["id"]; } if (isset($_GET["username"])) { $users = $_GET["username"]; } for ($i = 0; $i < count($users); $i++) { $a = explode("+", $users[$i]); if ($a[1] != $a[2]) { $num_rows = $DB->samsdb_query("UPDATE squiduser SET s_shablon_id='{$id}' WHERE s_user_id='{$a['0']}'"); } else { $num_rows = $DB->samsdb_query("UPDATE squiduser SET s_shablon_id='{$id}',s_quote='{$a['3']}' WHERE s_user_id='{$a['0']}'"); } } print "<SCRIPT>\n"; print " parent.basefrm.location.href=\"main.php?show=exe&filename=shablontray.php&function=shablonusers&id={$id}&sid=ALL\";\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print "</SCRIPT> \n"; }
function AuthEnabled() { global $SAMSConf; global $USERConf; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit(0); } if (isset($_GET["adld"])) { $adld = $_GET["adld"]; } if (isset($_GET["ntlm"])) { $ntlm = $_GET["ntlm"]; } if (isset($_GET["ldap"])) { $ldap = $_GET["ldap"]; } if (isset($_GET["ncsa"])) { $ncsa = $_GET["ncsa"]; } if (isset($_GET["ip"])) { $ip = $_GET["ip"]; } if ($ip == "on") { $ip = 1; } else { $ip = 0; } if ($adld == "on") { $adld = 1; } else { $adld = 0; } if ($ntlm == "on") { $ntlm = 1; } else { $ntlm = 0; } if ($ldap == "on") { $ldap = 1; } else { $ldap = 0; } if ($ncsa == "on") { $ncsa = 1; } else { $ncsa = 0; } $DB = new SAMSDB(); $num_rows = $DB->samsdb_query("UPDATE auth_param SET s_value='{$ip}' WHERE s_auth='ip' AND s_param='enabled' "); $num_rows = $DB->samsdb_query("UPDATE auth_param SET s_value='{$adld}' WHERE s_auth='adld' AND s_param='enabled' "); $num_rows = $DB->samsdb_query("UPDATE auth_param SET s_value='{$ntlm}' WHERE s_auth='ntlm' AND s_param='enabled' "); $num_rows = $DB->samsdb_query("UPDATE auth_param SET s_value='{$ldap}' WHERE s_auth='ldap' AND s_param='enabled' "); $num_rows = $DB->samsdb_query("UPDATE auth_param SET s_value='{$ncsa}' WHERE s_auth='ncsa' AND s_param='enabled' "); print "<SCRIPT>\n"; print " parent.basefrm.location.href=\"tray.php?show=exe&function=authtray&filename=authtray.php\";\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print "</SCRIPT> \n"; }
function AddShablon() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $period = "M"; $clrdate = "1980-01-01"; if (isset($_GET["groupnick"])) { $snick = $_GET["groupnick"]; } if (isset($_GET["defaulttraf"])) { $defaulttraf = $_GET["defaulttraf"]; } if (isset($_GET["auth"])) { $auth = $_GET["auth"]; } if (isset($_GET["period"])) { $period = $_GET["period"]; } if (isset($_GET["newperiod"])) { $newperiod = $_GET["newperiod"]; } if (isset($_GET["clryear"])) { $clryear = $_GET["clryear"]; } if (isset($_GET["clrmonth"])) { $clrmonth = $_GET["clrmonth"]; } if (isset($_GET["clrday"])) { $clrday = $_GET["clrday"]; } if (isset($_GET["trange"])) { $trange = $_GET["trange"]; } if ($period == "A") { $period = $newperiod; $clrdate = "{$clryear}-{$clrmonth}-{$clrday}"; } $QUERY = "INSERT INTO shablon ( s_name, s_quote, s_auth, s_period, s_clrdate, s_alldenied, s_shablon_id2 ) VALUES ( '{$snick}', '{$defaulttraf}', '{$auth}', '{$period}', '{$clrdate}', '0', '-1' ) "; $DB->samsdb_query($QUERY); $DB->samsdb_query_value("SELECT s_shablon_id FROM shablon WHERE s_name='{$snick}' "); $row = $DB->samsdb_fetch_array(); $sid = $row['s_shablon_id']; $DB->free_samsdb_query(); $DB->samsdb_query("INSERT INTO sconfig_time ( s_shablon_id, s_trange_id ) VALUES ( '{$sid}', '{$trange}' ) "); // UpdateLog("$SAMSConf->adminname","$shablonnew_AddShablon_1 $snick","01"); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print " parent.basefrm.location.href =\"tray.php?show=exe&function=shablontray&filename=shablontray.php&id={$sid}\";\n"; print "</SCRIPT> \n"; }
function DisableGroupUsers() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); if ($USERConf->ToWebInterfaceAccess("UAC") != 1) { exit(0); } if (isset($_GET["counter"])) { $counter = $_GET["counter"]; } if (isset($_GET["disable"])) { $disable = $_GET["disable"]; } if (isset($_GET["defen"])) { $defen = $_GET["defen"]; } if (isset($_GET["delete"])) { $delete = $_GET["delete"]; } if (isset($_GET["discount"])) { $discount = $_GET["discount"]; } if (isset($_GET["delcount"])) { $delcount = $_GET["delcount"]; } if (isset($_GET["defcount"])) { $defcount = $_GET["defcount"]; } if (isset($_GET["id"])) { $id = $_GET["id"]; } $disable = explode(",", $disable); $count1 = count($disable); $defen = explode(",", $defen); $count3 = count($defen); $delete = explode(",", $delete); $count2 = count($delete); for ($i = 0; $i < $discount; $i++) { $QUERY = "UPDATE squiduser SET s_enabled='-1' WHERE s_user_id='{$disable[$i]}'"; $num_rows = $DB->samsdb_query($QUERY); } for ($i = 0; $i < $defcount; $i++) { $QUERY = "UPDATE squiduser SET s_enabled='1' WHERE s_user_id='{$defen[$i]}'"; $num_rows = $DB->samsdb_query($QUERY); } for ($i = 0; $i < $delcount; $i++) { $num_rows = $DB->samsdb_query("DELETE FROM squiduser WHERE s_user_id='{$delete[$i]}' "); } print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print " parent.tray.location.href=\"tray.php?show=exe&filename=grouptray.php&function=grouptray&id={$id}\";\n"; print "</SCRIPT> \n"; }
function MoveUserTrafficData() { global $SAMSConf; global $USERConf; global $DATE; $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $DB = new SAMSDB(); $sdate = $DATE->sdate(); $edate = $DATE->edate(); if (isset($_GET["userfrom"])) { $userfrom = $_GET["userfrom"]; } if (isset($_GET["userto"])) { $userto = $_GET["userto"]; } $thisdate = strftime("%Y-%m-%d"); $smdate = strftime("%Y") . "-" . strftime("%m") . "-01"; $stime = "0:00:00"; $etime = time(); $QUERY = "UPDATE squidcache SET s_user='******' WHERE s_user='******' AND s_date>='{$sdate}' AND s_date<='{$edate}' "; $num_rows = $DB->samsdb_query($QUERY); PageTop("backup_48.jpg", "Data about the traffic of user {$userfrom} is transferred to user {$userto}"); }
function DeleteGroup() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["id"])) { $id = $_GET["id"]; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $num_rows = $DB->samsdb_query_value("SELECT count(*) FROM squiduser WHERE s_group_id='{$id}' "); $row = $DB->samsdb_fetch_array(); $count = $row[0]; $DB->free_samsdb_query(); if ($count > 0) { NotEmptyGroupWarning($id); } else { $num_rows = $DB->samsdb_query_value("SELECT s_name FROM sgroup WHERE s_group_id='{$id}' "); $row = $DB->samsdb_fetch_array(); $gname = $row['s_name']; $DB->free_samsdb_query(); $QUERY = "DELETE FROM sgroup WHERE s_group_id='{$id}' "; $num_rows = $DB->samsdb_query($QUERY); // $QUERY="delete from auth_param where (s_param='adldgroup' OR s_param='ntlmgroup' OR s_param='ldapgroup') AND s_value='$gname'"; // $num_rows=$DB->samsdb_query($QUERY); print "<SCRIPT>\n"; print " parent.tray.location.href = \"tray.php?show=exe&filename=userstray.php&function=userstray\";\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print "</SCRIPT> \n"; } }
function SysPlugConfig() { global $SAMSConf; $DB = new SAMSDB(); $DB2 = new SAMSDB(); $num_rows = $DB->samsdb_query_value("SELECT * FROM sysinfo"); while ($row = $DB->samsdb_fetch_array()) { if (isset($_GET[$row['s_row_id']])) { $val = $_GET[$row['s_row_id']]; } else { $val = "off"; } if ($val == "on") { $val = 1; } else { $val = 0; } $num_rows = $DB2->samsdb_query("UPDATE sysinfo SET s_status='{$val}' WHERE s_row_id='{$row['s_row_id']}'"); } $DB->free_samsdb_query(); print "<SCRIPT>\n"; print " parent.basefrm.location.href=\"main.php?show=exe&function=sysplugconfigform&filename=sysplugconfigtray.php\";\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print "</SCRIPT> \n"; }
function LoadBackUp() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } PageTop("reark_48.jpg", "{$backupbuttom_2_loadbase_LoadBackUp_1}"); if (($finp = gzopen($_FILES['userfile']['tmp_name'], "r")) != NULL) { while (gzeof($finp) == 0) { $string = gzgets($finp, 10000); $QUERY = strtok($string, ";"); if (strstr($QUERY, "#") == FALSE) { echo "{$QUERY}<BR>"; $num_rows = $DB->samsdb_query($QUERY . ";"); } $count++; } } print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print "</SCRIPT> \n"; }
function ReconfigSquid() { global $SAMSConf; global $USERConf; global $DATE; $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; $DB = new SAMSDB(); if (isset($_GET["id"])) { $cache = $_GET["id"]; } $reconfigureOK = 0; if ($USERConf->ToWebInterfaceAccess("C") == 1) { $SAMSConf->AddLog("webinterface", "Sent a command to reconfigure proxy server id={$cache}", $DATE->today, $DATE->thistime); PageTop("reconfig_48.jpg", "{$squidbuttom_0_reconfig_ReconfigSquid_1}"); $QUERY = "INSERT INTO reconfig (s_proxy_id, s_service, s_action) VALUES('{$cache}', 'squid', 'reconfig'); "; $result = $DB->samsdb_query($QUERY); for ($j = 0; $j < 10; $j++) { $num_rows = $DB->samsdb_query_value("SELECT * FROM reconfig WHERE s_service='squid' AND s_proxy_id='{$cache}' AND s_action='reconfig' "); if ($num_rows == 0) { $reconfigureOK = 1; break; } else { sleep(1); } } if ($reconfigureOK == 1) { $str = "<FONT color=\"BLUE\" SIZE=+1> {$squidbuttom_0_reconfig_ReconfigSquid_3} </FONT><BR>\n"; } else { $str = "<FONT color=\"RED\" SIZE=+1> {$squidbuttom_0_reconfig_ReconfigSquid_4} </FONT><BR>\n"; } print "{$str}"; } }
function UpdateTRange() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["id"])) { $id = $_GET["id"]; } if (isset($_GET["name"])) { $name = $_GET["name"]; } $timestart = ""; if (isset($_GET["shour"])) { $timestart = $_GET["shour"]; } if (isset($_GET["smin"])) { $timestart = $timestart . ":" . $_GET["smin"] . ":00"; } $timeend = ""; if (isset($_GET["ehour"])) { $timeend = $_GET["ehour"]; } if (isset($_GET["emin"])) { $timeend = $timeend . ":" . $_GET["emin"] . ":00"; } $days = ""; if (isset($_GET["day1"])) { $days = "M"; } if (isset($_GET["day2"])) { $days = $days . "T"; } if (isset($_GET["day3"])) { $days = $days . "W"; } if (isset($_GET["day4"])) { $days = $days . "H"; } if (isset($_GET["day5"])) { $days = $days . "F"; } if (isset($_GET["day6"])) { $days = $days . "A"; } if (isset($_GET["day7"])) { $days = $days . "S"; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $DB->samsdb_query("UPDATE timerange SET s_name='{$name}', s_days='{$days}', s_timestart='{$timestart}' , s_timeend='{$timeend}' WHERE s_trange_id='{$id}' "); // UpdateLog("$SAMSConf->adminname","$shablonnew_AddShablon_1 $snick","01"); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print " parent.tray.location.href=\"tray.php?show=exe&filename=trangetray.php&function=trangetray&id={$id}\"; \n"; print "</SCRIPT> \n"; }
function AddUsersFromNTLM() { require_once "adldap.php"; global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("UC") != 1) { exit(0); } if (isset($_GET["domainname"])) { $domainname = $_GET["domainname"]; } if (isset($_GET["username"])) { $userlist = $_GET["username"]; } if (isset($_GET["groupname"])) { $usergroup = $_GET["groupname"]; } if (isset($_GET["usershablon"])) { $usershablon = $_GET["usershablon"]; } if (isset($_GET["enabled"])) { $enabled = $_GET["enabled"]; } if (isset($_GET["domain"])) { $domain = $_GET["domain"]; } if ($enabled == "on") { $enabled = 1; } else { $enabled = -1; } if (strlen($domainname) > 1) { $domain = $domainname; } $i = 0; $query = "select s_quote from shablon where s_shablon_id='{$usershablon}'"; $num_rows = $DB->samsdb_query_value($query); $row = $DB->samsdb_fetch_array(); $s_quote = $row['s_quote']; $DB->free_samsdb_query(); while (isset($userlist[$i]) == TRUE) { $string = $userlist[$i]; $i++; $user = "******"; // print("user=$user domain=$domain enabled=$enabled usergroup=$usergroup shablon=$usershablon<BR>"); $num_rows = $DB->samsdb_query_value("SELECT * FROM squiduser WHERE s_nick='{$user}'"); if ($num_rows == 0) { $num_rows = $DB->samsdb_query("INSERT INTO squiduser (s_group_id, s_shablon_id, s_nick, s_domain, s_enabled, s_quote) VALUES('{$usergroup}', '{$usershablon}', '{$user}', '{$domain}', '{$enabled}', '{$s_quote}')"); } } print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print " parent.tray.location.href=\"tray.php?show=exe&function=authntlmtray&filename=authntlmtray.php\"; \n"; print "</SCRIPT> \n"; }
function UsersImportFromFile() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("UC") != 1) { exit; } PageTop("user.jpg", "{$authbuttom_1_usersimport_LoadFileForm_1}"); if (isset($_GET["username"])) { $userlist = $_GET["username"]; } if (isset($_GET["groupname"])) { $usergroup = $_GET["groupname"]; } if (isset($_GET["usershablon"])) { $usershablon = $_GET["usershablon"]; } if (isset($_GET["enabled"])) { $enabled = $_GET["enabled"]; } if ($enabled == "on") { $enabled = 1; } else { $enabled = -1; } $i = 0; $finp = fopen("data/userslist.txt", "r"); if ($finp == FALSE) { echo "can't open file data/userslist.txt<BR>"; exit(0); } $QUERY = "SELECT s_quote FROM shablon WHERE s_shablon_id='{$usershablon}'"; $num_rows = $DB->samsdb_query_value($QUERY); if ($num_rows != 0) { $row = $DB->samsdb_fetch_array(); $userquote = $row['s_quote']; } $DB->free_samsdb_query(); while (feof($finp) == 0) { $string = fgets($finp, 10000); $string = trim($string); if (strlen($string) > 1) { echo "user {$string} "; $QUERY = "INSERT INTO squiduser (s_group_id, s_shablon_id, s_nick, s_domain, s_enabled,s_quote) VALUES('{$usergroup}', '{$usershablon}', '{$string}', '', '{$enabled}','{$userquote}')"; $DB->samsdb_query($QUERY); echo "added<BR>"; } } fclose($finp); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print "</SCRIPT> \n"; }
function SetUserAuthErrorVariables() { global $SAMSConf; $DB = new SAMSDB(); $time = time(); if ($this->authOk != 0 && $this->autherrorc != 0) { $result = $DB->samsdb_query("UPDATE squiduser SET s_autherrorc='0',s_autherrort='0' WHERE s_user_id='{$this->userid}' "); return 0; } if ($this->authOk == 0) { if ($this->autherrorc >= 2) { $result = $DB->samsdb_query("UPDATE squiduser SET s_autherrorc='0',s_autherrort='{$time}' WHERE s_user_id='{$this->userid}' "); return 1; } if ($this->autherrorc < 2 && $time > $this->autherrort + 60) { $result = $DB->samsdb_query("UPDATE squiduser SET s_autherrorc=s_autherrorc+1,s_autherrort='0' WHERE s_nick='{$this->UserName}' "); return -1; } } }
function WebInterfaceReConfig() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; $s_urlaccess = 0; $s_useraccess = 0; $s_showutree = 0; $s_showgraph = 0; if (isset($_GET["lang"])) { $lang = $_GET["lang"]; } if (isset($_GET["urlaccess"])) { $s_urlaccess = 1; } if (isset($_GET["useraccess"])) { $s_useraccess = 1; } if (isset($_GET["showutree"])) { $s_showutree = 1; } if (isset($_GET["showgraph"])) { $s_showgraph = 1; } if (isset($_GET["iconset"])) { $iconset = $_GET["iconset"]; } if (isset($_GET["showname"])) { $showname = $_GET["showname"]; } if (isset($_GET["kbsize"])) { $kbsize = $_GET["kbsize"]; } if (isset($_GET["mbsize"])) { $mbsize = $_GET["mbsize"]; } if (isset($_GET["createpdf"])) { $createpdf = $_GET["createpdf"]; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $DB->samsdb_query("UPDATE websettings SET s_createpdf='{$createpdf}', s_showname='{$showname}', s_showutree='{$s_showutree}', s_iconset='{$iconset}', s_lang='{$lang}', s_urlaccess='{$s_urlaccess}', s_useraccess='{$s_useraccess}', s_showgraph='{$s_showgraph}' "); $SAMSConf->LoadConfig(); PageTop("config_48.jpg", "{$adminbuttom_1_prop_SamsReConfig_1}"); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print "</SCRIPT> \n"; }
function DeleteShablon() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["id"])) { $id = $_GET["id"]; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } if ($sname != "default") { $num_rows = $DB->samsdb_query_value("SELECT * FROM squiduser WHERE s_shablon_id='{$id}' "); $DB->free_samsdb_query(); if ($num_rows == 0) { $QUERY = "select s_name from shablon where s_shablon_id='{$id}'"; $DB->samsdb_query_value($QUERY); $row = $DB->samsdb_fetch_array(); $s_name = $row['s_name']; $DB->free_samsdb_query(); $QUERY = "delete from auth_param where (s_param='adldgroup' OR s_param='ntlmgroup' OR s_param='ldapgroup') AND s_value='{$s_name}'"; $DB->samsdb_query($QUERY); $QUERY = "DELETE FROM shablon WHERE s_shablon_id='{$id}'"; $DB->samsdb_query($QUERY); } else { PageTop("denied.gif", "<FONT SIZE=+3 COLOR=\"RED\"> {$shablonbuttom_9_delete_DeleteShablon_3} </FONT>"); echo "<FONT SIZE=+1>{$shablonbuttom_9_delete_DeleteShablon_1} {$num_rows} {$shablonbuttom_9_delete_DeleteShablon_2}</FONT>"; exit(0); } } print "OK<BR>"; print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print " parent.basefrm.location.href=\"main.php?show=exe&function=newshablonform&filename=shablonnew.php\";\n"; print "</SCRIPT> \n"; }
function ClearUsersTrafficCounter() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") == 1) { $num_rows = $DB->samsdb_query("UPDATE squiduser SET s_size='0', s_hit='0' "); print "<SCRIPT>\n"; print " parent.basefrm.location.href=\"main.php?show=exe&filename=userstray.php&function=AllUsersForm&type=all\";\n"; print "</SCRIPT> \n"; } }
function DeletePool() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["id"])) { $id = $_GET["id"]; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } if ($sname != "default") { $DB->samsdb_query("DELETE FROM delaypool WHERE s_pool_id='{$id}' "); $DB->samsdb_query("DELETE FROM d_link_s WHERE s_pool_id='{$id}' "); $DB->samsdb_query("DELETE FROM d_link_t WHERE s_pool_id='{$id}' "); $DB->samsdb_query("DELETE FROM d_link_r WHERE s_pool_id='{$id}' "); } print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print " parent.basefrm.location.href=\"main.php?show=exe&filename=pooltray.php&function=addpoolform\";\n"; print "</SCRIPT> \n"; }
function ClearCounter() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } if (isset($_GET["id"])) { $id = $_GET["id"]; } $QUERY = "UPDATE proxy SET s_endvalue='0' WHERE s_proxy_id='{$id}'"; $DB->samsdb_query($QUERY); }
function shutdown_proxy() { global $SAMSConf; global $USERConf; $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["id"])) { $id = $_GET["id"]; } if ($USERConf->ToWebInterfaceAccess("C") == 1) { $DB = new SAMSDB(); PageTop("reconfig_48.jpg", "Send command '{$SAMSConf->SHUTDOWN}' to proxy server"); $QUERY = "INSERT INTO reconfig (s_proxy_id, s_service, s_action) VALUES('{$id}', 'squid', 'shutdown'); "; $result = $DB->samsdb_query($QUERY); } }
function AddPool() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; $agg1 = "-1"; $agg2 = "-1"; $net1 = "-1"; $net2 = "-1"; $ind1 = "-1"; $ind2 = "-1"; if (isset($_GET["name"])) { $name = $_GET["name"]; } if (isset($_GET["class"])) { $class = $_GET["class"]; } if (isset($_GET["agg1"])) { $agg1 = $_GET["agg1"]; } if (isset($_GET["agg2"])) { $agg2 = $_GET["agg2"]; } if (isset($_GET["net1"])) { $net1 = $_GET["net1"]; } if (isset($_GET["net2"])) { $net2 = $_GET["net2"]; } if (isset($_GET["ind1"])) { $ind1 = $_GET["ind1"]; } if (isset($_GET["ind2"])) { $ind2 = $_GET["ind2"]; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $DB->samsdb_query("INSERT INTO delaypool ( s_name, s_class, s_agg1, s_agg2, s_net1, s_net2, s_ind1, s_ind2 ) VALUES ( '{$name}', '{$class}', '{$agg1}', '{$agg2}', '{$net1}', '{$net2}', '{$ind1}', '{$ind2}' ) "); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print " parent.basefrm.location.href = \"main.php?show=exe&filename=pooltray.php&function=addpoolform\"; \n"; print "</SCRIPT> \n"; }
function AddUsersFromLDAP() { require_once "ldap.php"; global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("UC") != 1) { exit; } if (isset($_GET["username"])) { $userlist = $_GET["username"]; } if (isset($_GET["groupname"])) { $usergroup = $_GET["groupname"]; } if (isset($_GET["usershablon"])) { $usershablon = $_GET["usershablon"]; } if (isset($_GET["enabled"])) { $enabled = $_GET["enabled"]; } if ($enabled == "on") { $enabled = 1; } else { $enabled = -1; } $i = 0; $query = "select s_quote from shablon where s_shablon_id='{$usershablon}'"; $num_rows = $DB->samsdb_query_value($query); $row = $DB->samsdb_fetch_array(); $s_quote = $row['s_quote']; $DB->free_samsdb_query(); while (strlen($userlist[$i]) > 0) { $string = $userlist[$i]; $i++; $user = "******"; $query = "INSERT INTO squiduser (s_group_id, s_shablon_id, s_nick, s_enabled, s_quote) VALUES('{$usergroup}', '{$usershablon}', '{$user}', '{$enabled}', '{$s_quote}')"; $num_rows = $DB->samsdb_query($query); } print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print "</SCRIPT> \n"; }
function ChangeAdminPasswd() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["username"])) { $username = $_GET["username"]; } if (isset($_GET["adminname"])) { $adminname = $_GET["adminname"]; } if (isset($_GET["passw1"])) { $newpasswd = $_GET["passw1"]; } if (isset($_GET["oldpasswd"])) { $oldpasswd = $_GET["oldpasswd"]; } if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $passwd = crypt($newpasswd, "00"); $oldpasswd2 = crypt($oldpasswd, "00"); $QUERY = "SELECT s_pass FROM passwd WHERE s_user='******' AND s_pass='******' "; $num_rows = $DB->samsdb_query_value($QUERY); if ($num_rows != 1) { PageTop("warning.jpg", "{$username} password wrong"); } else { $QUERY = "UPDATE passwd SET s_pass='******' WHERE s_user='******' AND s_pass='******' "; $num_rows = $DB->samsdb_query($QUERY); PageTop("user_48.jpg", "{$adminbuttom_4_chpasswd_ChangeAdminPasswd_1} {$username} {$adminbuttom_4_chpasswd_ChangeAdminPasswd_2}"); setcookie("user", ""); setcookie("passwd", ""); setcookie("domainuser", ""); setcookie("gauditor", ""); setcookie("userid", ""); setcookie("webaccess", ""); setcookie("samsadmin", "0"); print "<SCRIPT>\n"; print " parent.basefrm.location.href=\"main.php?show=exe&function=setcookie&username={$username}&userid={$newpasswd}\";\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print "</SCRIPT> \n"; } }
function lffolder_5_z1_shablon() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") == 1) { $item = array("classname" => "shablon", "icon" => "paddressbook.gif", "target" => "basefrm", "url" => "main.php?show=exe&function=newshablonform&filename=shablonnew.php", "text" => "{$lframe_sams_UserShablonFolder_1}"); treeFolder($item); $DB->samsdb_query("SELECT * FROM shablon ORDER BY s_name"); while ($row = $DB->samsdb_fetch_array()) { $item = array("classname" => "shablon", "target" => "tray", "url" => "tray.php?show=exe&function=shablontray&filename=shablontray.php&id={$row['s_shablon_id']}", "text" => "{$row['s_name']}"); treeFolderItem($item); } treeFolderClose(); } }
function DeleteProxy() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } if (isset($_GET["id"])) { $id = $_GET["id"]; } $QUERY = "DELETE FROM proxy WHERE s_proxy_id='{$id}'"; $DB->samsdb_query($QUERY); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print " parent.basefrm.location.href = \"main.php?show=exe&function=cacheform&filename=squidtray.php&function=squidtray\"; \n"; print "</SCRIPT> \n"; }
function UpdateGroup() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } if (isset($_GET["id"])) { $id = $_GET["id"]; } if (isset($_GET["nick"])) { $nick = $_GET["nick"]; } $num_rows = $DB->samsdb_query("UPDATE sgroup SET s_name='{$nick}' WHERE s_group_id='{$id}' "); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\";\n"; print " parent.tray.location.href=\"tray.php?show=exe&filename=grouptray.php&function=grouptray&id={$id}\" "; print "</SCRIPT> \n"; }
function AddSyncGroup() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit(0); } if (isset($_GET["addsyncgroupname"])) { $addsyncgroupname = $_GET["addsyncgroupname"]; } PageTop("config_48.jpg", "{$AddSyncGroup_authntlmtray_1}"); $i = 0; while (strlen($addsyncgroupname[$i]) > 0) { $result = $DB->samsdb_query("INSERT INTO auth_param (s_auth, s_param, s_value) VALUES('ntlm', 'ntlmgroup', '{$addsyncgroupname[$i]}') "); echo "<B>{$addsyncgroupname[$i]}</B><BR>"; $i++; } }
function LoadRedirList() { global $SAMSConf; global $USERConf; $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["listfilename"])) { $listfilename = $_GET["listfilename"]; } if (isset($_GET["type"])) { $type = $_GET["type"]; } if (isset($_GET["id"])) { $id = $_GET["id"]; } if ($USERConf->ToWebInterfaceAccess("CL") != 1) { exit; } $listfilename = $_FILES["userfile"]["name"]; PageTop("import_48.jpg", "{$redir_loadfurllist1} <BR>{$listfilename}"); $aaa = copy($_FILES["userfile"]["tmp_name"], "data/urllist.txt"); $finp = fopen("data/urllist.txt", "r"); if ($finp == FALSE) { echo "can't open sams config file data/urllist.txt<BR>"; exit(0); } while (feof($finp) == 0) { $string = fgets($finp, 10000); $string = trim($string); //print("INSERT INTO urls SET urls.url=\"$string\",type=\"$id\" <BR> "); if (strlen($string) > 1) { $DB->samsdb_query("INSERT INTO url (s_url, s_redirect_id) VALUES ('{$string}' , '{$id}') "); } } fclose($finp); print "<SCRIPT>\n"; print " parent.basefrm.location.href=\"main.php?show=exe&filename=redirlisttray.php&function=redirlistform&id={$id}\";\n"; print "</SCRIPT> \n"; }
function ChUserPasswd() { global $SAMSConf; global $USERConf; global $SquidUSERConf; if (isset($_GET["id"])) { $id = $_GET["id"]; } $SquidUSERConf = new SAMSUSER(); $SquidUSERConf->sams_user($id); if ($USERConf->ToWebInterfaceAccess("AUC") == 1 || $USERConf->s_user_id == $SquidUSERConf->s_user_id && $USERConf->ToWebInterfaceAccess("W") == 1) { $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["passw1"])) { $newpasswd = $_GET["passw1"]; } PageTop("userpasswd_48.jpg", " {$userbuttom_6_chpasswd_ChUserPasswd_1} <BR><FONT COLOR=\"BLUE\">{$SquidUSERConf->s_nick}</FONT>"); $passwd = crypt($newpasswd, substr($newpasswd, 0, 2)); $num_rows = $DB->samsdb_query("UPDATE squiduser SET s_passwd='{$passwd}' WHERE s_user_id='{$SquidUSERConf->s_user_id}'"); } }
function UpdateAuthParameter($auth, $parameter) { global $SAMSConf; if (isset($_GET["{$parameter}"])) { $value = $_GET["{$parameter}"]; } $value = str_replace("\\", "\\\\", $value); if ($value != "") { $DB = new SAMSDB(); $num_rows = $DB->samsdb_query_value("SELECT s_value FROM auth_param WHERE s_auth='{$auth}' AND s_param='{$parameter}' "); if ($num_rows > 0) { $row = $DB->samsdb_fetch_array(); if ($row['s_value'] != $value) { $query = "UPDATE auth_param SET s_value='{$value}' WHERE s_auth='{$auth}' AND s_param='{$parameter}'"; } else { return 0; } } else { $query = "INSERT INTO auth_param VALUES('{$auth}','{$parameter}','{$value}')"; } $DB->samsdb_query($query); } }
function AddGroup() { global $SAMSConf; global $USERConf; if ($USERConf->ToWebInterfaceAccess("C") != 1) { exit; } $DB = new SAMSDB(); $lang = "./lang/lang.{$SAMSConf->LANG}"; require $lang; if (isset($_GET["groupnick"])) { $groupnick = $_GET["groupnick"]; } $result = $DB->samsdb_query_value("SELECT s_name FROM sgroup where s_name = '{$groupnick}'"); if ($result == 0) { $result = $DB->samsdb_query("INSERT INTO sgroup (s_name) VALUES('{$groupnick}') "); print "<SCRIPT>\n"; print " parent.lframe.location.href=\"lframe.php\"; \n"; print " parent.tray.location.href=\"tray.php?show=usergrouptray&groupname={$groupname}&groupnick={$groupnick}\";\n"; print "</SCRIPT> \n"; } else { PageTop("usergroup_48.jpg", "{$newgroupbuttom_5_addgroup_newgrpbuttom_5_groupexist}"); } }