function findTrackData($delta, $pic_time, $datum, $pic_id) { //Bestimmung des Trackpunktes mit der kleinsten zeitlichen Abweichung vom Aufnahme-Zeitpunkt: include '../../share/global_config.php'; include $sr . '/bin/share/db_connect1.php'; if (!isset($i10)) { $i10 = 0; } $delta = $delta - 1; $start_time = date('H:i:s', strtotime("{$pic_time} - {$delta} seconds")); $end_time = date('H:i:s', strtotime("{$pic_time} + {$delta} seconds")); //echo "Zeitgrenzen fuer Trackdaten: ".$start_time." - ".$end_time."<BR>"; $result8 = mysql_query("SELECT * FROM {$table13} WHERE date = '{$datum}' AND (time = '{$start_time}' OR time = '{$end_time}')"); $num8 = mysql_num_rows($result8); //Wenn mehrere Trackpunkte gefunden werden, werden willkuerlich die Daten des ersten verwendet: $longitude = mysql_result($result8, 0, 'longitude'); $latitude = mysql_result($result8, 0, 'latitude'); $altitude = mysql_result($result8, 0, 'altitude'); //in der 'locations' gespeichert und mit dem Bild 'pic_id' verknuepft: $result9 = mysql_query("INSERT INTO {$table12} (longitude, latitude, altitude) VALUES ('{$longitude}', '{$latitude}', '{$altitude}')"); echo mysql_error(); $result10 = mysql_query("SELECT max(loc_id) FROM {$table12}"); $loc_id = mysql_result($result10, $i10, 'max(loc_id)'); //echo "<".$loc_id." >"; $result11 = mysql_query("UPDATE {$table2} SET loc_id = '{$loc_id}' WHERE pic_id = '{$pic_id}'"); }
function selectrec($fields, $table, $cond = "") { $a = array(); $query = "select " . $fields . " from " . $table; if (!($cond == "")) { $query = $query . " where " . $cond; } //echo "<br>".$query; $result = mysql_query($query); //echo mysql_error(); //if (mysql_error()!="") //echo "<br>".$query; $numrows = mysql_num_rows($result); $numfields = mysql_num_fields($result); $i = $j = 0; while ($i < $numrows) { while ($j < $numfields) { $a[$i][$j] = mysql_result($result, $i, mysql_field_name($result, $j)); $j++; } $i++; $j = 0; } mysql_free_result($result); return $a; }
public function seleccionar_valor_condicion($columna, $fila, $condicion, $c_valor) { $consulta = mysql_result(mysql_query("SELECT {$columna} FROM {$fila} WHERE {$condicion}='" . $c_valor . "' ", $this->link), 0); echo $consulta; mysql_free_result($consulta); mysql_close($this->link); }
function upd_last_cast($pl, $spell) { //$pl = preg_replace ('/[^a-z0-9_]/i', '', $pl); //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell); $now = time(); $id = is_player($pl); if (!$id) { put_error('npc cant cast spell'); } $q = do_mysql("SELECT last FROM players WHERE id_player = '" . $id . "';"); $last = mysql_result($q, 0); $last = explode('|', $last); // vremja zaklinanija: $q = do_mysql("SELECT timewait FROM magic WHERE fullname = '" . $spell . "';"); if (!mysql_num_rows($q)) { put_error('there are no such spell: ' . $spell . ''); } $tw = mysql_result($q, 0); $last[3] = $now + $tw; // obrabotka effektami: #include_once ('modules/f_get_affected.php'); // effecty: #$aff = get_affected ($LOGIN); // primer: if (is_in ('oglushen', $aff)) $last[3] += 10; $nlast = $last[0] . '|' . $last[1] . '|' . $last[2] . '|' . $last[3] . '|' . $last[4] . '|' . $last[5] . '|' . $last[6] . '|' . $last[7] . '|' . $last[8]; do_mysql("UPDATE players SET last = '" . $nlast . "' WHERE id_player = '" . $id . "';"); return 1; }
/** * Logs this stake leader into the session given username and password * @var $eml = The email address * @var $pwd = The plaintext password (will be salted and hashed) * @return If successful, the StakeLeader object. Otherwise null. */ public static function Login($eml, $pwd) { // Sanitize input $eml = DB::Safe($eml); // First, we need to obtain this stake leader's unique salt $r = DB::Run("SELECT `Salt` FROM `Credentials` WHERE `Email`='{$eml}' AND `StakeLeaderID` > 0 LIMIT 1"); if (mysql_num_rows($r) == 0) { return null; } $salt = mysql_result($r, 0); // Now hash input according to our hashing algorithm and leader's salt $pwd = hashPwd($pwd, $salt); // See if the email/password combination are correct $try = DB::Run("SELECT StakeLeaderID FROM Credentials WHERE Email='{$eml}' AND Password='******' AND StakeLeaderID > 0 LIMIT 1"); if (mysql_num_rows($try) == 0) { return null; } // At this point, valid credentials were entered. Proceed... $stakeLeaderID = mysql_result($try, 0); $stakeLeader = StakeLeader::Load($stakeLeaderID); // Update LastActivity $stakeLeader->UpdateLastActivity(); // Since they've logged in, no more need for existing // password reset tokens. Delete any strays for security. $q = "DELETE FROM PwdResetTokens WHERE CredentialsID={$stakeLeader->CredentialsID()}"; DB::Run($q); // Save the session. This is the actual "logging in" part. session_regenerate_id(); // Helps prevent session hijacking $_SESSION["stakeLeaderID"] = $stakeLeaderID; $_SESSION["timestamp"] = time(); $_SESSION["ipaddress"] = $_SERVER['REMOTE_ADDR']; return $stakeLeader; }
function affichage_liste_bulletins_normale($res) { global $charset, $dbh; while ($tableau = mysql_fetch_array($res)) { $sql = "SELECT COUNT(1) FROM explnum WHERE explnum_bulletin='" . $tableau["bulletin_id"] . "'"; $result = @mysql_query($sql, $dbh); $count = mysql_result($result, 0, 0); print "<span class='liste_bulletins'>"; if ($count) { $padding = ""; print '<img src="./images/attachment.png">'; } else { $padding = "style=\"padding-left:11px;\""; } print "<a href=./index.php?lvl=bulletin_display&id=" . $tableau['bulletin_id'] . " " . $padding . ">" . $tableau['bulletin_numero']; if ($tableau['mention_date']) { print pmb_bidi(" (" . $tableau['mention_date'] . ")\n"); } elseif ($tableau['date_date']) { print pmb_bidi(" (" . formatdate($tableau['date_date']) . ")\n"); } if ($tableau['bulletin_titre']) { print pmb_bidi(" : " . htmlentities($tableau['bulletin_titre'], ENT_QUOTES, $charset) . "\n"); } print "</a> ;"; print "</span>\n"; } }
/** * displayBannedUsers - Displays the banned users * database table in a nicely formatted html table. */ function displayBannedUsers(){ global $database; $q = "SELECT username,timestamp " ."FROM ".TBL_BANNED_USERS." ORDER BY username"; $result = $database->query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; return; } if($num_rows == 0){ echo "Database table empty"; return; } /* Display table contents */ echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n"; echo "<tr><td><b>Username</b></td><td><b>Time Banned</b></td></tr>\n"; for($i=0; $i<$num_rows; $i++){ $uname = mysql_result($result,$i,"username"); $time = mysql_result($result,$i,"timestamp"); echo "<tr><td>$uname</td><td>$time</td></tr>\n"; } echo "</table><br>\n"; }
public function Siguiente_Etapa($etapa) { $query = sprintf("select et_siguiente_etapa from etapas where et_id=%s", $etapa); $rst = parent::consultar($query); $etapa = mysql_result($rst, 0, 0); return $etapa; }
public function index() { if ($this->session->userdata("login_id") == '') { redirect("login"); } if ($this->input->post("post_create_ad")) { $this->postad_property_model->postad_creat(); } $data = array("property_residential" => $this->category_model->property_residential(), "property_commercial" => $this->category_model->property_commercial(), "title" => "Classifieds", "content" => "postad_create_property"); $cat = $this->input->post('property_cat'); $sub_cat = $this->input->post('property_sub'); $sub_sub_cat = $this->input->post('property_sub_sub'); $sub_name = @mysql_result(mysql_query("SELECT * FROM `sub_category` WHERE sub_category_id = '{$sub_cat}'"), 0, 'sub_category_name'); $sub_sub_name = @mysql_result(mysql_query("SELECT * FROM `sub_subcategory` WHERE `sub_subcategory_id` = '{$sub_sub_cat}'"), 0, 'sub_subcategory_name'); if ($sub_name == '') { redirect('post-a-deal'); } $data['cat'] = $cat; $data['sub_name'] = $sub_name; $data['sub_sub_name'] = $sub_sub_name; /*id for category*/ $data['sub_id'] = $sub_cat; $data['sub_sub_id'] = $sub_sub_cat; $data['login_id'] = $this->session->userdata("login_id"); $data['package_name'] = $this->category_model->package_name(); $data['free_pkg_list'] = $this->category_model->free_pkg_list(); $data['gold_pkg_list'] = $this->category_model->gold_pkg_list(); $data['ptm_pkg_list'] = $this->category_model->ptm_pkg_list(); $data['urgentlabel1'] = $this->category_model->urgentlabel1(); $data['urgentlabel2'] = $this->category_model->urgentlabel2(); $data['urgentlabel3'] = $this->category_model->urgentlabel3(); $data['free_likes'] = $this->category_model->free_likes(); $data['gold_likes'] = $this->category_model->gold_likes(); $this->load->view("classified_layout/inner_template", $data); }
function decr_abstr_misc($prot, $who, $count, $other = 0) { //$prot = preg_replace ('/[^a-z0-9_\.]/i', '', $prot); $count = preg_replace('/[^0-9]/', '', $count); //$who = preg_replace ('/[^a-z0-9_]/i', '', $who); if (!is_player($who)) { return 0; } if ($count < 1) { return 0; } $q = do_mysql("SELECT on_take FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';"); if (!mysql_num_rows($q)) { return 0; } $ci = mysql_result($q, 0); if ($ci < $count) { return 0; } $ci -= $count; if ($ci) { do_mysql("UPDATE items SET on_take = '" . $ci . "' WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "';"); } else { include_once 'modules/f_delete_item.php'; $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';"); $item = mysql_result($q, 0); delete_item($item); } return 1; }
function login($username, $password) { $user_id = user_id_from_username($username); $username = sanitize($username); $password = md5($password); return mysql_result(mysql_query("SELECT COUNT(user_id) FROM users WHERE username = '******' AND password = '******'"), 0) == 1 ? $user_id : false; }
function user_role($username) { $username = sanitize($username); $query = mysql_query("SELECT Role FROM user WHERE Username = '******'"); $result = mysql_result($query, 0); return $result; }
function predict($userID, $itemID) { global $connection; $denom = 0.0; //denominator $numer = 0.0; //numerator $k = $itemID; $sql = "SELECT r.itemID, r.ratingValue FROM rating r WHERE r.userID='" . $userID . "' AND r.itemID <> '" . $itemID . "'"; $db_result = mysql_query($sql); //for all items the user has rated while ($row = mysql_fetch_assoc($db_result)) { $j = $row["itemID"]; $ratingValue = $row["ratingValue"]; //get the number of times k and j have both been rated by the same user $sql2 = "SELECT d.count, d.sum FROM dev d WHERE itemID1={$k} AND itemID2={$j}"; $count_result = mysql_query($sql2, $connection); //skip the calculation if it isn't found if (mysql_num_rows($count_result) > 0) { $count = mysql_result($count_result, 0, "count"); $sum = mysql_result($count_result, 0, "sum"); //calculate the average $average = $sum / $count; //increment denominator by count $denom += $count; //increment the numerator $numer += $count * ($average + $ratingValue); } } if ($denom == 0) { return 0; } else { return $numer / $denom; } }
function login($username, $password) { $user_id = user_id_from_username($username); $username = sanitize($username); $password = hash('sha512', $password); return mysql_result(mysql_query("SELECT COUNT(`user_id`) FROM `bplay_users` WHERE `username`='{$username}' AND `password`='{$password}'"), 0) == 1 ? $user_id : false; }
function login($email, $password) { $user_id = user_id_from_email($email); $email = sanitize($email); $password = MD5($password); return mysql_result(mysql_query("SELECT COUNT(user_id) FROM users WHERE email = '{$email}' AND password = '******'"), 0) == 1 ? $user_id : false; }
function page($theme) { include "includes/smileyparse.php"; if (isset($_GET['page'])) { $page = $_GET['page']; $query = "SELECT * FROM pages WHERE id_string = '{$page}'"; $result = mysql_query($query); $num = mysql_numrows($result); if ($num == 0) { echo '<div class="entry">No such page!</div>'; } else { $id = mysql_result($result, 0, "id"); $title = mysql_result($result, 0, "title"); $page = mysql_result($result, 0, "page"); $page = parseSmiley($page); $page = stripslashes($page); echo '<div class="entry"><h3>'; echo $title; echo '</h3><p>'; echo $page; echo '</div>'; } } else { echo '<div class="entry">You must specify a page!</div>'; } }
/** * Adds a new channel processing job to the data store * * @param \Swiftriver\Core\ObjectModel\Channel $channel */ public static function AddNewChannelProgessingJob($channel) { if (!isset($channel)) { return; } $id = ereg_replace("[^A-Za-z0-9 _]", "", $channel->GetId()); $query = "SELECT COUNT(*) FROM channelprocessingjobs WHERE id = '" . $id . "';"; $result = self::RunQuery($query); $result = mysql_result($result, 0); if ($result > 0) { return; } $type = $channel->GetType(); $updatePeriod = $channel->GetUpdatePeriod(); $nextrun = time() + $updatePeriod * 60; $nextrun = date("Y-m-d H:i:s", $nextrun); $rawParameters = $channel->GetParameters(); $parameters = ""; foreach (array_keys($channel->GetParameters()) as $key) { $encodedKey = urlencode($key); $encodedValue = urlencode($rawParameters[$key]); $parameters .= $encodedKey . "," . $encodedValue . "|"; } $parameters = rtrim($parameters, "|"); $query = "INSERT INTO channelprocessingjobs VALUES(" . "'" . $id . "'," . "'" . $type . "'," . "'" . $parameters . "'," . $updatePeriod . "," . "'" . $nextrun . "'," . "null," . "null," . "0," . "1);"; $result = self::RunQuery($query); }
function display_dms_header($number_of_columns = 3) { global $xoopsDB; $query = "SELECT data from " . $xoopsDB->prefix('dms_config') . " WHERE name='dms_title'"; $title = mysql_result(mysql_query($query), 'data'); print " <tr><td colspan='" . $number_of_columns . "' class='cHeader'><center><b><font size='2'>" . $title . "</font></b></center></td></tr>\r"; }
function update_restaurant() { $dbc = mysql_connect('localhost', 'root', 'rishi'); if (!$dbc) { die('NOT CONNECTED:' . mysql_error()); } $db_selected = mysql_select_db("restaurant", $dbc); if (!$db_selected) { die('NOT CONNECTED TO DATABASE:' . mysql_error()); } echo "<form name = \"form1\" action = \"update_restaurant_values.php\" method =\"post\" align=\"center\" onsubmit=\"return checkscript()\">" . "\n"; echo "<table style=\"text-align:center;\" align=\"center\" width=\"400\">" . "\n"; $query = "SELECT * from RESTAURANT;"; $rest = mysql_query($query); $num_fields = mysql_num_fields($rest); for ($i = 0; $i < $num_fields; $i++) { echo "<tr>" . "\n"; echo "<td>" . "\n"; $field = mysql_field_name($rest, $i); echo "<b>" . $field . "</b>" . "\n"; echo "</td>" . "\n"; echo "<td>" . "\n"; $res = mysql_result($rest, 0, $i); if ($i) { echo "<input type = \"text\" name = \"{$field}\" value=\"{$res}\">"; } else { echo "<input type = \"text\" name = \"{$field}\" value=\"{$res}\" readonly=\"readonly\">"; } echo "</td>" . "\n"; echo "</tr>" . "\n"; } echo "</table>" . "\n" . "<br/>"; echo "<input type=\"submit\" name=\"submitbutton\" value=\"Update\">" . "\n"; echo "</form>" . "\n"; }
function include_racestats_text() { // Get Total Number of Tribes $strSQL = "SELECT COUNT(*) as total " . "FROM " . TBL_STAT . " " . "WHERE " . ALLIANCE . " > 10"; $iTotal = mysql_result(mysql_query($strSQL), 0, 0); $iTotal2 = 0; // Get All Races include_once 'inc/classes/clsRace.php'; $arrRaces = clsRace::getRaces(); $arrActiveRaces = clsRace::getActiveRaces(); // Begin Create Table $strRaceStatsTable = '<table cellspacing="0" cellpadding="0" class="small">' . '<tr class="header">' . '<th colspan="2">' . "Racial Stats" . "</th>" . "</tr>" . '<tr class="subheader">' . "<th>" . "Race" . "</th>" . '<th class="right">' . "%" . "</th>" . "</tr>"; for ($i = 0; $i < count($arrRaces); $i++) { // Give each 3rd row a border down $strStyle = ''; //if (($i % 3) == 0) { $strStyle = ' class = "bsdown" '; } if (!in_array($arrRaces[$i], $arrActiveRaces)) { $strStyle = ' style="font-style:italic;"'; } // Get Number of Tribes of the Current Race $SQL = "SELECT id FROM " . TBL_STAT . " " . "WHERE " . RACE . " = '{$arrRaces[$i]}' AND " . ALLIANCE . " > 10"; $count[$i] = mysql_num_rows(mysql_query($SQL)); $iTotal2 += $count[$i]; $strRaceStatsTable .= '<tr class="data">' . "<th{$strStyle}>" . $arrRaces[$i] . "</th>" . "<td{$strStyle}>" . round($count[$i] / $iTotal * 100, 2) . " %</td>" . "</tr>"; } $strRaceStatsTable .= '<tr class="data">' . "<th>" . "Unknown" . "</th>" . "<td>" . round(($iTotal - $iTotal2) / $iTotal * 100, 2) . " %</td>" . "</tr>" . "</table>"; echo $strRaceStatsTable; }
function Result($row, $name) { if ($this->Rows() > 0) { return mysql_result($this->result, $row, $name); } return null; }
function getElements($kat_id, $knoten_arr, $KAT_ID, $ID, $mod, $modus, $base_file) { include 'db_connect1.php'; include 'global_config.php'; //include 'functions/ajax_functions.php'; $result10 = mysql_query("SELECT * FROM {$table4} WHERE parent='{$kat_id}' ORDER BY kategorie"); $num10 = mysql_num_rows($result10); for ($i10 = 0; $i10 < $num10; $i10++) { $kategorie = mysql_result($result10, $i10, 'kategorie'); $parent = mysql_result($result10, $i10, 'parent'); $level = mysql_result($result10, $i10, 'level'); $kat_id = mysql_result($result10, $i10, 'kat_id'); $space = ''; for ($N = 0; $N < $level; $N++) { $space .= "   "; } $kat_id_pos = array_search($kat_id, $knoten_arr); $kat_id_back = $knoten_arr[$kat_id_pos - 1]; if (in_array($kat_id, $knoten_arr)) { $img = "<IMG src='../../share/images/minus.gif' width='11' height='11' hspace='0' vspace='0' border='0'>"; echo "<TR id='kat'>\n\t\t\t\t\t<TD id='kat1'>\n\t\t\t\t\t" . $space . "<a href='{$ziel}?kat_id={$kat_id_back}&mod={$mod}&pic_id=0'>" . $img . "</a> "; echo "<SPAN style='cursor:pointer;' onClick='getPreview(\"{$KAT_ID}\",\"{$kat_id}\",\"{$mod}\",0,\"{$modus}\",\"{$base_file}\")'>" . $kategorie . "</SPAN>"; echo "\n\t\t\t\t\t</TD>\n\t\t\t\t\t</TR>"; getElements($kat_id, $knoten_arr, $KAT_ID, $ID, $mod, $modus, $base_file); } else { $img = "<IMG src='../../share/images/plus.gif' width='11' height='11' hspace='0' vspace='0' border='0'>"; echo "<TR id='kat'>\n\t\t\t\t\t<TD id='kat1'>\n\t\t\t\t\t" . $space . "<a href='{$ziel}?kat_id={$kat_id}&mod={$mod}&pic_id=0'>" . $img . "</a> "; echo "<SPAN style='cursor:pointer;' onClick='getPreview(\"{$KAT_ID}\",\"{$kat_id}\",\"{$mod}\",0,\"{$modus}\",\"{$base_file}\")'>" . $kategorie . "</SPAN>"; echo "\n\t\t\t\t\t</TD>\n\t\t\t\t\t</TR>"; } } }
public function excuteScalar($sql) { $res = mysql_query($sql); $count = mysql_result($res, 0, 0); mysql_free_result($res); return $count; }
function check_reagents($spell, $login) { //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell); //$login = preg_replace ('/[^a-z0-9_]/i', '', $login); if (!is_player($login)) { return 0; } // spisok reagentov: $q = do_mysql("SELECT reagents FROM magic WHERE fullname = '" . $spell . "';"); if (!mysql_num_rows($q)) { return 0; } $rea = mysql_result($q, 0); if (!$rea) { return 1; } $rea = explode('|', $rea); // funkcija kotoroj proverim: include_once 'modules/f_has_misc_count.php'; $c = count($rea); $has = 1; for ($i = 0; $i < $c; $i++) { $rea[$i] = explode(':', $rea[$i]); // esli menqshe - 0 if (has_misc_count($rea[$i][0], $rea[$i][1], $login) < 1) { $has = 0; } } return $has; }
function wowhead_did($item) { mysql_select_db('world'); $sql = mysql_query("SELECT displayid FROM item_template WHERE entry = '{$item}'"); $displayid = mysql_result($sql, 0); return $displayid; }
public function get_datas() { //on commence par récupérer l'identifiant retourné par le sélecteur... $selector = $this->get_selected_selector(); if ($selector) { $article_id = $selector->get_value(); if ($article_id) { $sections = array(); $query = "select num_section from cms_articles where id_article = " . $article_id; $result = mysql_query($query); if (mysql_num_rows($result)) { $section_id = mysql_result($result, 0, 0); if ($section_id) { $datas = array(); $i = 0; do { $i++; $query = "select id_section,section_num_parent from cms_sections where id_section = " . $section_id; $result = mysql_query($query); if (mysql_num_rows($result)) { $row = mysql_fetch_object($result); $section_id = $row->section_num_parent; $datas[] = $row->id_section; } else { break; } //en théorie on sort toujours, mais comme c'est un pays formidable, on lock à 100 itérations... } while ($row->section_num_parent != 0 || $i > 100); return array_reverse($datas); } } } } return false; }
function get_project_level($user_id, $project_id, $validate = true) { // Most of the data comes from outside sources, so it is easier to validate it now, but if it doesn't or // we already have validated it, its a waste of server resources to do it again if ($validate) { $project_id = preg_replace("[^0-9]", "", $project_id); } // Check whether this user has any special permissions for this project $query = "SELECT * FROM project_users WHERE user_id = '{$user_id}' AND project_id = '{$project_id}'"; $result = mysql_query($query); // If there are no special permissions, lets see what the standard ones are if (mysql_num_rows($result) == 0) { $query = "SELECT * FROM projects WHERE id = '{$project_id}'"; $result = mysql_query($query); // Check whether the project exists if (mysql_num_rows($result) == 0) { // And if it doesn't, return false return false; } else { // But if it does, return the level! $level = mysql_result($result, 0, "default_level"); } } else { $level = mysql_result($result, 0, "level"); } return $level; }
function sql_result() { if (!$this->result) { die("Query not executed<br>"); } return mysql_result($this->result, 0); }
function print_relation($result, $attributes, $callback = "") { $num = @mysql_numrows($result); echo "<table>"; echo "<tr>"; foreach ($attributes as $attr) { echo "<th>"; echo $attr; echo "</th>"; } echo "</tr>"; $i = 0; while ($i < $num) { echo "<tr>"; foreach ($attributes as $attr) { echo "<td>"; if ($callback != NULL) { $value = mysql_result($result, $i, $attr); $callback($attr, $value); } else { echo mysql_result($result, $i, $attr); } echo "</td>"; } echo "</tr>"; $i++; } echo "</table>"; return $num; }
function list_esgroups() { global $msg, $charset, $dbh; $esgroups = new es_esgroups(); print "<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>" . $msg["es_group_name"] . "</th>\n\t\t\t\t\t<th>" . $msg["es_group_fullname"] . "</th>\n\t\t\t\t\t<th>" . $msg["connector_out_authorization_authorizedsourcecount"] . "</th>\n\t\t\t\t</tr>"; //Ajoutons l'utilisateur anonyme $sql = "SELECT COUNT(1) FROM connectors_out_sources_esgroups WHERE connectors_out_source_esgroup_esgroupnum = -1"; $anonymous_count = mysql_result(mysql_query($sql, $dbh), 0, 0); $pair_impair = "odd"; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=connecteurs&sub=out_auth&action=editanonymous'\" "; print "\t\t<tr style='cursor: pointer' class='{$pair_impair}' {$tr_javascript}>\n\t\t\t\t\t<td><" . $msg["admin_connecteurs_outauth_anonymgroupname"] . "></td>\n\t\t\t\t\t<td>" . $msg["admin_connecteurs_outauth_anonymgroupfullname"] . "</td>\n\t\t\t\t\t<td>" . $anonymous_count . "</td>\n\t\t\t\t</tr>"; $parity = 1; foreach ($esgroups->groups as &$aesgroup) { //Récupérons le nombre de sources autorisées dans le groupe $sql = "SELECT COUNT(1) FROM connectors_out_sources_esgroups WHERE connectors_out_source_esgroup_esgroupnum = " . $aesgroup->esgroup_id; $count = mysql_result(mysql_query($sql, $dbh), 0, 0); $pair_impair = $parity++ % 2 ? 'even' : 'odd'; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=connecteurs&sub=out_auth&action=edit&id={$aesgroup->esgroup_id}';\" "; print "<tr style='cursor: pointer' class='{$pair_impair}' {$tr_javascript}>"; print "<td>" . htmlentities($aesgroup->esgroup_name, ENT_QUOTES, $charset) . "</td>"; print "<td>" . htmlentities($aesgroup->esgroup_fullname, ENT_QUOTES, $charset) . "</td>"; print "<td>" . $count . "</td>"; print "</tr>"; } print "</table>"; }