Exemplo n.º 1
0
function fromOpenID2CardID($openid)
{
    $mysql_host = SAE_MYSQL_HOST_M;
    $mysql_host_s = SAE_MYSQL_HOST_S;
    $mysql_port = SAE_MYSQL_PORT;
    $mysql_user = SAE_MYSQL_USER;
    $mysql_password = SAE_MYSQL_PASS;
    $mysql_database = SAE_MYSQL_DB;
    $mysql_table = "member";
    $mysql_state = "SELECT * FROM " . $mysql_table . " WHERE `openid` = '" . $openid . "'";
    $con = mysql_connect($mysql_host . ':' . $mysql_port, $mysql_user, $mysql_password, true);
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_query("SET NAMES 'UTF8'");
    mysql_select_db($mysql_database, $con);
    $result = mysql_query($mysql_state);
    $cardID = "";
    while ($row = mysql_fetch_array($result)) {
        $cardID = $row['cardid'];
        break;
    }
    mysql_close($con);
    return $cardID;
}
function checkIndividually()
{
    #----------------------------------------------------------------------
    global $competitionCondition, $chosenWhich;
    echo "<hr /><p>Checking <b>" . $chosenWhich . " individual results</b>... (wait for the result message box at the end)</p>\n";
    #--- Get all results (id, values, format, round).
    $dbResult = mysql_query("\n    SELECT\n      result.id, formatId, roundId, personId, competitionId, eventId, result.countryId,\n      value1, value2, value3, value4, value5, best, average\n    FROM Results result, Competitions competition\n    WHERE competition.id = competitionId\n      {$competitionCondition}\n    ORDER BY formatId, competitionId, eventId, roundId, result.id\n  ") or die("<p>Unable to perform database query.<br/>\n(" . mysql_error() . ")</p>\n");
    #--- Build id sets
    $countryIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Countries")));
    $competitionIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Competitions")));
    $eventIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Events")));
    $formatIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Formats")));
    $roundIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Rounds")));
    #--- Process the results.
    $badIds = array();
    echo "<pre>\n";
    while ($result = mysql_fetch_array($dbResult)) {
        if ($error = checkResult($result, $countryIdSet, $competitionIdSet, $eventIdSet, $formatIdSet, $roundIdSet)) {
            extract($result);
            echo "Error: {$error}\nid:{$id} format:{$formatId} round:{$roundId}";
            echo " ({$value1},{$value2},{$value3},{$value4},{$value5}) best+average({$best},{$average})\n";
            echo "{$personId}   {$countryId}   {$competitionId}   {$eventId}\n\n";
            $badIds[] = $id;
        }
    }
    echo "</pre>";
    #--- Free the results.
    mysql_free_result($dbResult);
    #--- Tell the result.
    noticeBox2(!count($badIds), "All checked results pass our checking procedure successfully.<br />" . wcaDate(), count($badIds) . " errors found. Get them with this:<br /><br />SELECT * FROM Results WHERE id in (" . implode(', ', $badIds) . ")");
}
function retorna_imagem_perfil($idusuario)
{
    // globals ----------------------------------------------
    global $tabela_banco;
    // tabela de banco de dados
    global $imagem_servidor;
    // imagens de servidor
    // --------------------------------------------------------
    // query ------------------------------------------------
    $query = "select *from {$tabela_banco['2']} where idusuario='{$idusuario}';";
    // query
    // --------------------------------------------------------
    // comando -------------------------------------------
    $comando = comando_executa($query);
    // comando
    // --------------------------------------------------------
    // dados -----------------------------------------------
    $dados = mysql_fetch_array($comando, MYSQL_ASSOC);
    // dados
    // --------------------------------------------------------
    // imagem de perfil ----------------------------------
    $imagem_perfil = $dados['imagem_perfil'];
    // imagem de perfil
    // --------------------------------------------------------
    // imagem de servidor padrao ------------------------------
    if ($imagem_perfil == null) {
        $imagem_perfil = $imagem_servidor['usuario'];
        // imagem de servidor padrao
    }
    // -----------------------------------------------------------------
    // retorno -------------------------------------------------------
    return $imagem_perfil;
    // retorno
    // -----------------------------------------------------------------
}
function candidatesArePeopleToo()
{
    $s = mysql_query("SELECT * FROM candidates");
    while ($r = mysql_fetch_array($s)) {
        $name = $r['name_cleaned'];
        $sid = $r['id'];
        if (strpos($r['url'], "http://") === 0) {
            $url = $r['url'];
        } else {
            $url = 'http://www.alegeri-2008.ro' . $r['url'];
        }
        $idString = '<a href=' . $url . '>alegeri2008</a>';
        $persons = getPersonsByName($name, $idString);
        // If I reached this point, I know for sure I either have one
        // or zero matches, there are no ambiguities.
        if (count($persons) == 0) {
            $person = addPersonToDatabase($name, $r['name_cleaned']);
        } else {
            $person = $persons[0];
            info("Found      {" . $name . "}");
        }
        // First and foremost, attempt to add this to the person's history.
        addPersonHistory($person->id, "alegeri/2008", $url);
        // Locate these people and update them in several tables now.
        // We're mainly interested in updating the ID to the new ID that
        // will be in the People database, from the previous ID that was
        // the senator's ID in the senators table.
        mysql_query("UPDATE candidates " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']);
    }
}
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $q = new mysql();
    $sql = "SELECT * FROM officials_domains ORDER BY domain";
    writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $domains[$ligne["domain"]] = $ligne["domain"];
    }
    $OverWriteRestrictedDomains = 0;
    if ($users->OverWriteRestrictedDomains) {
        $OverWriteRestrictedDomains = 1;
    }
    if ($OverWriteRestrictedDomains == 1) {
        $over = "\n\t\t<hr>\n\t\t<div class=explain>{OverWriteRestrictedDomains_allow_text}</div>\n\t\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{domain}:</td>\n\t\t<td width=100%>" . Field_text("overwrite-domain", null, "font-size:16px;padding:3px;width:320px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{add}", "AddSubdomainOUOver()") . "</td>\n\t</tr>\n\t</table>\n\t\t";
    }
    $_GET["ou"] = urlencode($_GET["ou"]);
    $domains[null] = "{select}";
    $html = "\n\t<div id='add_subdomain_explain'></div>\n\t<div class=explain >{add_subdomain_explain}</div>\n\t\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend>{subdomain}:</td>\n\t\t<td width=50%>" . Field_text("subdomain", null, "font-size:16px;padding:3px;width:220px") . "</td>\n\t\t<td style='font-size:16px;padding:3px' width=1%><strong>.</strong></td>\n\t\t<td width=50%>" . Field_array_Hash($domains, "maindomain", null, "style:font-size:16px;padding:3px;") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=4 align='right'><hr>" . button("{add}", "AddSubdomainOU()") . "</td>\n\t</tr>\n\t</table>\n\t{$over}\n\t<script>\n\tvar x_AddSubdomainOU= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tdocument.getElementById('subdomain').innerHTML='';\n\t\tif(results.length>3){alert(results);return;}\n\t\tYahooWin4Hide();\n\t\tLoadAjax('LocalDomainsList','domains.edit.domains.php?LocalDomainList=yes&ou={$_GET["ou"]}');\n\t}\t\t\n\t\t\n\t\tfunction AddSubdomainOU(){\n\t\t\tvar maindomain=document.getElementById('maindomain').value;\n\t\t\tvar subdomain=document.getElementById('subdomain').value;\n\t\t\tif(maindomain.length<3){return;}\n\t\t\tif(subdomain.length<3){return;}\n\t\t\tvar domain=subdomain+'.'+maindomain;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('AddNewInternetDomain','{$_GET["ou"]}');\n\t\t\tXHR.appendData('AddNewInternetDomainDomainName',domain);\t\n\t\t\tAnimateDiv('add_subdomain_explain');\n\t\t\tXHR.sendAndLoad('domains.edit.domains.php', 'GET',x_AddSubdomainOU);\n\t\t\t\n\t\t}\n\t\t\n\t\tfunction AddSubdomainOUOver(){\n\t\t\tvar maindomain=document.getElementById('overwrite-domain').value;\n\t\t\tif(maindomain.length<3){return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('AddNewInternetDomain','{$_GET["ou"]}');\n\t\t\tXHR.appendData('AddNewInternetDomainDomainName',maindomain);\t\n\t\t\tAnimateDiv('add_subdomain_explain');\n\t\t\tXHR.sendAndLoad('domains.edit.domains.php', 'GET',x_AddSubdomainOU);\t\t\t\n\t\t}\n\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 6
0
 public function saveRatinglist()
 {
     foreach ($this->ratings as $player) {
         //Controleren of speler al bestaat + ophalen id
         $sql = "SELECT * FROM svn_leden WHERE knsb = " . $player["knsb"];
         $query = mysql_query($sql);
         if (mysql_num_rows($query) == 1) {
             $data = mysql_fetch_assoc($query);
             $player["id"] = $data["id"];
         } elseif (mysql_num_rows($query) == 0) {
             //Toevoegen van de speler
             print_r($player);
         }
         //Controleren of de rating al bestaat
         $sql = "SELECT * FROM svn_rating WHERE id = " . $player["id"] . " AND datum = '" . $this->ratingList . "'";
         $query = mysql_query($sql);
         if (mysql_num_rows($query) == 0) {
             //Toevoegen rating
             $sql = "INSERT INTO svn_rating VALUES ('',\"" . $this->ratingList . "\"," . $player["id"] . ",1," . $player["rating"] . ")";
             mysql_query($sql);
         }
     }
     $sql = "SELECT * FROM svn_leden WHERE knsb = " . $speler_geg["id"];
     $result = mysql_query($sql);
     $speler_dat = mysql_fetch_array($result);
     if ($speler_geg["rating"] != "") {
         $sql = "INSERT INTO svn_rating VALUES ('',\"" . $datum . "\"," . $speler_dat[0] . ",1," . $speler_geg["rating"] . ")";
         //echo $sql;
         mysql_query($sql);
     }
 }
Exemplo n.º 7
0
 public static function getById($from, $id)
 {
     $sql = "SELECT * FROM `" . $from . "` WHERE `id` = '" . $id . "'";
     $result = mysql_query($sql);
     $info = mysql_fetch_array($result);
     return $info;
 }
Exemplo n.º 8
0
 /**
  * 功能:数据库查询函数
  * 参数:$sql SQL语句
  * 返回:二唯数组或false
  */
 public function select($sql = "")
 {
     if (empty($sql)) {
         return false;
     }
     //如果SQL语句为空则返回FALSE
     if (empty($this->CONN)) {
         return false;
     }
     //如果连接为空则返回FALSE
     try {
         //捕获数据库选择错误并显示错误文件
         $results = mysql_query($sql, $this->CONN);
     } catch (Exception $e) {
         $msg = $e;
         echo $msg;
         include ERRFILE;
     }
     if (!$results or empty($results)) {
         //如果查询结果为空则释放结果并返回FALSE
         @mysql_free_result($results);
         return false;
     }
     $count = 0;
     $data = array();
     while ($row = @mysql_fetch_array($results)) {
         //把查询结果重组成一个二维数组
         $data[$count] = $row;
         $count++;
     }
     @mysql_free_result($results);
     return $data;
 }
Exemplo n.º 9
0
function getOneZLSelectResult($xmid, $pids = 0)
{
    $result = mysql_query("select ids,xm_fl from czj_xm where ids='{$xmid}'");
    $array = mysql_fetch_array($result);
    $xmfl = $array['xm_fl'];
    return mysql_query("select * from czj_xm_zl_select where xm_fl='{$xmfl}' and pids='{$pids}'");
}
Exemplo n.º 10
0
 function select()
 {
     global $table;
     $result = mysql_query('SELECT * from ' . $this->{$table} . ' limit 1;');
     $row = mysql_fetch_array($result);
     print_r($row);
 }
Exemplo n.º 11
0
 public function all($id)
 {
     $arr = array();
     if ($id == '') {
         $sql = "SELECT `venda`.`id`, `venda`.`nome`, `aula`.`endereco_video`, `aula`.`descricao`, `aula`.`curso_idcurso`, `aula`.`cliente_idcliente`, `curso`.`nome` AS `disciplina` FROM `aula` \n\t\tINNER JOIN `curso` ON `curso_idcurso`=`idcurso`;";
         $vai = new MySQLDB();
         $result = $vai->executeQuery($sql);
     } else {
         $sql = "SELECT `aula`.`idaula`, `aula`.`nome`, `aula`.`endereco_video`, `aula`.`descricao`, `aula`.`curso_idcurso`, `aula`.`cliente_idcliente`, `curso`.`nome` AS `disciplina` FROM `aula` \n\t\tINNER JOIN `curso` ON `curso_idcurso`=`idcurso` WHERE `aula`.`idaula` = {$id};";
         $vai = new MySQLDB();
         $result = $vai->executeQuery($sql);
     }
     while ($dados = mysql_fetch_array($result)) {
         $cliente = new Aula();
         $cliente->setidaula(array('idaula' => $dados['idaula']));
         $cliente->setnome(array('nome' => $dados['nome']));
         $cliente->setendereco_video(array('endereco_video' => $dados['endereco_video']));
         $cliente->setdescricao(array('descricao' => $dados['descricao']));
         $cliente->setcurso_idcurso(array('curso_idcurso' => $dados['curso_idcurso']));
         $cliente->setcliente_idcliente(array('cliente_idcliente' => $dados['cliente_idcliente']));
         $cliente->setdisciplina(array('disciplina' => $dados['disciplina']));
         $arr[] = $cliente;
     }
     return $arr;
 }
Exemplo n.º 12
0
function addm($char, $mes, $priv)
{
    setlocale(LC_ALL, "ru_RU.CP1251");
    if (!isset($char['sex']) || $char['sex'] == "male") {
        $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\1", $mes);
    } else {
        $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\2", $mes);
    }
    $mes = '<span style="color:#FF2828;font-size:12px;">' . iconv("Windows-1251", "UTF-8//IGNORE", $mes) . '</style>';
    $message = $mes;
    $message = mysql_real_escape_string($message);
    $sel = myquery("SELECT `count` FROM `game_bot_chat_resp` WHERE `id` = '" . $char['name'] . "';");
    $n = mysql_fetch_array($sel);
    if ($n['count'] <= 4) {
        myquery("INSERT INTO `game_bot_chat_resp` (`id`,`count`) VALUES ('" . $char['name'] . "','1') ON DUPLICATE KEY UPDATE `count` = `count` + 1;");
        $update_chat = myquery("insert into game_log (town,fromm,too,message,date,ptype) values (0,'-1','" . $char['user_id'] . "','" . $message . "','" . time() . "'," . $priv . ")");
    } else {
        $sel = myquery("SELECT `text` FROM `game_bot_chat_annoy` ORDER BY RAND() ASC LIMIT 1");
        $mes = mysql_fetch_array($sel);
        if (!isset($char['sex']) || $char['sex'] == "male") {
            $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\1", $mes);
        } else {
            $mes = preg_replace("/\\{([\\d\\w\\s]*?)\\|([\\d\\w\\s]*?)\\}/i", "\\2", $mes);
        }
        $message = mysql_real_escape_string('<span style="color:#FF2828;font-size:12px;">' . iconv("Windows-1251", "UTF-8//IGNORE", $mes['text']) . '</style>');
        $update_chat = myquery("insert into game_log (town,fromm,too,message,date,ptype) values (0,'-1','" . $char['user_id'] . "','" . $message . "','" . time() . "'," . $priv . ")");
    }
}
Exemplo n.º 13
0
 public function autenticar($email, $passwd)
 {
     $search = "SELECT * FROM `usuarios` WHERE `usuarios`.`email` = '" . $email . "' AND `usuarios`.`senha` = '" . md5($passwd) . "';";
     $res = mysql_query($search);
     if (!$res) {
         die('Consulta inválidaaaaaaa! ' . $search);
     }
     if ($aux = mysql_fetch_array($res)) {
         if ($aux['validation_status'] == 1) {
             return -1;
         } else {
             if ($aux['validation_status'] == 2) {
                 return -2;
             } else {
                 $this->authenticatedCPF = $aux['cpf'];
                 while (strlen($this->authenticatedCPF) < 11) {
                     $this->authenticatedCPF = "0" . $this->authenticatedCPF;
                 }
                 return $aux['nivel_acesso'];
             }
         }
     } else {
         $this->authenticatedCPF = 0;
         return 0;
     }
 }
Exemplo n.º 14
0
function getInsert($param, $name, $score)
{
    $dbParams = get_object_vars($param);
    $mysql_host = $dbParams['mysql_host'];
    $mysql_user = $dbParams['mysql_user'];
    $mysql_pass = $dbParams['mysql_pass'];
    $dbName = $dbParams['dbName'];
    $dbTable = $dbParams['dbTable'];
    //connect
    $link = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('connection error: ' . mysql_error());
    //select db
    mysql_select_db($dbName) or die('DB error');
    //check user highest score
    $query_check_user = '******' . $dbTable . ' WHERE name = ' . $name . ';';
    $result_check_user = mysql_query($query_check_user) or die('Request down: ' . mysql_error());
    $checkUser = mysql_fetch_array($result_check_user);
    if ($checkUser['score'] < $score) {
        //inserting new scores
        $query_insert = 'INSERT INTO ' . $dbTable . '(name,score) VALUES (' . $name . ',' . $score . ') ON DUPLICATE KEY UPDATE score = VALUES(score);';
        $result = mysql_query($query_insert) or die('Request insert down: ' . mysql_error());
    }
    return $result;
    // clean
    if (isset($result)) {
        mysql_free_result($result);
    }
    // close
    mysql_close($link);
}
Exemplo n.º 15
0
 function user_email($user_id)
 {
     global $DB, $LINK;
     $RS = $DB->query("SELECT email FROM users WHERE id='" . $user_id . "'", $LINK);
     $data = mysql_fetch_array($RS);
     return $data["email"];
 }
Exemplo n.º 16
0
function getEvent($id, $info)
{
    $result = mysql_query("SELECT {$info} FROM `UCPM_appointments` WHERE appID={$id}");
    while ($row = mysql_fetch_array($result)) {
        return $row[$info];
    }
}
function get_branch_name($branch_id)
{
    $query = mysql_query("select branch_name as result from branches where branch_id = '{$branch_id}'");
    $row = mysql_fetch_array($query);
    $result = $row['result'];
    return $result;
}
Exemplo n.º 18
0
 function DrawPart($parent, $pref)
 {
     $res = runsql("select t.{$this->id},t.Name_\$lang; as Name from {$this->table} t left outer join {$this->table} p on p.{$this->id}=t.{$this->id} where t.Parent='{$parent}' and t.{$this->id}<>t.Parent group by t.{$this->id} order by t.Name_\$lang;");
     if (mysql_error()) {
         print mysql_error();
         exit;
     }
     while ($r = mysql_fetch_array($res)) {
         $num++;
         unset($str);
         if ($pref) {
             $str = "{$pref}";
         }
         if ($this->numbered == 1) {
             $str .= "{$num}.";
         } elseif ($parent != '0') {
             $str .= "&nbsp;&nbsp;";
         }
         if ($this->type == "select") {
             print " <option value=\"{$r['0']}\"";
             if ($r[0] == $this->val) {
                 print " selected";
             }
             print ">{$str} {$r['1']}</option>";
         } else {
             print "{$str} <a href=\"{$PHP_SELF}?id={$r['0']}\">{$r['1']}</a>";
             print "<br>";
         }
         $r[types] += $this->DrawPart($r[0], $str);
     }
     return $r[types];
 }
Exemplo n.º 19
0
function get_img_old($id)
{
    $query = mysql_query("select menu_img from menus \n\t\t\t\t\t\twhere menu_id = '" . $id . "'");
    $result = mysql_fetch_array($query);
    $row = $result['menu_img'];
    return $row;
}
Exemplo n.º 20
0
function sqlQuery($sql)
{
    global $db_conn;
    // execute query
    $db_result = mysql_query($sql, $db_conn);
    // if db_result is null then trigger error
    if ($db_result === null) {
        trigger_error(mysql_errno() . ": " . mysql_error() . "\n");
        exit;
    }
    // prepare result array
    $resultSet = array();
    // if resulted array isn't true and that is in case of select statement then open loop
    // (insert / delete / update statement will return true on success)
    if ($db_result !== true) {
        // loop through fetched rows and prepare result set
        while ($row = mysql_fetch_array($db_result, MYSQL_NUM)) {
            // first column of the fetched row $row[0] is used for array key
            // it could be more elements in one table cell
            $resultSet[$row[0]][] = $row;
        }
    }
    // return result set
    return $resultSet;
}
Exemplo n.º 21
0
function get_user_paid_expenses_test($userid_array)
{
    if (is_array($userid_array)) {
        $userids = implode(",", $userid_array);
    } else {
        $userids = $userid_array;
    }
    $sql = "SELECT user_id as userid, expense_id as exid, group_id, amount, UNIX_TIMESTAMP(expense_date) AS expensedate, \n            description FROM expenses WHERE user_id in ({$userids})";
    if (!($result = mysql_query($sql))) {
        return false;
    } else {
        $total = 0;
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $paid['users'][$row['userid']]['groups'][$row['group_id']][$row['exid']]['amount'] = $row['amount'];
            $paid['users'][$row['userid']]['groups'][$row['group_id']][$row['exid']]['expense_date'] = date("j M Y", $row['expensedate']);
            $paid['users'][$row['userid']]['groups'][$row['group_id']][$row['exid']]['description'] = $row['description'];
            $paid['users'][$row['userid']]['groups'][$row['group_id']]['group_total'] += $row['amount'];
            $paid['users'][$row['userid']]['user_total'] += $row['amount'];
            $total += $row['amount'];
            // format totals with two decimals
            $paid['users'][$row['userid']]['groups'][$row['group_id']]['total'] = number_format($paid['users'][$row['userid']]['groups'][$row['group_id']]['total'], DECIMALS, DSEP, TSEP);
            $paid['users'][$row['userid']]['total'] = number_format($paid['users'][$row['userid']]['total'], DECIMALS, DSEP, TSEP);
            $paid['users'][$row['userid']]['groups'][$row['group_id']][$row['exid']]['running_total'] += $row['amount'] + $last_running[$row['userid']][$row['group_id']];
            $last_running[$row['userid']][$row['group_id']] = $paid['users'][$row['userid']]['groups'][$row['group_id']][$row['exid']]['running_total'];
        }
        $paid['total'] = number_format($total, DECIMALS, DSEP, TSEP);
    }
    // array structure: ['users'][$userid]['groups'][$groupid][$expenseid]['amount|expense_date|description']
    return $paid;
}
Exemplo n.º 22
0
function showTransactionsTable($QueryResolt)
{
    echo <<<END
\t<table class = 'TransactionsTable'>
\t<tr class = 'TrHeadLine'>
\t\t<td class = 'TrCell' >Account</td>
\t\t<td class = 'TrCell' >Description</td>
\t\t<td class = 'TrCell' >CurrencyCode</td>
\t\t<td class = 'TrCell' >Ammount</td>
\t</tr>\t\t
END;
    while ($Line = mysql_fetch_array($QueryResolt, MYSQL_ASSOC)) {
        echo <<<END

\t\t<tr class = 'TrLine'>
\t\t\t<td class = 'TrCell' ><a href = "dit.php?id='{$Line["id"]}'">{$Line["Account"]}</a></td>
\t\t\t<td class = 'TrCell' >{$Line["Description"]}</td>
\t\t\t<td class = 'TrCell' >{$Line["CurrencyCode"]}</td>
\t\t\t<td class = 'TrCell' >{$Line["Ammount"]}</td>
\t\t</tr>\t
\t\t
END;
    }
    echo '</table>';
    showPageNavigation();
}
 public function browserCount()
 {
     $ie = $ff = $saf = $chr = $op = $kon = $lyn = $sum = 0;
     $result = $this->db->select();
     while ($array = mysql_fetch_array($result)) {
         $favBrowser = $array['FavouriteBrowser'];
         if ($favBrowser == 'internet explorer') {
             ++$ie;
         } elseif ($favBrowser == 'firefox') {
             ++$ff;
         } elseif ($favBrowser == 'safari') {
             ++$saf;
         } elseif ($favBrowser == 'chrome') {
             ++$chr;
         } elseif ($favBrowser == 'opera') {
             ++$op;
         } elseif ($favBrowser == 'konqueror') {
             ++$kon;
         } elseif ($favBrowser == 'lynx') {
             ++$lyn;
         }
         ++$sum;
     }
     $calculator = new Calculator($ie, $ff, $saf, $chr, $op, $kon, $lyn, $sum);
     $this->rawCountArray = $calculator->convertToArray();
     $this->percentageArray = $calculator->browserPercentage();
 }
Exemplo n.º 24
0
function hourGraphEnergy($timeScale)
{
    include 'config.php';
    include 'general.php';
    // Get all the appliances to retrieve data for
    $applianceChannels = getDeviceChannels();
    $applianceArray = array();
    $count = 0;
    // Array to store the number channels each appliance has
    //$applianceChannelCount = countChannelsPerAppliance($applianceChannels);
    // Loop through results again to build data to be returned
    while ($row = mysql_fetch_array($applianceChannels)) {
        $where = getHourSqlWhereClause($row[$CHANNEL_ID_PK_FIELD_NAME], $timeScale);
        $group = getHourSqlGroupByClause();
        $query = "SELECT HOUR(" . $DATE_TIME_FIELD_NAME . "), AVG(" . $DATA_FIELD_NAME . "), " . $UNIT_FIELD_NAME . " " . "FROM " . $DATA_TABLE_FIELD_NAME . " " . $where . $group;
        $result = executeQuery($query);
        $seriesArray = array("chId" => $row[$CHANNEL_ID_PK_FIELD_NAME], "label" => $row[$APPLIANCE_DISPLAY_NAME_FIELD_NAME], "color" => $count, "data" => convertResultToArray($result));
        array_push($applianceArray, $seriesArray);
        $count++;
        // Ensure 1 is always the temperature colour because it's blue
        if ($count == 1) {
            $count++;
        }
    }
    return $applianceArray;
}
Exemplo n.º 25
0
function getNumTaxtype()
{
    $sql = "select count(taxtype) from cri_ro_taxtypes where status=1";
    $result = mysql_query($sql);
    $total = mysql_fetch_array($result);
    return $total[0];
}
Exemplo n.º 26
0
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ID = $_GET["ID"];
    $sql = "SELECT * FROM webfilter_rules WHERE ID={$ID}";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $more8chars = $tpl->javascript_parse_text("{more8chars}");
    if ($ID == 0) {
        $sock = new sockets();
        $ligne = unserialize(base64_decode($sock->GET_INFO("DansGuardianDefaultMainRule")));
    }
    if ($ligne["BypassSecretKey"] == null) {
        $ligne["BypassSecretKey"] = md5(time());
    }
    $TIMES[0] = "{none}";
    $TIMES[300] = "5 {minutes}";
    $TIMES[900] = "15 {minutes}";
    $TIMES[1800] = "30 {minutes}";
    $TIMES[3600] = "1 {hour}";
    $TIMES[7200] = "2 {hours}";
    $TIMES[14400] = "4 {hours}";
    $t = time();
    $html = "\n\t<div id='{$t}'>\n\t<div class=text-info style='font-size:14px'>{TemporaryDeniedPageBypassExplain}<br>{BypassSecretKeyExplain}</div>\n\t<table style='width:99%' class=form>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{bypassFor}:</td>\n\t\t\t<td>" . Field_array_Hash($TIMES, "bypass{$t}", $ligne["bypass"], "style:font-size:16px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{BypassSecretKey}:</td>\n\t\t\t<td>" . Field_password("BypassSecretKey{$t}", $ligne["BypassSecretKey"], "font-size:16px;width:220px") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "bypassForSave()") . "</td>\n\t\t</tr>\n\t\t\n\t</tbody>\n\t</table>\n\t</div>\n\t<script>\n\tvar x_bypassForSave= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tvar ID='{$ID}';\n\t\tif (res.length>3){alert(res);}\n\t\tYahooWin4Hide();\n\t}\n\t\n\t\tfunction bypassForSave(){\n\t\t      var XHR = new XHRConnection();\n\t\t      \n\t\t      var bypass=document.getElementById('bypass{$t}').value;\n\t\t      if(bypass.length<8){alert('{$more8chars}');return;}\n\t\t      XHR.appendData('bypass', document.getElementById('bypass{$t}').value);\n\t\t      XHR.appendData('BypassSecretKey', document.getElementById('BypassSecretKey{$t}').value);\n\t\t      XHR.appendData('ID','{$ID}');\n\t\t      AnimateDiv('{$t}');\n\t\t      XHR.sendAndLoad('{$page}', 'POST',x_bypassForSave);  \t\t\n\t\t}\n\t</script>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 27
0
function Name_2_ID($Name)
{
    $link = mysql_connect("localhost", "Reciplan", "reciplan");
    if (!$link) {
        die("Connection Failed." . mysql_error());
    }
    $dbselect = mysql_select_db('Neighbor', $link);
    if (!$dbselect) {
        die("DB Select Failed." . mysql_error());
    }
    $chartype = mysql_query("SET NAMES utf8", $link);
    if (!$chartype) {
        die("Query Failed." . mysql_error());
    }
    $Name = mb_convert_encoding($Name, "UTF8", "auto");
    $query = sprintf("SELECT City_ID.City_ID  FROM City_ID WHERE City_Name = '%s' ", $Name);
    //print($query);
    $result = mysql_query($query);
    // MySQL に送られたクエリと返ってきたエラーをそのまま表示します。デバッグに便利です。
    if (!$result) {
        $message = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    $data = mysql_fetch_array($result);
    //		print_r($data);
    mysql_close($link);
    return $data['City_ID'];
}
Exemplo n.º 28
0
 public function find()
 {
     $result = array();
     $where = 'where 1 = 1 ';
     foreach ($this->columns as $objCol => $dbCol) {
         if ($this->{$objCol}) {
             $where .= " and {$dbCol} = {$this->{$objCol}}";
             //only bug: here I " and {$objCol} = {$this->$objCol}"; but with former experience, I know that database handling is the place where bug fills. So I var_dump($sql) and find it.
         }
     }
     $sql = "select * from {$this->table} {$where}";
     //		var_dump($sql);
     DataConnection::getConnection();
     $rs = mysql_query($sql) or die(mysql_error());
     $row = mysql_fetch_array($rs);
     while ($row) {
         $o = clone $this;
         foreach ($o->columns as $objCol => $dbCol) {
             $o->{$objCol} = $row[$dbCol];
         }
         $result[] = $o;
         $row = mysql_fetch_array($rs);
     }
     return $result;
 }
function alertnoticias_consultar($consulta,$accion)
{
	$enlace = mysql_connect('atc-nh-natsdb.nationalnet.com', 'staffcenter','XgwofvLY2ayLf') or die('No pudo conectarse : ' . mysql_error());
	mysql_select_db('staffcenter',$enlace) or die('No pudo seleccionarse la BD.');
	$sql = $consulta;
	$resultado = mysql_query($sql,$enlace) or die('La consulta fall&oacute;: ' . mysql_error());
	while ($row = mysql_fetch_array($resultado)){
	
		switch($accion)
		{
			case "noticiasdeldia":
				$idsnoticias[]=$row['idnoticia'].",".$row['titulo'];
			break;
		
		}
	}
	mysql_free_result($resultado);
	
	switch($accion)
	{
		case "noticiasdeldia":
			return $idsnoticias;
		break;
	}
}
Exemplo n.º 30
0
 function singleQuery($s, $p = array())
 {
     $res = $this->exec($s, $p);
     $row = mysql_fetch_array($res);
     mysql_free_result($res);
     return $row[0];
 }