(*)"; // very important, do not try to remove it or change it define ("_SECURE_","1"); // protect from SQL injection when magic_quotes_gpc sets to "Off" function pl_addslashes($data) { global $db_param; if ($db_param[type]=="mssql") { $data = str_replace("'", "''", $data); } else { $data = addslashes($data); } return $data; } function q_sanitize($var) { $var = str_replace("/","",$var); $var = str_replace("|","",$var); $var = str_replace("\\","",$var); $var = str_replace("\"","",$var); $var = str_replace('\'',"",$var); $var = str_replace("..","",$var); return $var; } if (!get_magic_quotes_gpc()) { foreach($_GET as $key => $val){$_GET[$key]=pl_addslashes($_GET[$key]);} foreach($_POST as $key => $val){$_POST[$key]=pl_addslashes($_POST[$key]);} foreach($_COOKIE as $key => $val){$_COOKIE[$key]=pl_addslashes($_COOKIE[$key]);} foreach($_SERVER as $key => $val){$_SERVER[$key]=pl_addslashes($_SERVER[$key]);} } $c_script_filename = $_SERVER['SCRIPT_FILENAME']; $c_php_self = $_SERVER['PHP_SELF']; $c_http_host = $_SERVER['HTTP_HOST']; // base application directory $apps_path[base] = dirname($c_script_filename); // base application http path $http_path[base] = "http://".$c_http_host.( dirname($c_php_self)=='/' ? $c_php_self : dirname($c_php_self) ); // libraries directory $apps_path[libs] = $apps_path[base]."/lib"; // includes directories $apps_path[incs] = $apps_path[base]."/inc"; // includes http path $http_path[incs] = $http_path[base]."/inc"; // themes directories $apps_path[themes] = $apps_path[incs]."/themes/".$themes[name]; // themes http path $http_path[themes] = $http_path[incs]."/themes/".$themes[name]; // full path to 'iptables' (directory and the file) $apps_path['fw'] = '$(which iptables)'; // full path to 'tc' $apps_path['tc'] = '$(which tc)'; // full path to 'sysctl' $apps_path['sc'] = '$(which sysctl)'; // connect to database include_once $apps_path[libs]."/dba.php"; $dba_object = dba_connect($db_param[user],$db_param[pass],$db_param[name],$db_param[host],$db_param[port]); // -------------------------------------------------------------------------------- $inc = q_sanitize($_REQUEST['inc']); $op = q_sanitize($_REQUEST['op']); $id = q_sanitize($_REQUEST['id']); $err = $_REQUEST['err']; if (!$themes[name]) { $themes[name] = "default"; } // header's menus $arrMenu1 = array( "Network"=>"index.php?inc=network&op=network_list", "Package"=>"index.php?inc=package&op=package_list", "Node"=>"index.php?inc=node&op=node_list", "Apply rules"=>"index.php?inc=apply", "Show fw rules"=>"index.php?inc=show&op=createfw", "Show tc rules"=>"index.php?inc=show&op=createtc", "Show applied rules"=>"index.php?inc=show&op=applied", "Edit sysctl"=>"index.php?inc=edit&op=sysctl", "Edit masquerade"=>"index.php?inc=edit&op=masquerade", "Edit firewall"=>"index.php?inc=edit&op=firewall", "Edit control"=>"index.php?inc=edit&op=control" ); // total link bandwidth $db_query = "SELECT SUM(bandwidth) AS bw_root FROM tblNetwork"; $db_result = dba_query($db_query); $db_row = dba_fetch_array($db_result); $bw_root = $db_row['bw_root']; // percentage of stated bandwidth (default 98%) $posb = 98 / 100; // mark for root preferred 10 $mark_root = "10"; // priority // the highest the higher $prio_default = 2; // default priority is normal $prio[0] = "200"; // lowest $prio[1] = "201"; // low $prio[2] = "202"; // normal $prio[3] = "203"; // medium $prio[4] = "204"; // high $prio[5] = "205"; // highest // this application version, do not change $apps_version = "0.8.1"; ?>