function get_mysql_count($hr_class) { $result = _mysql_query("select count(id) as count from workunit where hr_class=" . $hr_class); $count = _mysql_fetch_object($result); _mysql_free_result($result); return $count->count; }
function get_db_info($db_name) { // Carl grabbed this from the mysql.com boards http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html $result = _mysql_query("SHOW TABLE STATUS FROM {$db_name}"); // SQL output // mysql> show table status from [table_name]; // | Name | Engine | Version | Row_format | Rows // | Avg_row_length | Data_length | Max_data_length // | Index_length | Data_free | Auto_increment | Create_time // | Update_time | Check_time | Collation | Checksum | Create_options | Comment | // $gdata = 0; $gindex = 0; $gtotal = 0; $grows = 0; $i = 0; $db_rec = array(); while ($myarr = _mysql_fetch_assoc($result)) { // sum grand totals $total = $myarr["Data_length"] + $myarr["Index_length"]; $gindex += $myarr["Index_length"]; $gdata += $myarr["Data_length"]; $grows += $myarr["Rows"]; $gtotal += $total; $db_rec[$i] = new DB_REC($myarr["Name"], $myarr["Data_length"], $myarr["Index_length"], $total, $myarr["Rows"], $myarr["Avg_row_length"]); $i++; } $db_rec[$i] = new DB_REC("Total", $gdata, $gindex, $gtotal, $grows, ""); return $db_rec; }
function make_user($user) { $prefs = $user->global_prefs; $run_on_batteries = parse_boolint($prefs, "run_on_batteries"); $run_if_user_active = parse_boolint($prefs, "run_if_user_active"); $start_hour = parse_num($prefs, "<start_hour>"); $end_hour = parse_num($prefs, "<end_hour>"); $net_start_hour = parse_num($prefs, "<net_start_hour>"); $net_end_hour = parse_num($prefs, "<net_end_hour>"); $leave_apps_in_memory = parse_boolint($prefs, "leave_apps_in_memory"); $confirm_before_connecting = parse_boolint($prefs, "confirm_before_connecting"); $hangup_if_dialed = parse_boolint($prefs, "hangup_if_dialed"); $work_buf_min_days = parse_num($prefs, "<work_buf_min_days>"); $max_cpus = parse_num($prefs, "<max_cpus>"); $cpu_scheduling_period_minutes = parse_num($prefs, "<cpu_scheduling_period_minutes>"); $disk_interval = parse_num($prefs, "<disk_interval>"); $disk_max_used_gb = parse_num($prefs, "<disk_max_used_gb>"); $disk_max_used_pct = parse_num($prefs, "<disk_max_used_pct>"); $disk_min_free_gb = parse_num($prefs, "<disk_min_free_gb>"); $vm_max_used_pct = parse_num($prefs, "<vm_max_used_pct>"); $idle_time_to_run = parse_num($prefs, "<idle_time_to_run>"); $max_bytes_sec_up = parse_num($prefs, "<max_bytes_sec_up>"); $max_bytes_sec_down = parse_num($prefs, "<max_bytes_sec_down>"); $query = "insert into puser values\n ({$user->id},\n {$user->create_time},\n '{$user->email_addr}',\n '{$user->country}',\n {$user->total_credit},\n '{$user->venue}',\n {$run_on_batteries},\n {$run_if_user_active},\n {$start_hour},\n {$end_hour},\n {$net_start_hour},\n {$net_end_hour},\n {$leave_apps_in_memory},\n {$confirm_before_connecting},\n {$hangup_if_dialed},\n {$work_buf_min_days},\n {$max_cpus},\n {$cpu_scheduling_period_minutes},\n {$disk_interval},\n {$disk_max_used_gb},\n {$disk_max_used_pct},\n {$disk_min_free_gb},\n {$vm_max_used_pct},\n {$idle_time_to_run},\n {$max_bytes_sec_up},\n {$max_bytes_sec_down})\n "; $retval = _mysql_query($query); if (!$retval) { echo _mysql_error(); } }
function _TOY_shamei_info($prms) { $q = "SELECT * FROM shamei WHERE catalog = '" . $prms['catalog'] . "' AND catalog_code = '" . $prms['catalog_code'] . "';"; $r_q = _mysql_query($q); // выполним $res = mysql_fetch_array($r_q, MYSQL_ASSOC); return $res; }
function show_graph() { db_init(); $xaxis = $_GET['xaxis']; $yaxis = $_GET['yaxis']; $granularity = $_GET['granularity']; $active = $_GET['active']; $inactive = $_GET['inactive']; $show_text = $_GET['show_text']; if (!$active && !$inactive) { echo "You must select at least one of (active, inactive)"; exit; } $fields = 'host.id, user.create_time'; if ($xaxis == 'active' || !$active || !$inactive) { $query = "select {$fields}, max(rpc_time) as max_rpc_time from host, user where host.userid=user.id group by userid"; } else { $query = 'select $fields from user'; } $result = _mysql_query($query); $yarr = array(); $now = time(); $maxind = 0; $active_thresh = time() - 30 * 86400; while ($user = _mysql_fetch_object($result)) { $val = $now - $user->max_rpc_time; if (!$active) { if ($user->max_rpc_time > $active_thresh) { continue; } } if (!$inactive) { if ($user->max_rpc_time < $active_thresh) { continue; } } $life = $user->max_rpc_time - $user->create_time; $ind = $life / $granularity; $ind = (int) $ind; $yarr[$ind]++; if ($ind > $maxind) { $maxind = $ind; } } $xarr = array(); for ($i = 0; $i <= $maxind; $i++) { $xarr[$i] = $i; if (is_null($yarr[$i])) { $yarr[$i] = 0; } } if ($show_text) { show_text($xarr, $yarr); } else { draw_graph($xarr, $yarr); } }
function profile_word($word) { $q = "select userid from profile where response1 like '%{$word}%'"; echo "{$q}\n"; $r = _mysql_query($q); while ($x = _mysql_fetch_object($r)) { purge_user($x->userid); } }
function get_count_from_db() { $result = _mysql_query("select count(*) from result"); if (!$result) { return false; } $count = _mysql_fetch_array($result); _mysql_free_result($result); return $count[0]; }
function do_query($query) { echo "Doing query:\n{$query}\n"; $result = _mysql_query($query); if (!$result) { echo "Failed:\n" . _mysql_error() . "\n"; } else { echo "Success.\n"; } }
function clean_user($user) { if ($user->name != sanitize_tags($user->name)) { $x = sanitize_tags($user->name); echo "ID: {$user->id}\nname: {$user->name}\nstripped name: {$x}\nemail: {$user->email_addr}\n-----\n"; $x = boinc_real_escape_string($x); $x = trim($x); $query = "update user set name='{$x}' where id={$user->id}"; $retval = _mysql_query($query); echo $query; } }
function getSingleQuery($query) { $result = _mysql_query($query); if (!$result) { return; } $cnt = _mysql_fetch_row($result); if (!$cnt) { return; } _mysql_free_result($result); return $cnt[0]; }
function delete_user($user) { global $test; $age = (time() - $user->create_time) / 86400; echo "----------------\ndeleting user {$user->id} email {$user->email_addr} name {$user->name} age {$age} days\n"; if ($test) { return; } delete_profile($user); forum_delete_user($user); BoincPrivateMessage::delete_aux("userid={$user->id} or senderid={$user->id}"); BoincNotify::delete_aux("userid={$user->id}"); $q = "delete from user where id={$user->id}"; _mysql_query($q); }
function user_permissions_action() { $bitset = ''; for ($i = 0; $i < S_NFLAGS; $i++) { if (post_int("role" . $i, TRUE) == 1) { $bitset .= '1'; echo "<br> setting {$i}"; } else { $bitset .= '0'; } } $userid = post_int("userid"); $query = "UPDATE forum_preferences SET special_user='******' WHERE userid={$userid}"; _mysql_query($query); Header("Location: user_permissions.php"); }
function update_thread_timestamps() { $threads = BoincThread::enum(); foreach ($threads as $thread) { $q = "select max(timestamp) as foo from post where thread={$thread->id}"; $r2 = _mysql_query($q); $m = _mysql_fetch_object($r2); echo "id: {$thread->id}; min: {$m->foo}\n"; _mysql_free_result($r2); $n = $m->foo; if ($n) { $q = "update thread set timestamp={$n} where id={$thread->id}"; _mysql_query($q); } } }
function showTableStatus($db) { $size = 0; $out = ""; start_table(); row1($db, 15); row_array(array("Name", "Engine", "Version", "Row Format", "Rows", "Avg Row Length (KB)", "Data Length (MB)", "Max Data Length (MB)", "Index Length (MB)", "Data free (MB)", "Create Time", "Update Time", "Check Time", "Create Options", "Comment")); _mysql_select_db($db); $result = _mysql_query("show table status"); while ($row = _mysql_fetch_array($result)) { $size += $row["Data_length"] + $row["Index_length"]; $engine = $row["Engine"]; if (!$engine) { $engine = $row["Type"]; } row_array(array($row["Name"], $engine, $row["Version"], $row["Row_format"], $row["Rows"], round($row["Avg_row_length"] / 1024, 2), round($row["Data_length"] / (1024 * 1024), 2), round($row["Max_data_length"] / (1024 * 1024), 2), round($row["Index_length"] / (1024 * 1024), 2), round($row["Data_free"] / (1024 * 1024), 2), $row["Create_time"], $row["Update_time"], $row["Check_time"], $row["Create_options"], $row["Comment"])); } $size = round($size / 1024 / 1024, 1); row2("Total Table Sizes (MB)", $size); end_table(); echo "<BR><BR>"; }
public static function recordLogin() { //RECORD THIS USER LOGIN, into user_logs $mysql['login_server'] = db::escape(serialize($_SERVER)); $mysql['login_session'] = db::escape(serialize($_SESSION)); $mysql['login_error'] = db::escape(serialize($error)); $mysql['ip_address'] = db::escape($_SERVER['REMOTE_ADDR']); $mysql['login_time'] = time(); if ($error) { $mysql['login_success'] = 0; } else { $mysql['login_success'] = 1; } //record everything that happend during this crime scene. $user_log_sql = "INSERT INTO 202_users_log\r\n\t\t\t\t\t\t\t\t SET user_name='" . $mysql['user_name'] . "',\r\n\t\t\t\t\t\t\t\t\t\tuser_pass='******'user_pass'] . "',\r\n\t\t\t\t\t\t\t\t\t\tip_address='" . $mysql['ip_address'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_time='" . $mysql['login_time'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_success = '" . $mysql['login_success'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_error='" . $mysql['login_error'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_server='" . $mysql['login_server'] . "',\r\n\t\t\t\t\t\t\t\t\t\tlogin_session='" . $mysql['login_session'] . "'"; $user_log_result = mysql_query($user_log_sql) or record_mysql_error($user_log_sql); if (!$error) { $ip_id = INDEXES::get_ip_id($_SERVER['HTTP_X_FORWARDED_FOR']); $mysql['ip_id'] = mysql_real_escape_string($ip_id); //update this users last login_ip_address $user_sql = "\tUPDATE \t202_users\r\n SET\t\t\tuser_last_login_ip_id='" . $mysql['ip_id'] . "'\r\n WHERE \tuser_name='" . $mysql['user_name'] . "'\r\n AND \t\tuser_pass='******'user_pass'] . "'"; $user_result = _mysql_query($user_sql); } }
//($ppc_network_sql); if (mysql_num_rows($ppc_network_result) == 0) { ?> <li>You have not added any networks.</li><?php } while ($ppc_network_row = mysql_fetch_array($ppc_network_result, MYSQL_ASSOC)) { //print out the PPC networks $html['ppc_network_name'] = htmlentities($ppc_network_row['ppc_network_name'], ENT_QUOTES, 'UTF-8'); $url['ppc_network_id'] = urlencode($ppc_network_row['ppc_network_id']); printf('<li>%s - <a href="?delete_ppc_network_id=%s" style="font-size: 9px;">remove</a></li>', $html['ppc_network_name'], $url['ppc_network_id']); ?> <ul style="margin-top: 0px;"><?php //print out the individual accounts per each PPC network $mysql['ppc_network_id'] = mysql_real_escape_string($ppc_network_row['ppc_network_id']); $ppc_account_sql = "SELECT * FROM `202_ppc_accounts` WHERE `ppc_network_id`='" . $mysql['ppc_network_id'] . "' AND `ppc_account_deleted`='0' ORDER BY `ppc_account_name` ASC"; $ppc_account_result = _mysql_query($ppc_account_sql); //($ppc_account_sql); while ($ppc_account_row = mysql_fetch_array($ppc_account_result, MYSQL_ASSOC)) { $html['ppc_account_name'] = htmlentities($ppc_account_row['ppc_account_name'], ENT_QUOTES, 'UTF-8'); $url['ppc_account_id'] = urlencode($ppc_account_row['ppc_account_id']); printf('<li>%s - <a href="?edit_ppc_account_id=%s" style="font-size: 9px;">edit</a> - <a href="?delete_ppc_account_id=%s" style="font-size: 9px;">remove</a></li>', $html['ppc_account_name'], $url['ppc_account_id'], $url['ppc_account_id']); } ?> </ul><?php } ?> </ul> </td> </tr> </table>
function get_data() { $nwus = 4000; $sum = array(); for ($i = 0; $i <= 10; $i++) { $sum[] = 0; } $r1 = _mysql_query("select id from workunit where canonical_resultid>0 limit {$nwus}"); $n = 0; while ($wu = _mysql_fetch_object($r1)) { $results = array(); $r2 = _mysql_query("select * from result where workunitid={$wu->id}"); $found_zero = false; while ($result = _mysql_fetch_object($r2)) { if ($result->granted_credit == 0) { continue; } // skip invalid $host = BoincHost::lookup_id($result->hostid); $r = new StdClass(); $r->cpu_time = $result->cpu_time; $r->p_fpops = $host->p_fpops; $r->p_iops = $host->p_iops; $results[] = $r; } //echo "Wu $wu->id -------------\n"; if (count($results) < 2) { continue; } for ($i = 0; $i <= 10; $i++) { $fpw = $i / 10.0; $sum[$i] += fpw_var($results, $fpw); } $n++; } echo "This script recommends value for <fp_benchmark_weight> in config.xml.\nIt does this by finding the value that minimizes the variance\namong claimed credit for workunits currently in your database.\nIt examines at most {$nwus} WUs (edit the script to change this).\n\nNumber of workunits analyzed: {$n}\n\n"; for ($i = 0; $i <= 10; $i++) { $fpw = $i / 10.0; $r = $sum[$i] / $n; echo "FP weight {$fpw}: variance is {$r}\n"; if ($i == 0) { $best = $r; $fbest = $fpw; } else { if ($r < $best) { $best = $r; $fbest = $fpw; } } } echo "\nRecommended value: {$fbest}\n"; }
db_init(); function buttons($i) { echo "\n <input type=\"radio\" name=\"user{$i}\" value=\"0\"> skip <br>\n <input type=\"radio\" name=\"user{$i}\" value=\"1\" checked=\"checked\"> accept <br>\n <input type=\"radio\" name=\"user{$i}\" value=\"-1\"> reject\n "; } admin_page_head("screen profiles"); if (function_exists('profile_screen_query')) { $query = profile_screen_query(); } else { if (profile_screening()) { $query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " limit 20"; } else { $query = "select * from profile, user where profile.userid=user.id " . " and has_picture>0 " . " and verification=0 " . " and uotd_time is null " . " and expavg_credit>1 " . " and (response1 <> '' or response2 <> '') " . " order by recommend desc limit 20"; } } $result = _mysql_query($query); $n = 0; echo "<form action=profile_screen_action.php>\n"; start_table(); $found = false; while ($profile = _mysql_fetch_object($result)) { $found = true; echo "<tr><td valign=top>"; buttons($n); echo "\n <br>Name: {$profile->name}\n <br>recommends: {$profile->recommend}\n <br>rejects: {$profile->reject}\n <br>RAC: {$profile->expavg_credit}\n <br>\n "; echo "</td><td><table border=2> "; show_profile($profile, $g_logged_in_user, true); echo "</table></td></tr>\n"; echo "<input type=\"hidden\" name=\"userid{$n}\" value=\"{$profile->userid}\">\n"; $n++; }
function createQuizfromGIFT($content, $title, $quizdraft, $description, $tags) { global $IMPORT_INFO, $MSG, $CONFIG, $USER; //first check if this quiz already exists $sql = sprintf("SELECT q.qref FROM quizprop qp\n\t\t\t\t\t\tINNER JOIN quiz q ON q.quizid = qp.quizid\n\t\t\t\t\t\tWHERE qp.quizpropname='content' \n\t\t\t\t\t\tAND qp.quizpropvalue='%s'\n\t\t\t\t\t\tAND q.createdby=%d", $content, $USER->userid); $result = _mysql_query($sql, $this->DB); while ($o = mysql_fetch_object($result)) { // store JSON object for quiz (for caching) $obj = $this->getQuizObject($o->qref); return $obj; } $supported_qtypes = array('truefalse', 'multichoice', 'essay', 'shortanswer', 'numerical'); $questions_to_import = array(); include_once $CONFIG->homePath . 'quiz/import/gift/import.php'; $import = new qformat_gift(); $lines = explode("\n", $content); $questions = $import->readquestions($lines); foreach ($questions as $q) { if (in_array($q->qtype, $supported_qtypes)) { array_push($questions_to_import, $q); } else { if ($q->qtype != 'category') { array_push($IMPORT_INFO, $q->qtype . " question type not yet supported ('" . $q->questiontext . "')"); } } } if (count($questions_to_import) == 0) { array_push($MSG, getstring('import.quiz.error.nosuppportedquestions')); return; } if (count($MSG) == 0) { // now do the actual import // setup quiz with default props $quizid = $this->addQuiz($title, $quizdraft, $description); $this->setProp('quiz', $quizid, 'generatedby', 'import'); $this->setProp('quiz', $quizid, 'content', $content); $this->updateQuizTags($quizid, $tags); $importer = new GIFTImporter(); $importer->quizid = $quizid; $importer->import($questions_to_import); $this->setProp('quiz', $quizid, 'maxscore', $importer->quizmaxscore); $q = $this->getQuizById($quizid); // store JSON object for quiz (for caching) $obj = $this->getQuizObject($q->ref); $json = json_encode($obj); $this->setProp('quiz', $quizid, 'json', $json); return $obj; } return; }
function fix_fix() { $profiles = _mysql_query("select * from profile where id=99"); $profile = _mysql_fetch_object($profiles); fix_profile($profile); }
<?php include 'includes/corefuncs.inc.php'; include '../includes/sqlfunctions.inc.php'; include 'includes/adminconnection.inc.php'; if (function_exists('nukeMagicQuotes')) { nukeMagicQuotes(); } $conn = dbConnect(); $sql = 'SELECT * FROM announcements WHERE active = "1" ORDER BY displayorder, enddate'; $result = _mysql_query($conn, $sql); $strReturn = ''; while ($row = _mysql_fetch_assoc($conn, $result)) { $strReturn .= '<tr><td><div class="plaintext">' . $row['description'] . '</div></td><td style="text-align: right; padding-right: 50px;">' . $row['displayorder'] . '</td><td>' . $row['startdate'] . '</td><td>' . $row['enddate'] . '</td><td style="text-align: right;"><a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="#" role="button" disabled="false" id="edit' . $row['id'] . '" onclick="javascript:msgedit(\'' . $row['id'] . '\'); return false;"><span class="ui-button-text">Edit</span></a> <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" href="#" role="button" disabled="false" id="del' . $row['id'] . '" onclick="javascript:msgdelete(\'' . $row['id'] . '\'); return false;"><span class="ui-button-text">Delete</span></a></td></tr>'; // $strReturn .= '<tr><td><div class="plaintext">'.$row['description'].'</div></td><td style="text-align: right; padding-right: 50px;">'.$row['displayorder'].'</td><td>'.$row['startdate'].'</td><td>'.$row['enddate'].'</td><td style="text-align: right;"><button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="edit'.$row['id'].'" ng-click="msgedit(\''.$row['id'].'\');"><span class="ui-button-text">Edit</span></button> <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="del'.$row['id'].'" ng-click="msgdelete(\''.$row['id'].'\');"><span class="ui-button-text">Delete</span></button></td></tr>'; } print $strReturn;
// See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. require_once '../inc/forum.inc'; require_once '../inc/util_ops.inc'; db_init(); admin_page_head('Manage user privileges'); start_table("align=\"center\""); row1("Current special users", '9'); echo "<tr><td>User</td>"; for ($i = 0; $i < S_NFLAGS; $i++) { echo "<td width=\"15\">" . $special_user_bitfield[$i] . "</td>\n"; } echo "</tr>"; $result = _mysql_query("SELECT prefs.userid, prefs.special_user, user.id, user.name \n FROM forum_preferences as prefs, user \n WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id"); for ($i = 1; $i <= _mysql_num_rows($result); $i++) { $foo = _mysql_fetch_object($result); echo "<form action=\"manage_special_users_action.php\" method=\"POST\">\n"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$foo->userid}\"\n <tr><td>{$foo->name} ({$foo->id})</td>\n "; for ($j = 0; $j < S_NFLAGS; $j++) { $bit = substr($foo->special_user, $j, 1); echo "<td><input type=\"checkbox\" name=\"role" . $j . "\" value=\"1\""; if ($bit == 1) { echo " checked=\"checked\""; } echo "></td>\n"; } echo "<td><input class=\"btn btn-default\" type=\"submit\" value=\"Update\"></form></td>"; echo "</tr>\n"; }
// as published by the Free Software Foundation, // either version 3 of the License, or (at your option) any later version. // // BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. // limit a given host to 1 job per day // TODO: document; use new DB interface include_once "../inc/db.inc"; include_once "../inc/util.inc"; include_once "../inc/db_ops.inc"; include_once "../inc/util_ops.inc"; include_once "../inc/prefs.inc"; db_init(); if (get_int('hostid')) { $hostid = get_int('hostid'); } else { error_page("no hostid"); } $timestr = time_str(time(0)); $title = "host " . $hostid . " max_results_day set to 1 at " . $timestr; admin_page_head($title); if ($hostid > 0) { $result = _mysql_query("UPDATE host SET max_results_day=1 WHERE id=" . $hostid); } echo $title; admin_page_tail();
function geoLocationDatabaseInstalled() { $sql = "SELECT COUNT(*) FROM 202_locations"; $result = _mysql_query($sql); $count = mysql_result($result, 0, 0); if ($count != 161877) { return false; } $sql = "SELECT COUNT(*) FROM 202_locations_block"; $result = _mysql_query($sql); $count = mysql_result($result, 0, 0); if ($count != 1593228) { return false; } $sql = "SELECT COUNT(*) FROM 202_locations_city"; $result = _mysql_query($sql); $count = mysql_result($result, 0, 0); if ($count != 101332) { return false; } $sql = "SELECT COUNT(*) FROM 202_locations_coordinates"; $result = _mysql_query($sql); $count = mysql_result($result, 0, 0); if ($count != 125204) { return false; } $sql = "SELECT COUNT(*) FROM 202_locations_country"; $result = _mysql_query($sql); $count = mysql_result($result, 0, 0); if ($count != 235) { return false; } $sql = "SELECT COUNT(*) FROM 202_locations_region"; $result = _mysql_query($sql); $count = mysql_result($result, 0, 0); if ($count != 396) { return false; } #if no return false return true; }
// Copyright (C) 2008 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License // as published by the Free Software Foundation, // either version 3 of the License, or (at your option) any later version. // // BOINC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // See the GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with BOINC. If not, see <http://www.gnu.org/licenses/>. require_once "../inc/util_ops.inc"; db_init(); admin_page_head("Failures grouped by app version and host"); $query_appid = $_GET['appid']; $query_received_time = time() - $_GET['nsecs']; $main_query = "\nSELECT\n app_version_id,\n app_version_num,\n hostid AS Host_ID,\n case\n when INSTR(host.os_name, 'Darwin') then 'Darwin'\n when INSTR(host.os_name, 'Linux') then 'Linux'\n when INSTR(host.os_name, 'Windows') then 'Windows'\n when INSTR(host.os_name, 'SunOS') then 'SunOS'\n when INSTR(host.os_name, 'Solaris') then 'Solaris'\n when INSTR(host.os_name, 'Mac') then 'Mac'\n else 'Unknown'\n end AS OS_Name,\n case\n when INSTR(host.os_name, 'Linux') then \n case\n when INSTR(LEFT(host.os_version, 6), '-') then LEFT(host.os_version, (INSTR(LEFT(host.os_version, 6), '-') - 1))\n else LEFT(host.os_version, 6)\n end\n else host.os_version\n end AS OS_Version,\n host.nresults_today AS Results_Today, \n COUNT(*) AS error_count\nFROM result\n left join host on result.hostid = host.id \nWHERE\n appid = '{$query_appid}' and\n server_state = '5' and\n outcome = '3' and \n received_time > '{$query_received_time}'\nGROUP BY\n app_version_id,\n hostid\norder by error_count desc\n"; $result = _mysql_query($main_query); start_table(); table_header("App version", "Host ID", "OS Version", "Results today", "Error count"); while ($res = _mysql_fetch_object($result)) { table_row(app_version_desc($res->app_version_id), "<a href=" . URL_BASE . "show_host_detail.php?hostid={$res->Host_ID}>{$res->Host_ID}</a>", $res->OS_Version, $res->Results_Today, "<a href=db_action.php?table=result&detail=low&hostid={$res->Host_ID}&app_version_id={$res->app_version_id}&server_state=5&outcome=3>{$res->error_count}</a>"); } _mysql_free_result($result); end_table(); admin_page_tail(); $cvs_version_tracker[] = "\$Id\$"; //Generated automatically - do not edit
<table cellspacing="0" cellpadding="0" class="legend"> <tr> <th colspan="4"><h3 >Today's Stats - <?php echo date('g:ia'); ?> </h3></th> </tr> <?php $mysql['user_id'] = mysql_real_escape_string($_SESSION['user_id']); $mysql['from_date'] = mysql_real_escape_string(date('Y-m-d')); $mysql['to_date'] = mysql_real_escape_string(date('Y-m-d')); $stat_sql = "\tSELECT \tstat_account_nickname,\n\t\t\t\t\t\t\t\tstat_network_name,\n\t\t\t\t\t\t\t\tSUM(stat_impressions) AS stat_impressions, \n\t\t\t\t\t\t\t\tSUM(stat_clicks) AS stat_clicks, \n\t\t\t\t\t\t\t\tSUM(stat_actions) AS stat_actions, \n\t\t\t\t\t\t\t\tSUM(stat_total) AS stat_total,\n\t\t\t\t\t\t\t\t(stat_total / stat_clicks) AS stat_epc\n\t\t\t\t\tFROM \t\tapi_stats \n\t\t\t\t\tLEFT JOIN \tapi_stat_accounts USING (stat_account_id) \n\t\t\t\t\tLEFT JOIN \tapi_stat_networks USING (stat_network_id) \n\t\t\t\t\tWHERE \tapi_stat_accounts.user_id='" . $mysql['user_id'] . "' \n\t\t\t\t\tAND \t\tstat_account_deleted='0' \n\t\t\t\t\tAND\t\tstat_date >= '" . $mysql['from_date'] . "'\n\t\t\t\t\tAND\t\tstat_date <= '" . $mysql['to_date'] . "'\n\t\t\t\t\tAND\t\tstat_total > '0'\n\t\t\t\t\tGROUP BY\tstat_account_id\n\t\t\t\t\tORDER BY stat_total DESC"; $stat_result = _mysql_query($stat_sql, $db2StatsLink); while ($stat_row = mysql_fetch_assoc($stat_result)) { $clicks = $stat_row['stat_clicks']; $actions = $stat_row['stat_actions']; $impressions = $stat_row['stat_impressions']; $total = $stat_row['stat_total']; $epc = $stat_row['stat_epc']; $total_clicks = $total_clicks + $clicks; $total_actions = $total_actions + $actions; $total_impressions = $total_impressions + $impressions; $total_total = $total_total + $total; $total_epc = @($total_total / $total_clicks); if ($clicks > 0) { $clicks = number_format($clicks); } else { $clicks = '-';
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/xtracks-app/bootstrap.php'; AUTH::require_user(); //set the timezone for the user, for entering their dates. AUTH::set_timezone($_SESSION['user_timezone']); //show breakdown runHourly(true); //show real or filtered clicks $mysql['user_id'] = mysql_real_escape_string($_SESSION['user_id']); $user_sql = "SELECT user_pref_breakdown, user_pref_show, user_cpc_or_cpv FROM 202_users_pref WHERE user_id=" . $mysql['user_id']; $user_result = _mysql_query($user_sql, $dbGlobalLink); //($user_sql); $user_row = mysql_fetch_assoc($user_result); $breakdown = $user_row['user_pref_breakdown']; if ($user_row['user_pref_show'] == 'all') { $click_flitered = ''; } if ($user_row['user_pref_show'] == 'real') { $click_filtered = " AND click_filtered='0' "; } if ($user_row['user_pref_show'] == 'filtered') { $click_filtered = " AND click_filtered='1' "; } if ($user_row['user_pref_show'] == 'leads') { $click_filtered = " AND click_lead='1' "; } if ($user_row['user_cpc_or_cpv'] == 'cpv') { $cpv = true; } else { $cpv = false;
//---------------------------------------------- echo "<h3>HNB, KPT - Parts Number Translation Results</h3>"; echo "<b>MatchOff</b> - включает в себя SpecOn (выводит все запчасти для каталога разборки, вывод ВСЕГО!!! )\r\n<br/><b>SpecOn</b> - включает себя Match on (выводит запчасти для каталога + выбранной модели авто)\r\n<br/><b>Match on</b> - самое жесткое соответвии запчати к Вину (включаеться при поиске машин по ВИНУ)"; /* Запрос EPC Toyota */ $query = "\r\nSELECT\r\n\thnb.*, \r\n\thinmei.desc_en \tPartName,\r\n\r\n\t# опции установки part_code\r\n\tIF(\r\n\t\t(hnb.field_type = 1 # только проверять системные строки hnb.field_type == 1\r\n AND IFNULL(hnb.siyopt2,'') <> ''), # делать подзапрос только если задано hnb.siyopt2\r\n\t\t(SELECT COUNT(*) \r\n\t\t\tFROM siyopt \r\n\t\t\tWHERE siyopt.catalog = hnb.catalog \r\n\t\t\t\tAND siyopt.siyopt = hnb.sysopt \r\n\t\t\t\tAND siyopt.siyopt_code = CONCAT(hnb.sysopt, hnb.siyopt2)),\r\n\t\t0\r\n\t ) hnb_siyopt_cnt,\r\n\r\n\t# состыковка опции установки VIN + part_code\r\n\tIF(\r\n\t\t(hnb.field_type = 1 # только проверять системные строки hnb.field_type == 1\r\n AND IFNULL(hnb.siyopt2,'') <> ''), # делать подзапрос только если задано hnb.siyopt2\r\n\t\t(SELECT COUNT(*) \r\n\t\t\tFROM siyopt hnb_so\r\n\t\t\t\tJOIN siyopt VIN_so\r\n\t\t\t\t\tON VIN_so.catalog = hnb_so.catalog\r\n\t\t\t\t\tAND VIN_so.siyopt = hnb_so.siyopt\r\n\t\t\t\t\tAND VIN_so.siyopt_value = hnb_so.siyopt_value\r\n\t\t\tWHERE hnb_so.catalog = hnb.catalog \r\n\t\t\t\tAND hnb_so.siyopt = hnb.sysopt \r\n\t\t\t\tAND hnb_so.siyopt_code = CONCAT(hnb.sysopt, hnb.siyopt2)\r\n\t\t\t\tAND VIN_so.siyopt_code = '{$siyopt_code}'),\r\n\t\t0\r\n ) hnb_vin_siyopt_cnt,\r\n\t\t\t\t\r\n\t# применяемость запчастей относительно типу комплектации выбранной модели авто\r\n\tIF(\r\n\t\t(hnb.field_type = 1 # только проверять системные строки hnb.field_type == 1\r\n AND SUBSTRING(hnb.add_desc,1,6) <> ''), # делать подзапрос только если задано @ipic_code\r\n\t\tEXISTS(SELECT kpt.compl_code \r\n\t\t\tFROM kpt\r\n\t\t\t\tJOIN johokt \r\n\t\t\t\t ON johokt.catalog = kpt.catalog\r\n\t\t\t\t AND johokt.catalog_code = kpt.catalog_code\r\n\t\t\t\t AND johokt.compl_code = kpt.compl_code \r\n\t\t\tWHERE kpt.catalog = hnb.catalog\r\n\t\t\t AND kpt.catalog_code = hnb.catalog_code\r\n\t\t\t AND kpt.ipic_code = SUBSTRING(hnb.add_desc,1,6) # маска применяемости запчасти\r\n\t\t\t AND johokt.model_code = '{$model_code}'\r\n\t\t\t AND johokt.sysopt = '{$sysopt}'), # уточним johokt\r\n\t\t0\r\n\t) compl_exist\r\n\t\r\n FROM hnb\r\n\r\n # название\r\n LEFT OUTER JOIN hinmei \r\n ON hinmei.catalog = hnb.catalog \r\n AND hinmei.pnc = hnb.pnc\r\n\r\n WHERE hnb.catalog = '{$catalog}'\r\n AND hnb.catalog_code = '{$catalog_code}'\r\n\tAND hnb.pnc = '{$pnc}' \r\n"; /* Сортировать и группировать ЗАПРЕЩЕНО !!! запрос возвращает записи в той очердности в которой было заложено в БД из EPC. ORDER в запрос вставлять нельзя, иначе сбивается системный порядок GROUP BY hnb.catalog, hnb.catalog_code, hnb.pnc, hnb.sysopt, hnb.part_code, hnb.quantity, hnb.start_date, hnb.end_date, hnb.field_type, hnb.siyopt2 ORDER BY hnb.catalog, hnb.catalog_code, hnb.pnc, hnb.sysopt, hnb.part_code, hnb.quantity, hnb.start_date, hnb.end_date, hnb.field_type compl_exist - уточним еще соместимость (AND johokt.sysopt = '$sysopt') */ // выполним $res_query = _mysql_query($query); // ВЫВОД НАИМЕНОВНАИЕ КОЛОНОК $parts_h = array(); // наименование полей $parts_h[] = 'exec'; // сначала поле EXEC $numfields = mysql_num_fields($res_query); for ($i = 0; $i < $numfields; $i++) { $parts_h[] = mysql_field_name($res_query, $i); } $parts_h[] = 'mode_des'; // еще сделаем поле куда сложим описания Model (Description) $parts_h[] = 'conditions'; // Conditions // ------------------------------ // ОБРАБОТКА РЕЗУЛЬАТА
} if ($_POST['user_pass'] == '') { $error['user_pass'] .= '<div class="error">You must type verify your password</div>'; } if (strlen($_POST['user_pass']) < 6 or strlen($_POST['user_pass']) > 15) { $error['user_pass'] .= '<div class="error">Passwords must be 6 to 15 characters long</div>'; } if ($_POST['user_pass'] != $_POST['verify_user_pass']) { $error['user_pass'] .= '<div class="error">Your passwords did not match, please try again</div>'; } if (!$error) { $user_pass = salt_user_pass($_POST['user_pass']); $mysql['user_pass'] = mysql_real_escape_string($user_pass); $mysql['user_id'] = mysql_real_escape_string($user_row['user_id']); $user_sql = "UPDATE \t202_users\n\t\t\t\t\t\t SET\t\tuser_pass='******'user_pass'] . "',\n\t\t\t\t\t\t\t\t\tuser_pass_time='0'\n\t\t\t\t\t\t WHERE\tuser_id='" . $mysql['user_id'] . "'"; $user_result = _mysql_query($user_sql); $success = true; } } $html['user_name'] = htmlentities($user_row['user_name'], ENT_QUOTES, 'UTF-8'); //if password was changed succesfully if ($success == true) { _die("<div style='text-align: center'><br/>Congratulations, your password has been reset.<br/>\n\t\t You can now <a href=\"/xtracks-login.php\">login</a> with your new password</div>"); } if ($error['user_pass_key']) { _die("<div style='text-align: center'><br/>" . $error['user_pass_key'] . "<p>Please use the <a href=\"/202-lost-pass\">password retrieval tool</a> to get a new password reset key.</p></div>"); } //else if none of the above, show the code to reset! ?> <?php
$html['export_keyword_status'] = htmlentities($export_keyword_status); echo $html['export_campaign_name'] . "\t"; echo $html['export_adgroup_name'] . "\t"; echo $html['export_keyword'] . "\t"; echo $html['export_keyword_match'] . "\t"; echo $html['export_keyword_max_cpc'] . "\t"; echo $html['export_keyword_destination_url'] . "\t"; echo $html['export_keyword_status']; echo "\n"; $line = array($export_campaign_name, $export_adgroup_name, $export_keyword, $export_keyword_match, $export_keyword_max_cpc, $export_keyword_destination_url, $export_keyword_status); //fputcsv(//$csv_file, $line); } } //ok now add all of the negative keywords associated with each individual adgroup $export_keyword_sql = "SELECT * FROM 202_export_keywords \n\t\t\t\t\t\t\tLEFT JOIN 202_export_campaigns USING (export_campaign_id) \n\t\t\t\t\t\t\tLEFT JOIN \t202_export_adgroups ON (202_export_keywords.export_adgroup_id = 202_export_adgroups.export_adgroup_id) \n\t\t\t\t\t\t\tWHERE 202_export_keywords.export_session_id='" . $mysql['export_session_id'] . "' AND 202_export_keywords.export_adgroup_id!=0"; $export_keyword_result = _mysql_query($export_keyword_sql); // or record_mysql_error($export_keyword_sql); while ($export_keyword_row = mysql_fetch_assoc($export_keyword_result)) { ob_flush(); flush(); $export_campaign_name = $export_keyword_row['export_campaign_name']; $export_adgroup_name = $export_keyword_row['export_adgroup_name']; $export_keyword = $export_keyword_row['export_keyword']; $export_keyword_match = $export_keyword_row['export_keyword_match']; $export_keyword_destination_url = $export_keyword_row['export_keyword_destination_url']; $export_keyword_status = $export_keyword_row['export_keyword_status']; $export_keyword_max_cpc = $export_keyword_row['export_keyword_max_cpc']; if ($export_keyword_match == 'negative') { $export_keyword_match = 'Negative Broad'; } if ($export_keyword_status == 1) {