Example #1
0
function AddCache()
{
    global $SAMSConf;
    global $USERConf;
    $DB = new SAMSDB();
    $delaypool = 0;
    $ntlmdomain = 0;
    $bigdomain = 0;
    $bigusername = 0;
    $parser_on = 0;
    $parser_time = 1;
    $count_clean = 0;
    $sleep = 1;
    $nameencode = 0;
    $checkdns = 0;
    $loglevel = 0;
    $squidbase = 0;
    $parser = 0;
    $adminaddr = "root@localhost";
    if (isset($_GET["description"])) {
        $description = $_GET["description"];
    }
    if (isset($_GET["delaypool"])) {
        $delaypool = SetCheckBoxValue($_GET["delaypool"]);
    }
    if (isset($_GET["redirect_to"])) {
        $redirect_to = $_GET["redirect_to"];
    }
    if (isset($_GET["denied_to"])) {
        $denied_to = $_GET["denied_to"];
    }
    if (isset($_GET["redirector"])) {
        $redirector = $_GET["redirector"];
    }
    if (isset($_GET["auth"])) {
        $auth = $_GET["auth"];
    }
    if (isset($_GET["wbinfopath"])) {
        $wbinfopath = $_GET["wbinfopath"];
    }
    if (isset($_GET["ntlmdomain"])) {
        $ntlmdomain = SetCheckBoxValue($_GET["ntlmdomain"]);
    }
    if (isset($_GET["bigdomain"])) {
        $bigdomain = $_GET["bigdomain"];
    }
    if (isset($_GET["bigusername"])) {
        $bigusername = $_GET["bigusername"];
    }
    if (isset($_GET["parser_on"])) {
        $parser_on = SetCheckBoxValue($_GET["parser_on"]);
    }
    if (isset($_GET["parser"])) {
        $parser = $_GET["parser"];
    }
    if (isset($_GET["parser_time"])) {
        $parser_time = $_GET["parser_time"];
    }
    if (isset($_GET["count_clean"])) {
        $count_clean = SetCheckBoxValue($_GET["count_clean"]);
    }
    if (isset($_GET["sleep"])) {
        $sleep = $_GET["sleep"];
    }
    if (isset($_GET["nameencode"])) {
        $nameencode = SetCheckBoxValue($_GET["nameencode"]);
    }
    if (isset($_GET["traffic"])) {
        $traffic = $_GET["traffic"];
    }
    if (isset($_GET["checkdns"])) {
        $checkdns = SetCheckBoxValue($_GET["checkdns"]);
    }
    if (isset($_GET["loglevel"])) {
        $loglevel = $_GET["loglevel"];
    }
    if (isset($_GET["defaultdomain"])) {
        $defaultdomain = $_GET["defaultdomain"];
    }
    if (isset($_GET["squidbase"])) {
        $squidbase = SetCheckBoxValue($_GET["squidbase"]);
    }
    if (isset($_GET["udscript"])) {
        $udscript = $_GET["udscript"];
    }
    if (isset($_GET["adminaddr"])) {
        $adminaddr = $_GET["adminaddr"];
    }
    if (isset($_GET["kbsize"])) {
        $kbsize = $_GET["kbsize"];
    }
    if (isset($_GET["mbsize"])) {
        $mbsize = $_GET["mbsize"];
    }
    if (isset($_GET["separator"])) {
        $separator = $_GET["separator"];
    }
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    if ($USERConf->ToWebInterfaceAccess("C") != 1) {
        exit;
    }
    if ($separator == 0) {
        $separator = "0+";
    }
    if ($separator == 1) {
        $separator = "0\\\\\\\\";
    }
    if ($separator == 2) {
        $separator = "0@";
    }
    $query = "INSERT INTO proxy ( s_description) VALUES ( '{$description}' ) ";
    $DB->samsdb_query($query);
    $query = "UPDATE proxy SET  s_endvalue='0', s_redirect_to='{$redirect_to}', s_denied_to='{$denied_to}', s_redirector='{$redirector}', s_delaypool='{$delaypool}', s_auth='{$auth}', s_wbinfopath='{$wbinfopath}', s_separator='{$separator}', s_usedomain='{$ntlmdomain}', s_bigd='{$bigdomain}', s_bigu='{$bigusername}', s_sleep='{$sleep}', s_parser='{$parser}', s_parser_time='{$parser_time}', s_count_clean='{$count_clean}', s_nameencode='{$nameencode}', s_realsize='{$traffic}', s_checkdns='{$checkdns}', s_debuglevel='{$loglevel}', s_defaultdomain='workgroup', s_squidbase='{$squidbase}', s_udscript='{$udscript}', s_adminaddr='{$adminaddr}', s_kbsize='{$kbsize}', s_mbsize='{$mbsize}' WHERE s_description='{$description}' ";
    //echo "$query<BR>";
    $DB->samsdb_query($query);
    //    UpdateLog("$SAMSConf->adminname","Added SQUID-cache $description ","01");
    print "<SCRIPT>\n";
    print "  parent.lframe.location.href=\"lframe.php\";\n";
    print "  parent.basefrm.location.href = \"main.php?show=exe&function=cacheform&filename=squidbuttom_4_addcache.php\"; \n";
    print "</SCRIPT> \n";
}
Example #2
0
function ProxyReConfig()
{
    global $SAMSConf;
    global $USERConf;
    global $PROXYConf;
    $DB = new SAMSDB();
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    $delaypool = 0;
    $usedomain = 0;
    $bigdomain = $PROXYConf->s_bigd;
    $bigusername = $PROXYConf->s_bigu;
    $parser_on = 0;
    $parser_time = $PROXYConf->s_parser_time;
    $count_clean = 0;
    $sleep = $PROXYConf->s_sleep;
    $nameencode = 0;
    $checkdns = 0;
    $loglevel = $PROXYConf->s_debuglevel;
    $squidbase = $PROXYConf->s_squidbase;
    $adminaddr = $PROXYConf->s_adminaddr;
    $autouser = 0;
    $shablon = $PROXYConf->s_autotpl;
    $group = $PROXYConf->s_autogrp;
    if (isset($_GET["id"])) {
        $id = $_GET["id"];
    }
    if (isset($_GET["delaypool"])) {
        $delaypool = SetCheckBoxValue($_GET["delaypool"]);
    }
    if (isset($_GET["redirect_to"])) {
        $redirect_to = $_GET["redirect_to"];
    }
    if (isset($_GET["denied_to"])) {
        $denied_to = $_GET["denied_to"];
    }
    if (isset($_GET["redirector"])) {
        $redirector = $_GET["redirector"];
    }
    if (isset($_GET["authtype"])) {
        $auth = $_GET["authtype"];
    }
    if (isset($_GET["wbinfopath"])) {
        $wbinfopath = $_GET["wbinfopath"];
    }
    if (isset($_GET["usedomain"])) {
        $usedomain = SetCheckBoxValue($_GET["usedomain"]);
    }
    if (isset($_GET["bigdomain"])) {
        $bigdomain = $_GET["bigdomain"];
    }
    if (isset($_GET["bigusername"])) {
        $bigusername = $_GET["bigusername"];
    }
    if (isset($_GET["parser_on"])) {
        $parser_on = SetCheckBoxValue($_GET["parser_on"]);
    }
    if (isset($_GET["parser_time"])) {
        $parser_time = $_GET["parser_time"];
    }
    if (isset($_GET["count_clean"])) {
        $count_clean = SetCheckBoxValue($_GET["count_clean"]);
    }
    if (isset($_GET["sleep"])) {
        $sleep = $_GET["sleep"];
    }
    if (isset($_GET["nameencode"])) {
        $nameencode = SetCheckBoxValue($_GET["nameencode"]);
    }
    if (isset($_GET["traffic"])) {
        $traffic = $_GET["traffic"];
    }
    if (isset($_GET["checkdns"])) {
        $checkdns = SetCheckBoxValue($_GET["checkdns"]);
    }
    if (isset($_GET["loglevel"])) {
        $loglevel = $_GET["loglevel"];
    }
    if (isset($_GET["defaultdomain"])) {
        $defaultdomain = $_GET["defaultdomain"];
    }
    if (isset($_GET["squidbase"])) {
        $squidbase = $_GET["squidbase"];
    }
    $udscript = "";
    if (isset($_GET["udscript"])) {
        $udscript = $_GET["udscript"];
    }
    if (isset($_GET["adminaddr"])) {
        $adminaddr = $_GET["adminaddr"];
    }
    if (isset($_GET["kbsize"])) {
        $kbsize = $_GET["kbsize"];
    }
    if (isset($_GET["mbsize"])) {
        $mbsize = $_GET["mbsize"];
    }
    if (isset($_GET["defauth"])) {
        $defauth = $_GET["defauth"];
    }
    if (isset($_GET["autouser"])) {
        $autouser = SetCheckBoxValue($_GET["autouser"]);
    }
    if (isset($_GET["shablon"])) {
        $shablon = $_GET["shablon"];
    }
    if (isset($_GET["group"])) {
        $group = $_GET["group"];
    }
    if (isset($_GET["description"])) {
        $description = $_GET["description"];
    }
    $separator = "";
    if (isset($_GET["separator"])) {
        if ($_GET["separator"] == 0) {
            $separator = "0+";
        }
        if ($_GET["separator"] == 1) {
            $separator = "0\\\\\\\\";
        }
        if ($_GET["separator"] == 2) {
            $separator = "0@";
        }
    }
    if ($USERConf->ToWebInterfaceAccess("C") != 1) {
        exit;
    }
    $query = "UPDATE proxy SET s_description='{$description}', s_debuglevel='{$loglevel}', s_checkdns='{$checkdns}', s_realsize='{$traffic}', \n      s_nameencode='{$nameencode}', s_sleep='{$sleep}', s_count_clean='{$count_clean}', s_parser='{$parser_on}',\n      s_parser_time='{$parser_time}', s_bigd='{$bigdomain}', s_bigu='{$bigusername}', s_usedomain='{$usedomain}',\n      s_delaypool='{$delaypool}', s_redirect_to='{$redirect_to}', s_denied_to='{$denied_to}', s_redirector='{$redirector}', s_auth='{$auth}', \n      s_wbinfopath='{$wbinfopath}', s_defaultdomain='{$defaultdomain}', s_squidbase='{$squidbase}', s_udscript='{$udscript}', \n      s_adminaddr='{$adminaddr}', \n      s_autouser='******', s_autotpl='{$shablon}', s_autogrp='{$group}', s_separator='{$separator}'  \n      WHERE s_proxy_id='{$id}'";
    $DB->samsdb_query($query);
    $SAMSConf->LoadConfig();
    print "<SCRIPT>\n";
    print "parent.tray.location.href=\"tray.php?show=exe&function=proxytray&filename=proxytray.php&id={$id}\";\n";
    print "  parent.lframe.location.href=\"lframe.php\"; \n";
    print "</SCRIPT> \n";
}