本文整理汇总了PHP中mysql::QUERY_SQL方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::QUERY_SQL方法的具体用法?PHP mysql::QUERY_SQL怎么用?PHP mysql::QUERY_SQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::QUERY_SQL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: popup_list
function popup_list()
{
include_once 'ressources/class.freeweb.inc';
$MyPage = CurrentPageName();
$tpl = new templates();
$data = array();
$data['page'] = 1;
$data['total'] = 0;
$data['rows'] = array();
$t = $_GET["t"];
$sql = "SELECT datasbackup FROM backup_schedules WHERE ID='{$_GET["ID"]}'";
$q = new mysql();
$ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$ressources = unserialize(base64_decode($ligne["datasbackup"]));
$c = 0;
if (is_array($ressources)) {
while (list($num, $val) = each($ressources)) {
if (is_array($val)) {
continue;
}
$val = str_replace("all", "{BACKUP_ALL_MEANS}", $val);
if (preg_match("#MYSQLINSTANCE:([0-9]+)#", $val, $re)) {
$sql = "SELECT servername FROM mysqlmulti WHERE ID={$re[1]}";
$ligne2 = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$MysqlInstanceName = $ligne2["servername"];
$val = "{mysql_instance_databases} «{$MysqlInstanceName}»";
}
if (preg_match("#FREEWEB:(.+)#", $val, $re)) {
$free = new freeweb($re[1]);
$val = "{website} «{$re[1]}»";
}
if (preg_match("#WEBGET:(.+)#", $val, $re)) {
$arr = unserialize(base64_decode($re[1]));
if ($arr["AutoRestore"] == 1) {
$AutorestoreText = " {and} {auto-restore} {to} {$arr["AutoRestoreSiteName"]}";
}
$val = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('backup.sources.WebGet.php?taskid={$_GET["ID"]}&index={$num}');\"\n\t\t\tstyle='text-decoration:underline;font-weight:bold'>WebGET {remote_artica_server} «{$arr["RemoteArticaSite"]}»</a><br>{from}: «{$arr["RemoteArticaServer"]}»{$AutorestoreText}";
}
$val = $tpl->_ENGINE_parse_body($val);
$c++;
$data['rows'][] = array('id' => $num, 'cell' => array("<STRONG style='font-size:14px'>{$num}</STRONG>", "<code style='font-size:14px;font-weight:bold'>{$val}</code>", imgsimple("delete-24.png", "{delete}", "DELETE_BACKUP_SOURCES{$t}({$_GET["ID"]},{$num})")));
}
}
$folder = $tpl->_ENGINE_parse_body("{folder}");
$sql = "SELECT * FROM backup_folders WHERE taskid={$_GET["ID"]}";
$results = $q->QUERY_SQL($sql, "artica_backup");
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$c++;
if ($ligne["recursive"] == 1) {
$ligne["recursive"] = "{enabled}";
} else {
$ligne["recursive"] = "{disabled}";
}
$ligne["recursive"] = $tpl->_ENGINE_parse_body($ligne["recursive"]);
$id = md5(base64_decode($ligne["path"]));
$data['rows'][] = array('id' => $id, 'cell' => array("<STRONG style='font-size:14px'>{$folder} ({$ligne["recursive"]})</STRONG>", "<code style='font-size:14px;font-weight:bold'><code>" . base64_decode($ligne["path"]) . "</code></code>", " "));
}
$data['total'] = $c;
echo json_encode($data);
}
示例2: time_save
function time_save()
{
$ID = $_POST["time-save"];
$array_days = array(1 => "monday", 2 => "tuesday", 3 => "wednesday", 4 => "thursday", 5 => "friday", 6 => "saturday", 7 => "sunday");
while (list($num, $maks) = each($array_days)) {
if ($_POST["D{$num}"] == 1) {
$TTIME["D{$num}"] = 1;
}
}
$TTIME["ttime"] = $_POST["ttime"];
$TTIME["ftime"] = $_POST["ftime"];
$rule1 = strtotime(date("Y-m-d") . " {$TTIME["ftime"]}");
$rule2 = strtotime(date("Y-m-d") . " {$TTIME["ttime"]}");
if ($rule1 > $rule2) {
$tpl = new templates();
echo $tpl->javascript_parse_text("{fwtime_explain}");
return;
}
$TTIMEZ = mysql_escape_string2(serialize($TTIME));
$q = new mysql();
if (!$q->FIELD_EXISTS("iptables_main", "time_restriction", "artica_backup")) {
$sql = "ALTER TABLE `iptables_main` ADD `time_restriction` TEXT";
$q->QUERY_SQL($sql, "artica_backup");
}
if (!$q->FIELD_EXISTS("iptables_main", "enablet", "artica_backup")) {
$sql = "ALTER TABLE `iptables_main` ADD `enablet` smallint( 1 ) NOT NULL DEFAULT '0',ADD INDEX ( enablet ) ";
$q->QUERY_SQL($sql, "artica_backup");
}
$sql = "UPDATE iptables_main SET `enablet`='{$_POST["enablet"]}',`time_restriction`='{$TTIMEZ}' WHERE ID='{$ID}'";
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo $q->mysql_error . "\n{$sql}";
}
}
示例3: ActionItem
function ActionItem()
{
$servicename = $_GET["servicename"];
$selected = $_GET["selected"];
$t = $_GET["t"];
$q = new mysql();
$ARRAY = array();
if ($selected == 1) {
$sql = "SELECT ID,groupname FROM haproxy_backends_groups WHERE servicename='{$servicename}'";
$results = $q->QUERY_SQL($sql, 'artica_backup');
while ($ligne = mysql_fetch_assoc($results)) {
$ARRAY[$ligne["ID"]] = $ligne["groupname"];
}
echo field_array_Hash($ARRAY, "rule_action_data-{$t}", $_GET["rule_action_data"], "blur()", null, 0, "font-size:22px", false);
return;
}
if ($selected == 2) {
$sql = "SELECT ID,backendname FROM haproxy_backends WHERE servicename='{$servicename}'";
$results = $q->QUERY_SQL($sql, 'artica_backup');
while ($ligne = mysql_fetch_assoc($results)) {
$ARRAY[$ligne["ID"]] = $ligne["backendname"];
}
echo field_array_Hash($ARRAY, "rule_action_data-{$t}", $_GET["rule_action_data"], "blur()", null, 0, "font-size:22px", false);
return;
}
if ($selected == 3) {
$ARRAY[null] = "{deny}";
echo field_array_Hash($ARRAY, "rule_action_data-{$t}", $_GET["rule_action_data"], "blur()", null, 0, "font-size:22px", false);
}
}
示例4: 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;
}
}
示例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 IGNORE 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: create_user_from_mysql
function create_user_from_mysql()
{
$q = new mysql();
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
ini_set('error_prepend_string', null);
ini_set('error_append_string', null);
$GLOBALS["WAIT"] = true;
build_progress("{start}", 10);
$results = $q->QUERY_SQL("SELECT * FROM CreateUserQueue", "artica_backup");
if (!$q->ok) {
echo $q->mysql_error;
build_progress("MySQL error", 110);
return;
}
@mkdir("/usr/share/artica-postfix/ressources/logs/web/create-users", 0755, true);
echo mysql_num_rows($results) . " member(s) to create...\n";
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$zMD5 = $ligne["zMD5"];
$content = $ligne["content"];
@file_put_contents("/usr/share/artica-postfix/ressources/logs/web/create-users/{$zMD5}", $content);
if (create_user($zMD5)) {
build_progress("{removing_order}", 95);
$q->QUERY_SQL("DELETE FROM `CreateUserQueue` WHERE `zMD5`='{$zMD5}'", "artica_backup");
} else {
$q->QUERY_SQL("DELETE FROM `CreateUserQueue` WHERE `zMD5`='{$zMD5}'", "artica_backup");
build_progress("{failed}", 110);
return;
}
}
build_progress("{done}", 100);
}
示例7: STREAM_LINE
function STREAM_LINE()
{
$sock = new sockets();
$EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
if (!is_numeric($EnableWebProxyStatsAppliance)) {
$EnableWebProxyStatsAppliance = 0;
}
if ($EnableWebProxyStatsAppliance == 0) {
writelogs("EnableWebProxyStatsAppliance={$EnableWebProxyStatsAppliance} from " . $_SERVER["REMOTE_ADDR"] . " (aborting)", __FUNCTION__, __FILE__, __LINE__);
die;
}
$q = new mysql();
$sql = base64_decode($_POST["STREAM_LINE"]);
$q->BuildTables();
$hostname = $_POST["HOSTNAME"];
$q->QUERY_SQL("DELETE FROM youtubecache WHERE proxyname='{$hostname}'", "artica_events");
$q->QUERY_SQL($sql, "artica_events");
if ($sql == null) {
return;
}
if (!$q->QUERY_SQL($sql, "artica_events")) {
writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " ({$_POST["HOSTNAME"]}) (failed)", __FUNCTION__, __FILE__, __LINE__);
writelogs("Mysql error: `{$q->mysql_error}`", __FUNCTION__, __FILE__, __LINE__);
writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__);
writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__);
echo "{$q->mysql_error}\n";
die;
}
writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " (success)", __FUNCTION__, __FILE__, __LINE__);
echo "<ANSWER>OK</ANSWER>\n";
}
示例8: SAVE_SCRIPT
function SAVE_SCRIPT()
{
$gpid = $_POST["gpid"];
$_POST["script_data"] = stripslashes($_POST["script_data"]);
$_POST["script_data"] = str_replace("\n\n", "\n", $_POST["script_data"]);
$datas = base64_encode($_POST["script_data"]);
$sql = "SELECT gpid FROM logon_scripts WHERE gpid={$gpid}";
$q = new mysql();
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$sql_edit = "UPDATE logon_scripts SET script_code='{$datas}' WHERE gpid={$gpid}";
$sql_add = "INSERT INTO logon_scripts(gpid,script_code) VALUES({$gpid},'{$datas}');";
if ($ligne["gpid"] == null) {
$sql = $sql_add;
} else {
$sql = $sql_edit;
}
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo $q->mysql_error;
} else {
$tpl = new templates();
echo $tpl->javascript_parse_text("{success}");
$sock = new sockets();
$sock->getFrameWork("cmd.php?smb-logon-scripts=yes");
}
}
示例9: SAVE_SCRIPT
function SAVE_SCRIPT()
{
$uid = $_POST["uid"];
$_POST["script_data"] = url_decode_special_tool($_POST["script_data"]);
$_POST["script_data"] = str_replace("\n\n", "\n", $_POST["script_data"]);
$datas = base64_encode($_POST["script_data"]);
$sql = "SELECT uid FROM logon_scriptsusers WHERE uid='{$uid}'";
$q = new mysql();
$ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
$sql_edit = "UPDATE logon_scriptsusers SET script_code='{$datas}' WHERE uid='{$uid}'";
$sql_add = "INSERT INTO logon_scriptsusers(uid,script_code) VALUES('{$uid}','{$datas}');";
if ($ligne["uid"] == null) {
$sql = $sql_add;
} else {
$sql = $sql_edit;
}
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo $q->mysql_error;
} else {
$tpl = new templates();
echo $tpl->javascript_parse_text("{success}");
$sock = new sockets();
$sock->getFrameWork("samba.php?smb-logon-scripts-user={$uid}");
}
}
示例10: 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";
}
示例11: PommoReset
function PommoReset()
{
$q = new mysql();
$ldap = new clladp();
$sql = "UPDATE pommo_config SET config_value ='{$ldap->ldap_admin}' WHERE config_name='admin_username'";
$q->QUERY_SQL($sql, 'pommo');
$sql = "UPDATE pommo_config SET config_value ='" . md5($ldap->ldap_password) . " WHERE config_name='admin_password'";
$q->QUERY_SQL($sql, 'pommo');
$tpl = new templates();
echo $tpl->_ENGINE_parse_body('{restore_admin_text}');
}
示例12: popup
function popup()
{
$tpl = new templates();
$time = time();
echo "<div style='width:98%' class=form>";
$sql = "SELECT DATE_FORMAT(zDate,'%H') as tdate,AVG(download) as tbandwith FROM speedtests \n\tWHERE DATE_FORMAT(zDate,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d') \n\tGROUP BY DATE_FORMAT(zDate,'%H')\n\tORDER BY zDate";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2><code>{$sql}</code>";
return;
}
$fileName = "ressources/logs/web/bandwith-day.png";
$g = new artica_graphs($fileName, 10);
if (mysql_num_rows($results) > 1) {
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$g->ydata[] = round($ligne["tbandwith"], 0);
$g->xdata[] = $ligne["tdate"];
}
$g->title = $tpl->_ENGINE_parse_body("{today}: {bandwith} KBi/s");
$g->x_title = "hours";
$g->y_title = null;
$g->width = 650;
$g->line_green();
@chmod($fileName, 0777);
echo "<center style='margin:5px'><img src='ressources/logs/web/bandwith-day.png?{$time}'</center>";
}
$sql = "SELECT YEARWEEK(zDate) as tweek,AVG(download) as tbandwith,DAYOFMONTH(zDate) as tdate \nFROM speedtests WHERE YEARWEEK(zDate)=YEARWEEK(NOW()) GROUP BY DAYOFMONTH(zDate) ORDER BY DAYOFMONTH(zDate) ";
$results = $q->QUERY_SQL($sql, "artica_events");
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2><code>{$sql}</code>";
return;
}
$fileName = "ressources/logs/web/bandwith-week.png";
$g = new artica_graphs($fileName, 10);
if (mysql_num_rows($results) > 1) {
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
$g->ydata[] = round($ligne["tbandwith"], 0);
$g->xdata[] = $ligne["tdate"];
}
$g->title = $tpl->_ENGINE_parse_body("{this_week}: {bandwith} KBi/s");
$g->x_title = "day";
$g->y_title = null;
$g->width = 650;
$g->line_green();
@chmod($fileName, 0777);
echo "<center style='margin:5px'><img src='ressources/logs/web/bandwith-week.png?{$time}'</center>";
}
echo "</div>";
}
示例13: CleanSmtp_events_database
function CleanSmtp_events_database()
{
$sock = new sockets();
$ini = new Bs_IniHandler();
$ini->loadString($sock->GET_INFO("RTMMailConfig"));
if ($ini->_params["ENGINE"]["LOG_DAY_LIMIT"] == null) {
$ini->_params["ENGINE"]["LOG_DAY_LIMIT"] = "20";
}
$today = date('Y-m-d');
$sql = "DELETE FROM smtp_logs WHERE time_stamp < DATE_ADD( '{$today}', INTERVAL -{$ini->_params["ENGINE"]["LOG_DAY_LIMIT"]} DAY )";
$q = new mysql();
$q->QUERY_SQL($sql, 'artica_events');
$sql = "OPTIMIZE TABLE `smtp_logs`";
$q->QUERY_SQL($sql, 'artica_events');
}
示例14: Save
function Save()
{
$sock = new sockets();
$disksize = $_POST["disksize"];
$UpdateUtilityStorePath = $_POST["UpdateUtilityStorePath"];
$HardDriveSizeMB = unserialize(base64_decode($sock->getFrameWork("system.php?HardDriveDiskSizeMB=" . base64_encode($UpdateUtilityStorePath))));
if (!is_array($HardDriveSizeMB)) {
echo "Fatal Error Cannot retreive information for `{$UpdateUtilityStorePath}`";
return;
}
if ($disksize < 2500) {
echo "Fatal 2500MB minimal size";
return;
}
$AVAILABLEMB = $HardDriveSizeMB["AVAILABLE"];
if ($AVAILABLEMB < $disksize) {
$T = $disksize - $AVAILABLEMB;
echo "Fatal Error : Available: {$AVAILABLEMB}MB, need at least {$T}MB";
return;
}
$sql = "INSERT INTO loop_disks (`path`,`size`,`disk_name`,`maxfds`) VALUES ('{$UpdateUtilityStorePath}','{$disksize}','UpdateUtility','25000')";
$q = new mysql();
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo $q->mysql_error;
return;
}
$sock = new sockets();
$sock->SET_INFO("UpdateUtilityUseLoop", 1);
$sock->getFrameWork("lvm.php?loopcheck=yes");
$sock->getFrameWork("freeweb.php?reconfigure-updateutility=yes");
}
示例15: cnx_list
function cnx_list()
{
$page = CurrentPageName();
$tpl = new templates();
$html = "\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{$refresh}</th>\n\t\t<th>{date}</th>\n\t\t<th>{server}</th>\n\t\t<th>{member}</th>\n\t\t<th>{panel}</th>\n\t\t<th>{ipaddr}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
$sql = "SELECT * FROM admin_cnx ORDER BY connected DESC LIMIT 0,100";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_events");
while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
if ($classtr == "oddRow") {
$classtr = null;
} else {
$classtr = "oddRow";
}
if ($ligne["uid"] == -100) {
$uid = "Manager";
} else {
$u = new user($ligne["uid"]);
$uid = $u->DisplayName;
}
$date = date('H:i:s', strtotime($ligne["connected"]));
$html = $html . "<tr class={$classtr}>\n\t\t<td width=1%><img src='img/user-32.png'></td>\n\t\t<td style='font-size:11px'>{$date}</td>\n\t\t<td style='font-size:11px'>{$ligne["webserver"]}</td>\n\t\t<td style='font-size:11px'>{$uid}</td>\n\t\t<td style='font-size:11px'>{$ligne["InterfaceType"]}</td>\n\t\t<td style='font-size:11px'>{$ligne["ipaddr"]} ({$ligne["hostname"]})</td>\n\t\t</tr>\n\t\t\n\t\t";
}
$html = $html . "</table>";
echo $tpl->_ENGINE_parse_body($html);
}