本文整理汇总了PHP中mysql::TABLE_EXISTS方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::TABLE_EXISTS方法的具体用法?PHP mysql::TABLE_EXISTS怎么用?PHP mysql::TABLE_EXISTS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::TABLE_EXISTS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkGreenTables
function checkGreenTables()
{
$q = new mysql();
if (!$q->TABLE_EXISTS("query", "greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating query table\n";
$sql = "CREATE table query(\n\t\tqueryid int unsigned NOT NULL auto_increment primary key,\n\t\tproxyid int unsigned NOT NULL default '0',\n\t\tperm smallint unsigned NOT NULL default 1,\n\t\tdb_name char(50) NOT NULL,\n\t\tquery text NOT NULL,\n\t\tINDEX(proxyid,db_name)\n\t\t) DEFAULT CHARSET=utf8;\n\t\t";
$q->QUERY_SQL($sql, "greensql");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " GreenSQL failed {$q->mysql_error}\n";
}
}
if (!$q->TABLE_EXISTS("proxy", "greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating proxy table\n";
$sql = "\n\t\t\tCREATE table proxy\n\t\t\t(\n\t\t\tproxyid int unsigned NOT NULL auto_increment primary key,\n\t\t\tproxyname char(50) NOT NULL default '',\n\t\t\tfrontend_ip char(20) NOT NULL default '',\n\t\t\tfrontend_port smallint unsigned NOT NULL default 0,\n\t\t\tbackend_server char(50) NOT NULL default '',\n\t\t\tbackend_ip char(20) NOT NULL default '',\n\t\t\tbackend_port smallint unsigned NOT NULL default 0,\n\t\t\tdbtype char(20) NOT NULL default 'mysql',\n\t\t\tstatus smallint unsigned NOT NULL default '1'\n\t\t\t) DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "greensql");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " GreenSQL failed {$q->mysql_error}\n";
}
$q->QUERY_SQL("insert into proxy values (1,'Default MySQL Proxy','127.0.0.1',3305,'localhost','127.0.0.1',3306,'mysql',1);", "greensql");
$q->QUERY_SQL("insert into proxy values (2,'Default PgSQL Proxy','127.0.0.1',5431,'localhost','127.0.0.1',5432,'pgsql',1);", "greensql");
}
if (!$q->TABLE_EXISTS("db_perm", "greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating db_perm table\n";
$sql = "CREATE table db_perm\n\t\t\t(\n\t\t\tdbpid int unsigned NOT NULL auto_increment primary key,\n\t\t\tproxyid int unsigned NOT NULL default '0',\n\t\t\tdb_name char(50) NOT NULL,\n\t\t\tperms bigint unsigned NOT NULL default '0',\n\t\t\tperms2 bigint unsigned NOT NULL default '0',\n\t\t\tstatus smallint unsigned NOT NULL default '0',\n\t\t\tsysdbtype char(20) NOT NULL default 'user_db',\n\t\t\tstatus_changed datetime NOT NULL default '00-00-0000 00:00:00',\n\t\t\tINDEX (proxyid, db_name)\n\t\t\t) DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "greensql");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " GreenSQL failed {$q->mysql_error}\n";
}
$q->QUERY_SQL("insert into db_perm (dbpid, proxyid, db_name, sysdbtype) values (1,0,'default mysql db', 'default_mysql');", "greensql");
$q->QUERY_SQL("insert into db_perm (dbpid, proxyid, db_name, sysdbtype) values (2,0,'no-name mysql db', 'empty_mysql');", "greensql");
$q->QUERY_SQL("insert into db_perm (dbpid, proxyid, db_name, sysdbtype) values (3,0,'default pgsql db', 'default_pgsql');", "greensql");
}
if (!$q->TABLE_EXISTS("admin", "greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating admin table\n";
$sql = "CREATE table admin(\n\t\t\tadminid int unsigned NOT NULL auto_increment primary key,\n\t\t\tname char(50) NOT NULL default '',\n\t\t\tpwd char(50) NOT NULL default '',\n\t\t\temail char(50) NOT NULL default ''\n\t\t\t) DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "greensql");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " GreenSQL failed {$q->mysql_error}\n";
}
$q->QUERY_SQL("insert into admin values(1,'admin',sha1('pwd'),'');", "greensql");
}
if (!$q->TABLE_EXISTS("alert", "greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating alert table\n";
$sql = "CREATE table alert\n\t\t\t(\n\t\t\talertid int unsigned NOT NULL auto_increment primary key,\n\t\t\tagroupid int unsigned NOT NULL default '0',\n\t\t\tevent_time datetime NOT NULL default '00-00-0000 00:00:00',\n\t\t\trisk smallint unsigned NOT NULL default '0',\n\t\t\tblock smallint unsigned NOT NULL default '0',\n\t\t\tdbuser varchar(50) NOT NULL default '',\n\t\t\tuserip varchar(50) NOT NULL default '',\n\t\t\tquery text NOT NULL,\n\t\t\treason text NOT NULL,\n\t\t\tINDEX (agroupid)\n\t\t\t) DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "greensql");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " GreenSQL failed {$q->mysql_error}\n";
}
}
if (!$q->TABLE_EXISTS("alert_group", "greensql")) {
echo "Starting......: " . date("H:i:s") . " GreenSQL creating alert_group table\n";
$sql = "CREATE table alert_group(\n\t\t\tagroupid int unsigned NOT NULL auto_increment primary key,\n\t\t\tproxyid int unsigned NOT NULL default '1',\n\t\t\tdb_name char(50) NOT NULL default '',\n\t\t\tupdate_time datetime NOT NULL default '00-00-0000 00:00:00',\n\t\t\tstatus smallint NOT NULL default 0,\n\t\t\tpattern text NOT NULL,\n\t\t\tINDEX(update_time)\n\t\t\t)";
$q->QUERY_SQL($sql, "greensql");
if (!$q->ok) {
echo "Starting......: " . date("H:i:s") . " GreenSQL failed {$q->mysql_error}\n";
}
}
echo "Starting......: " . date("H:i:s") . " GreenSQL check tables done...\n";
}
示例2: Save
function Save()
{
$q = new mysql();
if (!$q->TABLE_EXISTS("storage_containers", "artica_backup")) {
$sql = "CREATE TABLE IF NOT EXISTS `artica_backup`.`storage_containers` (\n\t\t\t\t`groupid` VARCHAR( 255 ) NOT NULL,\n\t\t\t\t`enabled` smallint( 1 ) NOT NULL,\n\t\t\t\t`maxsize` INT UNSIGNED ,\n\t\t\t\t`directory` VARCHAR( 255 ) NOT NULL,\n\t\t\t\t PRIMARY KEY ( `groupid` ),\n\t\t\t\t KEY `enabled`(`enabled`)\n\t\t\t\t) ENGINE=MYISAM;";
$q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
echo $q->mysql_error;
return;
}
}
$_POST["directory"] = mysql_escape_string2($_POST["directory"]);
$gid = mysql_escape_string2($_POST["gid"]);
$ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM storage_containers WHERE `groupid`='{$gid}'", "artica_backup"));
//echo "$gid = {$ligne["directory"]} Enabled={$_POST["enabled"]}\n";
if ($ligne["directory"] != null) {
$q->QUERY_SQL("UPDATE storage_containers SET `maxsize`='{$_POST["maxsize"]}',\n\t\tenabled='{$_POST["enabled"]}',`directory`='{$_POST["directory"]}' WHERE `groupid`='{$gid}'", "artica_backup");
} else {
$q->QUERY_SQL("INSERT IGNORE INTO storage_containers (groupid,enabled,maxsize,`directory`)\n\t\t\t\tVALUES ('{$gid}','{$_POST["enabled"]}','{$_POST["maxsize"]}','{$_POST["directory"]}')", "artica_backup");
}
if (!$q->ok) {
echo $q->mysql_error;
return;
}
}
示例3: table
function table()
{
$page = CurrentPageName();
$tpl = new templates();
$t = time();
$dnsmasq_address_text = $tpl->_ENGINE_parse_body("{dnsmasq_address_text}");
$hosts = $tpl->_ENGINE_parse_body("{hosts}");
$addr = $tpl->_ENGINE_parse_body("{addr}");
$new_interface = $tpl->_ENGINE_parse_body("{new_interface}");
$rulename = $tpl->_ENGINE_parse_body("{rulename}");
$explain = $tpl->javascript_parse_text("{explain}");
$title = $tpl->_ENGINE_parse_body("{rules}");
$category = $tpl->_ENGINE_parse_body("{category}");
$enabled = $tpl->_ENGINE_parse_body("{enabled}");
$q = new mysql();
if (!$q->TABLE_EXISTS("suricata_rules_packages", "artica_backup")) {
$sql = "CREATE TABLE IF NOT EXISTS `artica_backup`.`suricata_rules_packages` (\n\t\t`rulefile` VARCHAR(128) NOT NULL PRIMARY KEY ,\n\t\t`category` VARCHAR(40) NOT NULL,\n\t\t`enabled` smallint(1) NOT NULL DEFAULT 0,\n\t\tINDEX ( `category`),\n\t\tINDEX ( `enabled`)\n\t\t)";
$q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
echo $q->mysql_error . "\n";
}
}
if ($q->COUNT_ROWS("suricata_rules_packages", "artica_backup") == 0) {
$sql = "INSERT IGNORE INTO suricata_rules_packages (rulefile,enabled,category) VALUES \n\t\t\t\t('botcc.rules',0,'DMZ'),('ciarmy.rules',0,'DMZ'),('compromised.rules','0','DMZ'),\n\t\t\t\t('drop.rules',1,'DMZ'),\n\t\t\t\t('dshield.rules',1,'DMZ'),('snort.rules',1,'ALL'),\n\t\t\t\t('emerging-activex.rules',1,'WEB'),\n\t\t\t\t('emerging-attack_response.rules',1,'ALL'),\n\t\t\t\t('emerging-chat.rules',0,'WEB'),\n\t\t\t\t('emerging-current_events.rules',0,'ALL'),\n\t\t\t\t('emerging-dns.rules',0,'DMZ'),\n\t\t\t\t('emerging-dos.rules',0,'DMZ'),\n\t\t\t\t('emerging-exploit.rules',0,'DMZ'),\n\t\t\t\t('emerging-ftp.rules',0,'DMZ'),\n\t\t\t\t('emerging-games.rules',0,'ALL'),\n\t\t\t\t('emerging-icmp_info.rules',0,'ALL'),\n\t\t\t\t('emerging-icmp.rules',0,'ALL'),\n\t\t\t\t('emerging-imap.rules',0,'DMZ'),\n\t\t\t\t('emerging-inappropriate.rules',0,'WEB'),\n\t\t\t\t('emerging-malware.rules',1,'WEB'),\n\t\t\t\t('emerging-mobile_malware.rules',0,'WEB'),\n\t\t\t\t('emerging-netbios.rules',0,'ALL'),\n\t\t\t\t('emerging-p2p.rules',0,'WEB'),\n\t\t\t\t('emerging-policy.rules',1,'WEB'),\n\t\t\t\t('emerging-pop3.rules',0,'DMZ'),\n\t\t\t\t('emerging-rpc.rules',0,'ALL'),\n\t\t\t\t('emerging-scada.rules',0,'ALL'),\n\t\t\t\t('emerging-scan.rules',1,'ALL'),\n\t\t\t\t('emerging-shellcode.rules',1,'ALL'),\n\t\t\t\t('emerging-smtp.rules',0,'DMZ'),\n\t\t\t\t('emerging-snmp.rules',0,'ALL'),\n\t\t\t\t('emerging-sql.rules',0,'ALL'),\n\t\t\t\t('emerging-telnet.rules',0,'ALL'),\n\t\t\t\t('emerging-tftp.rules',0,'ALL'),\n\t\t\t\t('emerging-trojan.rules',1,'ALL'),\n\t\t\t\t('emerging-user_agents.rules',0,'ALL'),\n\t\t\t\t('emerging-voip.rules',0,'ALL'),\n\t\t\t\t('emerging-web_client.rules',1,'HTTP'),\n\t\t\t\t('emerging-web_server.rules',0,'HTTP'),\n\t\t\t\t('emerging-web_specific_apps.rules',0,'HTTP'),\n\t\t\t\t('emerging-worm.rules',1,'ALL'),\n\t\t\t\t('tor.rules',0,'ALL'),\n\t\t\t\t('decoder-events.rules',0,'ALL'),\n\t\t\t\t('stream-events.rules',0,'ALL'),\n\t\t\t\t('http-events.rules',0,'HTTP'),\n\t\t\t\t('smtp-events.rules',0,'DMZ'),\n\t\t\t\t('dns-events.rules',0,'DMZ'),\n\t\t\t\t('tls-events.rules',0,'DMZ')";
$q->QUERY_SQL($sql, 'artica_backup');
}
$apply = $tpl->javascript_parse_text("{apply}");
$buttons = "\n\tbuttons : [\n\t\n\t{name: '<strong style=font-size:18px>{$apply}</strong>', bclass: 'Apply', onpress : Apply{$t}},\n\t],";
$html = "\n\t\n\t\n\t<table class='TABLE_SURICATA_MAIN_RULES' style='display: none' id='TABLE_SURICATA_MAIN_RULES'\n\tstyle='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\tvar md5H='';\n\t\$('#TABLE_SURICATA_MAIN_RULES').flexigrid({\n\turl: '{$page}?list=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t\n\t{display: '<span style=font-size:22px>{$rulename}</span>', name : 'rulefile', width : 300, sortable : true, align: 'left'},\n\t{display: '<span style=font-size:22px>{$category}</span>', name : 'category', width : 156, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:22px>{$explain}</span>', name : 'none', width : 833, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:22px>{$enabled}</span>', name : 'enabled', width : 105, sortable : true, align: 'center'},\n\n\t],\n\t{$buttons}\nsearchitems : [\n\t\t{display: '{$rulename}', name : 'rulefile'},\n\t\t{display: '{$category}', name : 'category'},\n\t\t\n\n\t],\t\n\tsortname: 'rulefile',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});\n\t});\n\t\n\t\nfunction Add{$t}(){\n\tLoadjs('{$page}?add-interface-js=yes&t={$t}');\n}\nvar xSuricataRuleEnabled= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);return;}\n\t\$('#TABLE_SURICATA_MAIN_RULES').flexReload();\n}\n\t\nfunction SuricataRuleEnabled(filename){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('filename',filename);\n\tXHR.sendAndLoad('{$page}', 'POST',xSuricataRuleEnabled);\n}\nfunction Apply{$t}(){\n\tLoadjs('suricata.progress.php');\n}\n</script>\n\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例4: status
function status()
{
$tpl = new templates();
$page = CurrentPageName();
$script = null;
if (is_file("ressources/logs/global.status.ini")) {
$ini = new Bs_IniHandler("ressources/logs/global.status.ini");
} else {
writelogs("ressources/logs/global.status.ini no such file");
$sock = new sockets();
$datas = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
$ini = new Bs_IniHandler($datas);
}
$sock = new sockets();
$datas = $sock->getFrameWork('cmd.php?refresh-status=yes');
$status = DAEMON_STATUS_ROUND("CLAMAV", $ini, null, 1);
$q = new mysql();
if ($q->TABLE_EXISTS("clamd_mem", "artica_events")) {
if ($q->COUNT_ROWS("clamd_mem", "artica_events") > 1) {
$script = "LoadAjax('clamd-graphs','{$page}?clamd-graphs=yes');";
}
}
$html = "\n\t<div style='width:100%'>{$status}</div>\n\t<center style='margin-top:10px' id='clamd-graphs'></center>\n\t\n\t<script>\n\t\t{$script}\n\t</script>\n\t\n\t";
echo $tpl->_ENGINE_parse_body($html);
}
示例5: BuildDayTable
function BuildDayTable()
{
$q = new mysql();
$q->BuildTables();
if (!$q->TABLE_EXISTS('smtp_logs_day', 'artica_events')) {
send_email_events("Mysql error on smtp_logs_day table", "Artica was unable to create or detect smtp_logs_day table...", "system");
return false;
}
$today = date('Y-m-d');
$sql = "SELECT COUNT(id) as tcount,delivery_domain,DATE_FORMAT(time_stamp,'%Y-%m-%d') as tdate,bounce_error FROM \n\tsmtp_logs \n\tGROUP BY delivery_domain,tdate,bounce_error HAVING tdate<'{$today}' ORDER BY tdate DESC";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
echo "Wrong sql query {$q->mysql_error}\n";
write_syslog("Wrong sql query {$q->mysql_error}", __FILE__);
return false;
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
$count = $count + 1;
$emails = $ligne["tcount"];
$delivery_domain = $ligne["delivery_domain"];
$date = $ligne["tdate"];
$bounce_error = $ligne["bounce_error"];
$md5 = md5($delivery_domain . $date . $bounce_error . $emails);
$sql = "INSERT INTO smtp_logs_day (`key`,`day`,`delivery_domain`,`bounce_error`,`emails`)\n\t\tVALUES('{$md5}','{$date}','{$delivery_domain}','{$bounce_error}','{$emails}')";
$q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
echo "Wrong sql query {$q->mysql_error}\n";
write_syslog("Wrong sql query \"{$sql}\" {$q->mysql_error}", __FILE__);
return false;
}
}
return true;
}
示例6: js_tabs
function js_tabs()
{
$page = CurrentPageName();
if ($_GET["servername"] != null) {
$q = new mysql();
$table_name = $q->APACHE_TABLE_NAME($_GET["servername"]);
if ($q->TABLE_EXISTS($table_name, "apachelogs")) {
$array["statistics"] = '{statistics}';
}
$table_name = "apache_stats_" . date('Ym');
$sql = "SELECT COUNT(servername) as tcount FROM {$table_name} WHERE servername='{$_GET["servername"]}'";
if ($q->mysql_error) {
if (!preg_match("#doesn.+?t exist#", $q->mysql_error)) {
echo "<H2>{$q->mysql_error}</H2>";
}
} else {
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
}
if ($ligne["tcount"] > 0) {
$array["today"] = "{last_24h}";
}
}
$font = 18;
while (list($num, $ligne) = each($array)) {
$html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\"><span span style='font-size:{$font}px'>{$ligne}</span></a></li>\n");
}
echo build_artica_tabs($html, "main_config_freewebstatus");
}
示例7: fixdb
function fixdb()
{
$q = new mysql();
if (!$q->TABLE_EXISTS('Profile', 'obm2')) {
write_syslog("Create Profile table in obm2 database", __FILE__);
$sql = "CREATE TABLE `Profile` (\n\t `profile_id` int(8) NOT NULL auto_increment,\n\t `profile_domain_id` int(8) NOT NULL,\n\t `profile_timeupdate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n\t `profile_timecreate` timestamp NOT NULL default '0000-00-00 00:00:00',\n\t `profile_userupdate` int(8) default NULL,\n\t `profile_usercreate` int(8) default NULL,\n\t `profile_name` varchar(64) default NULL,\n\t PRIMARY KEY (`profile_id`)\n\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "obm2");
}
if (!$q->TABLE_EXISTS('ProfileModule', 'obm2')) {
write_syslog("Create ProfileModule table in obm2 database", __FILE__);
$sql = "CREATE TABLE `ProfileModule` (\n\t `profilemodule_id` int(8) NOT NULL auto_increment,\n\t `profilemodule_domain_id` int(8) NOT NULL,\n\t `profilemodule_profile_id` int(8) default NULL,\n\t `profilemodule_module_name` varchar(64) NOT NULL default '',\n\t `profilemodule_right` int(2) default NULL,\n\t PRIMARY KEY (`profilemodule_id`),\n\t KEY `profilemodule_profile_id_profile_id_fkey` (`profilemodule_profile_id`),\n\t CONSTRAINT `profilemodule_profile_id_profile_id_fkey` FOREIGN KEY (`profilemodule_profile_id`) REFERENCES `Profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE\n\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "obm2");
}
if (!$q->TABLE_EXISTS('ProfileModule', 'obm2')) {
write_syslog("Create ProfileModule table in obm2 database", __FILE__);
$sql = "\n\t\tCREATE TABLE `ProfileProperty` (\n\t\t `profileproperty_id` int(8) NOT NULL auto_increment,\n\t\t `profileproperty_profile_id` int(8) default NULL,\n\t\t `profileproperty_name` varchar(32) NOT NULL default '',\n\t\t `profileproperty_value` text NOT NULL,\n\t\t PRIMARY KEY (`profileproperty_id`),\n\t\t KEY `profileproperty_profile_id_profile_id_fkey` (`profileproperty_profile_id`),\n\t\t CONSTRAINT `profileproperty_profile_id_profile_id_fkey` FOREIGN KEY (`profileproperty_profile_id`) REFERENCES `Profile` (`profile_id`) ON DELETE CASCADE ON UPDATE CASCADE\n\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
$q->QUERY_SQL($sql, "obm2");
}
}
示例8: CheckTables
function CheckTables()
{
$q = new mysql();
$tables = array("accesslog", "accountinfo", "bios", "blacklist_macaddresses", "blacklist_serials", "config", "conntrack", "controllers", "deleted_equiv", "deploy", "devices", "devicetype", "dico_ignored", "dico_soft", "download_affect_rules", "download_available", "download_enable", "download_history", "download_servers", "drives", "engine_mutex", "engine_persistent", "files", "groups", "groups_cache", "hardware", "hardware_osname_cache", "inputs", "javainfo", "locks", "memories", "modems", "monitors", "netmap", "networks", "network_devices", "operators", "ports", "printers", "prolog_conntrack", "regconfig", "registry", "registry_name_cache", "registry_regvalue_cache", "slots", "softwares", "softwares_name_cache", "sounds", "storages", "subnet", "tags", "videos", "virtualmachines");
while (list($num, $table) = each($tables)) {
if (!$q->TABLE_EXISTS($table, "ocsweb")) {
return false;
}
}
return true;
}
示例9: popup
function popup()
{
$uid = $_GET["uid"];
$t = $_GET["t"];
$sql = "SELECT script_code FROM logon_scriptsusers WHERE uid='{$uid}'";
$q = new mysql();
if (!$q->TABLE_EXISTS("logon_scriptsusers", "artica_backup")) {
$q->BuildTables();
}
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$ligne["script_code"] = base64_decode($ligne["script_code"]);
$_POST["script_data"] = str_replace("\n\n", "\n", $_POST["script_data"]);
$html = "\n\t<div style='font-size:13px' class=explain>{LOGON_SCRIPT_TEXT}<br>\n\t{LOGON_SCRIPT_PUT}</div>\n\t<div style='float:right;margin-bottom:8px;'>" . imgtootltip("delete-32.png", "{delete}", "LOGON_SCRIPT_DEL{$t}()") . "</div>\n\t<textarea id='script_code{$t}' style='width:100%;height:350px;overflow:auto; font-family: \"Courier New\", Courier, monospace;padding:3px'>" . $ligne["script_code"] . "</textarea>\n\t<div style='text-align:right'><hr>" . button("{apply}", "LOGON_SCRIPT_SAVE{$t}()", "18px") . "</div>";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例10: migrate
function migrate()
{
$q = new mysql();
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pidtime = "/etc/artica-postfix/pids/exec.suricata.hourly.migrate.time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
echo "Starting......: " . date("H:i:s") . " [INIT]: Already Artica task running PID {$pid} since {$time}mn\n";
return;
}
@file_put_contents($pidfile, getmypid());
$timeExec = $unix->file_time_min($pidtime);
if ($timeExec < 60) {
return;
}
@unlink($pidtime);
@file_put_contents($pidtime, time());
$hostname = $unix->hostname_g();
if (!$q->TABLE_EXISTS("suricata_events", "artica_events")) {
return;
}
$results = $q->QUERY_SQL("SELECT * FROM suricata_events", "artica_events");
$postgres = new postgres_sql();
$postgres->suricata_tables();
while ($ligne = mysql_fetch_assoc($results)) {
$src_ip = $ligne["src_ip"];
$zDate = $ligne["zDate"];
$dst_ip = $ligne["dst_ip"];
$dst_port = $ligne["dst_port"];
$proto = $ligne["proto"];
$signature = $ligne["signature"];
$xcount = $ligne["xcount"];
$severity = $ligne["severity"];
$f[] = "('{$zDate}','{$src_ip}','{$dst_ip}','{$proto}','{$dst_port}','{$signature}','{$severity}','{$xcount}','{$hostname}')";
}
if (count($f) > 0) {
$prefix = "INSERT INTO suricata_events (zDate,src_ip,dst_ip,proto,dst_port,signature,severity,xcount,proxyname) VALUES ";
$postgres->QUERY_SQL($prefix . @implode(",", $f));
if (!$postgres->ok) {
return;
}
$q->QUERY_SQL("DROP TABLE suricata_events", "artica_events");
}
}
示例11: main_table
function main_table()
{
$t = time();
$page = CurrentPageName();
$tpl = new templates();
$users = new usersMenus();
$sock = new sockets();
$q = new mysql();
if (!$q->TABLE_EXISTS("sender_dependent_relay_host", "artica_backup")) {
$q->BuildTables();
}
if ($_GET["hostname"] == null) {
$_GET["hostname"] = "master";
}
$t = time();
$domain = $tpl->_ENGINE_parse_body("{sender_domain_email}");
$are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}");
$relay = $tpl->javascript_parse_text("{relay}");
$MX_lookups = $tpl->javascript_parse_text("{MX_lookups}");
$delete = $tpl->javascript_parse_text("{delete}");
$InternetDomainsAsOnlySubdomains = $sock->GET_INFO("InternetDomainsAsOnlySubdomains");
if (!is_numeric($InternetDomainsAsOnlySubdomains)) {
$InternetDomainsAsOnlySubdomains = 0;
}
$add_local_domain_form_text = $tpl->javascript_parse_text("{add_local_domain_form}");
$add_local_domain = $tpl->_ENGINE_parse_body("{add_local_domain}");
$sender_dependent_relayhost_maps_title = $tpl->_ENGINE_parse_body("{sender_dependent_relayhost_maps_title}");
$ouescape = urlencode($ou);
$networks = $tpl->javascript_parse_text("{networks}");
$hostname = $_GET["hostname"];
$apply = $tpl->javascript_parse_text("{apply}");
$about2 = $tpl->javascript_parse_text("{about2}");
$title = $tpl->javascript_parse_text("{smtpd_sasl_exceptions_networks_text}");
$add_sender_routing_rule = $tpl->_ENGINE_parse_body("{add_new_network}");
$explain = $tpl->javascript_parse_text("{smtpd_sasl_exceptions_networks_explain}");
$give_the_new_network = $tpl->javascript_parse_text("{give the new network}");
$buttons = "\n\tbuttons : [\n\t{name: '{$add_sender_routing_rule}', bclass: 'add', onpress : newrule{$t}},\n\t{name: '{$apply}', bclass: 'recycle', onpress : apply{$t}},\n\t{name: '{$about2}', bclass: 'help', onpress : Help{$t}},\n\t],";
$html = "\n\t<input type='hidden' id='ou' value='{$ou}'>\n\t<table class='SMTP_SASL_EXCEPT_TABLE' style='display: none' id='SMTP_SASL_EXCEPT_TABLE' style='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#SMTP_SASL_EXCEPT_TABLE').flexigrid({\n\turl: '{$page}?list=yes&hostname={$hostname}&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$networks}', name : 'domain', width : 749, sortable : true, align: 'left'},\n\t{display: '{$delete};', name : 'delete', width : 90, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$domain}', name : 'domain'},\n\t],\n\tsortname: 'domain',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:16px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: '550',\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n});\n\nfunction Help{$t}(){\nalert('{$explain}');\n}\n\nvar xnewrule{$t}= function (obj) {\n\t\$('#SMTP_SASL_EXCEPT_TABLE').flexReload();\n\n}\n\t\t\n\n\nfunction newrule{$t}(){\n\tvar a=prompt('{$give_the_new_network}');\n\tif(!a){\n\t\treturn;\n\t}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('smtpd_sasl_exceptions_networks_add',a);\n\tXHR.sendAndLoad('{$page}', 'GET',xnewrule{$t});\n}\n\t\nfunction apply{$t}(){\n\tLoadjs('postfix.sasl.progress.php');\n}\n\nfunction smtpd_sasl_exceptions_delete(id_encrypted){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('smtpd_sasl_exceptions_networks_del',id_encrypted);\n\tXHR.sendAndLoad('{$page}', 'GET', xnewrule{$t});\n}\n\n</script>\n";
echo $html;
}
示例12: Save
function Save()
{
$q = new mysql();
if (!$q->TABLE_EXISTS("iptables_webint", "artica_backup")) {
$sql = "CREATE TABLE IF NOT EXISTS `artica_backup`.`iptables_webint` (\n\t\t\t\t`ID` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\t`pattern` VARCHAR(128) NOT NULL,\n\t\t\t\t UNIQUE KEY `pattern` (`pattern`)\n\t\t\t\t) ENGINE=MYISAM;";
$q->QUERY_SQL($sql, 'artica_backup');
if (!$q->ok) {
echo "{$q->mysql_error}";
}
}
if ($_POST["ipaddr"] != null) {
$q->QUERY_SQL("INSERT IGNORE INTO `iptables_webint` (`pattern`) VALUES('{$_POST["ipaddr"]}')", 'artica_backup');
if (!$q->ok) {
echo "{$q->mysql_error}";
}
}
if ($_POST["cdir"] != null) {
$q->QUERY_SQL("INSERT IGNORE INTO `iptables_webint` (`pattern`) VALUES('{$_POST["cdir"]}')", 'artica_backup');
if (!$q->ok) {
echo "{$q->mysql_error}";
}
}
}
示例13: popup
function popup()
{
$infos = infos();
$sock = new sockets();
$page = CurrentPageName();
$alx = $sock->getFrameWork("system.php?modinfo=alx");
$ModeProbeAlx = intval($sock->GET_INFO("ModeProbeAlx"));
$q = new mysql();
$DIVS = array();
$js = array();
if ($q->TABLE_EXISTS("RXTX_HOUR", "artica_events")) {
$results = $q->QUERY_SQL("SELECT ETH FROM RXTX_HOUR GROUP BY ETH", "artica_events");
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$ETH = $ligne["ETH"];
$nic = new system_nic($ETH);
$DIVS[] = "<hr><div style='font-size:30px;margin-top:20px'>{$ETH} [{$nic->IPADDR}] - {$nic->NICNAME} - {$nic->netzone}</div>";
$DIVS[] = "<div style='width:1460px;height:350px' id='{$ETH}-RX-hour' class=form></div>";
$DIVS[] = "<div style='width:1460px;height:350px' id='{$ETH}-TX-hour' class=form></div>";
$DIVS[] = "<div style='width:1460px;height:350px' id='{$ETH}-RX-week' class=form></div>";
$DIVS[] = "<div style='width:1460px;height:350px' id='{$ETH}-TX-week' class=form></div>";
$js[] = "Loadjs('{$page}?eth-hour=yes&type=RXÐ={$ETH}')";
$js[] = "Loadjs('{$page}?eth-hour=yes&type=TXÐ={$ETH}')";
$js[] = "Loadjs('{$page}?eth-week=yes&type=RXÐ={$ETH}')";
$js[] = "Loadjs('{$page}?eth-week=yes&type=TXÐ={$ETH}')";
}
}
$t = time();
if ($alx == "TRUE") {
$alxform = Paragraphe_switch_img("{qualcomm_atheros}", "{qualcomm_atheros_explain}", "ModeProbeAlx", $ModeProbeAlx, null, 1450);
} else {
$alxform = Paragraphe_switch_disable("{qualcomm_atheros}", "{qualcomm_atheros_explain}", "ModeProbeAlx", 0, null, 1450);
}
//$gateway=Paragraphe('relayhost.png','{APP_ARTICA_GAYTEWAY}','{APP_ARTICA_GAYTEWAY_TEXT}',"javascript:Loadjs('index.gateway.php?script=yes')");
$html = "\n\t<div style='width:98%' class=form>\n\t{$alxform}\t\t\n\t{$gateway}\n\t<div style='margin-top:20px;text-align:right'><hr>" . button("{apply}", "Save{$t}()", 32) . "</div>\n\t</div>\n\t\n\t<div style='width:98%' class=form>\n\t<div style='font-size:26px;font-weight:bold'>{network_hardware_infos_text}</div>\n\t<br>\n\t<div style='width:98%;height:300px;overflow:auto;'>{$infos}</div>\n\t</div>\n\t" . @implode("\n", $DIVS) . "\n<script>\nvar xSave{$t}=function (obj) {\n\tLoadjs('network.restart.php');\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ModeProbeAlx',document.getElementById('ModeProbeAlx').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n" . @implode("\n", $js) . "\n</script>\t\n\t";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例14: content
function content()
{
$q = new mysql();
$tpl = new templates();
$t = time();
$page = CurrentPageName();
if (!$q->TABLE_EXISTS("records", "powerdns")) {
echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{error_missing_tables_click_to_repair}") . "\n\t\t<hr>\n\t\t<center id='{$t}'>" . button("{repair}", "RepairPDNSTables()", "22px") . "</center>\n\t\t<script>\n\tvar x_RepairPDNSTables=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tMyHref('{$page}');\n\t}\n\tfunction RepairPDNSTables(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('RepairPDNSTables','yes');\n\t\tAnimateDiv('{$t}');\n\t\tXHR.sendAndLoad('pdns.mysql.php', 'POST',x_RepairPDNSTables);\n\t}\n\t</script>\n\t");
return;
}
$sock = new sockets();
$boot = new boostrap_form();
$button = button("{new_item}", "NewPDNSEntry2()", 16);
$SearchQuery = $boot->SearchFormGen("name,content,explainthis", "search-records");
$EnablePDNS = $sock->GET_INFO("EnablePDNS");
if (!is_numeric($EnablePDNS)) {
$EnablePDNS = 0;
}
if ($EnablePDNS == 0) {
$error = "<div class=text-infoWarn>{EnablePDNS_disable_text}</div>";
}
$html = "\n\t {$error}\n\t <table style='width:100%'>\n\t <tr>\n\t <td>{$button}</td>\n\t <td></td>\n\t </tr>\n\t </table>\n\t {$SearchQuery}\n\t <script>\n\t \tExecuteByClassName('SearchFunction');\n\t </script>\n\t ";
echo $tpl->_ENGINE_parse_body($html);
}
示例15: smtpd_client_restrictions_popup
function smtpd_client_restrictions_popup()
{
$ou = $_GET["ou"];
$sock = new sockets();
$users = new usersMenus();
$q = new mysql();
if (!$q->TABLE_EXISTS("smptd_client_access", "artica_backup")) {
$q->check_storage_table(true);
}
$sql = "SELECT `configuration` FROM smptd_client_access WHERE `ou`='{$ou}'";
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
if (!$q->ok) {
echo $q->mysql_error_html();
die;
}
$MAIN = unserialize(base64_decode($ligne["configuration"]));
$reject_unknown_client_hostname = $MAIN['reject_unknown_client_hostname'];
$reject_unknown_reverse_client_hostname = $MAIN['reject_unknown_reverse_client_hostname'];
$reject_unknown_sender_domain = $MAIN['reject_unknown_sender_domain'];
$reject_invalid_hostname = $MAIN['reject_invalid_hostname'];
$reject_non_fqdn_sender = $MAIN['reject_non_fqdn_sender'];
$disable_vrfy_command = $MAIN['disable_vrfy_command'];
$enforce_helo_restrictions = intval($MAIN['enforce_helo_restrictions']);
if (!$users->POSTFIX_PCRE_COMPLIANCE) {
$EnableGenericrDNSClients = 0;
$EnableGenericrDNSClientsDisabled = 1;
$EnableGenericrDNSClientsDisabledText = "<br><i><span style='color:#d32d2d;font-size:11px'>{EnableGenericrDNSClientsDisabledText}</span></i>";
}
$t = time();
$page = CurrentPageName();
$html = "\n\n\n\n\t\n\t<div style='font-size:30px;margin-bottom:50px'>{safety_standards}</div>\n\t<div class=explain style='font-size:18px'>{smtpd_client_restrictions_text}</div>\n\t<div id='smtpd_client_restrictions_div' style='width:98%' class=form>\n\t" . Paragraphe_switch_img("{reject_unknown_client_hostname}", "{reject_unknown_client_hostname_text}", "reject_unknown_client_hostname-{$t}", $reject_unknown_client_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_unknown_reverse_client_hostname}", "{reject_unknown_reverse_client_hostname_text}", "reject_unknown_reverse_client_hostname-{$t}", $reject_unknown_reverse_client_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_unknown_sender_domain}", "{reject_unknown_sender_domain_text}", "reject_unknown_sender_domain-{$t}", $reject_unknown_sender_domain, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_invalid_hostname}", "{reject_invalid_hostname_text}", "reject_invalid_hostname-{$t}", $reject_invalid_hostname, null, 1400) . "\n\t" . Paragraphe_switch_img("{reject_non_fqdn_sender}", "{reject_non_fqdn_sender_text}", "reject_non_fqdn_sender-{$t}", $reject_non_fqdn_sender, null, 1400) . "\n\t</table>\n\t</div>\n\n\t<div style='width:100%;text-align:right'><hr>\n\t" . button("{apply}", "Save{$t}()", 45) . "\n\t\n\t</div>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ou','{$ou}');\n\t\tXHR.appendData('reject_unknown_client_hostname',document.getElementById('reject_unknown_client_hostname-{$t}').value);\n\t\tXHR.appendData('reject_unknown_reverse_client_hostname',document.getElementById('reject_unknown_reverse_client_hostname-{$t}').value);\n\t\tXHR.appendData('reject_unknown_sender_domain',document.getElementById('reject_unknown_sender_domain-{$t}').value);\n\t\tXHR.appendData('reject_invalid_hostname',document.getElementById('reject_invalid_hostname-{$t}').value);\n\t\tXHR.appendData('reject_non_fqdn_sender',document.getElementById('reject_non_fqdn_sender-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'GET',xSave{$t});\t\n\t}\n</script>\t\t\t\n\t";
//smtpd_client_connection_rate_limit = 100
//smtpd_client_recipient_rate_limit = 20
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html, "postfix.index.php");
}