function getEventbriteEvents($eb_keywords, $eb_city, $eb_proximity) { global $eb_app_key; $xml_url = "https://www.eventbrite.com/xml/event_search?...&within=50&within_unit=M&keywords=" . $eb_keywords . "&city=" . $eb_city . "&date=This+month&app_key=" . $eb_app_key; echo $xml_url . "<br />"; $xml = simplexml_load_file($xml_url); $count = 0; // loop over events from eventbrite xml foreach ($xml->event as $event) { // add event if it doesn't already exist $event_query = mysql_query("SELECT * FROM events WHERE id_eventbrite={$event->id}") or die(mysql_error()); if (mysql_num_rows($event_query) == 0) { echo $event_id . " "; // get event url foreach ($event->organizer as $organizer) { $event_organizer_url = $organizer->url; } // get event address foreach ($event->venue as $venue) { $event_venue_address = $venue->address; $event_venue_city = $venue->city; $event_venue_postal_code = $venue->postal_code; } // get event title $event_title = str_replace(array("\r\n", "\r", "\n"), ' ', $event->title); // add event to database mysql_query("INSERT INTO events (id_eventbrite, \n title,\n created, \n organizer_name, \n uri, \n start_date, \n end_date, \n address\n ) VALUES (\n '{$event->id}',\n '" . parseInput($event_title) . "',\n '" . strtotime($event->created) . "',\n '" . trim(parseInput($event->organizer->name)) . "',\n '{$event_organizer_url}',\n '" . strtotime($event->start_date) . "',\n '" . strtotime($event->end_date) . "',\n '{$event_venue_address}, {$event_venue_city}, {$event_venue_postal_code}'\n )") or die(mysql_error()); } $count++; } }
function SSL_COMPRA_FACTURA($transaccion, $salida = 'enlinea') { $c = sprintf('SELECT procon.`codigo_producto`, procon.`titulo` AS "titulo_contenedor", provar.`descripcion` AS "titulo_variedad", provar.foto, comcon.`codigo_compra`, comcon.`codigo_usuario`, comcon.`codigo_variedad`, FORMAT(comcon.`precio_grabado`,2) AS precio_grabado, FORMAT(comcon.`precio_envio`,2) AS precio_envio, comcon.`direccion_entrega`, comcon.`fecha_entrega`, comcon.`tarjeta_de`, comcon.`tarjeta_para`, comcon.`tarjeta_cuerpo`, comcon.`usuario_notas`, comcon.`transaccion`, comcon.`fecha`, `estado`, `correo_contacto`, `telefono_remitente`, `usuario_notas`, `nombre_t_credito`,`estado_notas` FROM `flores_SSL_compra_contenedor` AS comcon LEFT JOIN `flores_producto_variedad` AS provar USING(codigo_variedad) LEFT JOIN `flores_producto_contenedor` AS procon USING(codigo_producto) WHERE transaccion="%s"', db_codex($transaccion)); $r = db_consultar($c); if (!mysql_num_rows($r)) { echo '<p>Lo sentimos, tal factura no existe</p>'; return; } $f = mysql_fetch_assoc($r); $buffer = '<style>'; $buffer .= 'table {border-collapse:collapse;}'; $buffer .= 'table th{border-top:thin solid #c0c0c0;border-left:thin solid #c0c0c0;border-right:thin solid #c0c0c0;background-color:#eee;}'; $buffer .= 'table td{border-top:thin solid #c0c0c0;border:1px solid #c0c0c0;}'; $buffer .= '</style>'; $buffer .= '<table style="width:100%">'; $campo = array('Factura' => $f['transaccion'], 'F360' => $f['codigo_producto'] . ':' . $f['codigo_variedad'], 'Producto' => $f['titulo_contenedor'], 'Variedad' => $f['titulo_variedad'], 'Precio' => '$' . $f['precio_grabado'], 'Recargo de envio' => '$' . $f['precio_envio'], 'Total' => '$' . number_format($f['precio_grabado'] + $f['precio_envio'], 2, '.', ','), 'Remitente' => $f['tarjeta_de'], 'Destinatario' => $f['tarjeta_para'], 'Tarjeta' => $f['tarjeta_cuerpo'], 'Enviar a' => $f['direccion_entrega'], 'Fecha pedido' => date('d/m/Y'), 'Fecha de entrega' => date('d/m/Y', strtotime($f['fecha_entrega'])), 'Correo contacto' => $f['correo_contacto'], 'Teléfono remitente' => $f['telefono_remitente'], 'Notas adicionales del comprador' => $f['usuario_notas'] ? $f['usuario_notas'] : '[No especificó nada en especial]'); foreach ($campo as $clave => $valor) { $buffer .= sprintf('<tr><td>%s</td><td style="font-weight:bold">%s</td></tr>', $clave, $valor); } $buffer .= '</table>'; switch ($salida) { case 'enlinea': return array($buffer, $f); break; case 'pdf': $buffer = '<html><body>' . $buffer . '</body></html>'; require_once 'PHP/dompdf/dompdf_config.inc.php'; $dompdf = new DOMPDF(); $dompdf->load_html($buffer); //$dompdf->render(); //$dompdf->stream("factura-$transaccion.pdf"); } }
/** * adminmenu.php * * @version 1.2 * @copyright 2008 By Chlorel for XNova * @copyright 2009 By MadnessRed for XNova Redesigned */ function ShowLeftMenu($cpage = 'x') { global $lang; $qry = doquery("SELECT COUNT('error_id') as `errors` FROM {{table}}", 'errors', true); $errorscount = $qry['errors']; $qry = doquery("SELECT `id` FROM {{table}} WHERE `status` = 1 || `status` = 2 ;", 'supp'); $ticketcount = mysql_num_rows($qry); $info = @file(XNOVAUKLINK . "info.php"); if ($info[0] != VERSION . "\n") { $newversion = colourRed("(*)"); } $adminpages = array('overview' => 'Overview ' . $newversion, 'config' => 'Configuration', 'edit' => 'Manage Users', 'errors' => 'Errors (' . $errorscount . ')', 'supp' => 'Tickets (' . $ticketcount . ')'); getLang('menu'); $parse = $lang; $parse['links'] = ''; foreach ($adminpages as $get => $title) { $parse['links'] .= ' <li class="menubutton_table"> <span class="menu_icon"> <img src="' . GAME_SKIN . '/img/navigation/navi_ikon_premium_b.gif" height="29" width="38" /> </span> <a class="menubutton" href="./?page=admin&link=' . $get . '" title=\'' . $title . '\' tabindex="1"> <span class="textlabel">' . $title . '</span> </a> </li> '; } $Menu = parsetemplate(gettemplate('redesigned/adminmenu'), $parse); return $Menu; }
function logincheck($logincode, $users_table, $pass_column, $user_column) { //conect to DB $this->dbconnect(); //make sure password column and table are set if ($this->pass_column == "") { $this->pass_column = $pass_column; } if ($this->users_column == "") { $this->users_column = $users_column; } if ($this->users_table == "") { $this->users_table = $users_table; } //exectue query $result = $this->qry("SELECT * FROM " . $this->users_table . " WHERE " . $this->pass_column . " = '?';", $logincode); $rownum = mysql_num_rows($result); //return true if logged in and false if not if ($row != "Error") { if ($rownum > 0) { return true; } else { return false; } } }
public function isUser($name, $pass) { if (!$this->isConnected()) { return; } /* $query = "SELECT * FROM Users WHERE name LIKE '$name' AND password LIKE '$pass'" ; $res = mysql_query($query,$this->link); */ $res = $this->queryLoad("SELECT * FROM Users WHERE name LIKE '{$name}' AND password LIKE '{$pass}'"); if (!$res) { // Verifiacmos el error de conexion mysql_error(); } elseif (mysql_num_rows($res) <= 0) { // en caso de que no regrese resultados header("Location: ../../index.php"); } else { //send menu $fila = mysql_fetch_assoc($res); session_start(); $_SESSION['name'] = $name; $_SESSION['password'] = $pass; $_SESSION['id'] = $fila['id']; $_SESSION['state'] = $fila['state']; header("Location: ../../views/system.php"); } }
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 modul($posisi) { global $koneksi_db, $STYLE_INCLUDE, $SCRIPT_INCLUDE; $total = 0; $numb = 0; if (isset($_GET['pilih'])) { $pilih = mysql_real_escape_string(strip_tags($_GET['pilih'])); $numb = mysql_num_rows(mysql_query("SELECT `id` FROM `actions` WHERE `modul_hrd` = '{$pilih}'")); $modulku = mysql_query("SELECT * FROM `actions` LEFT JOIN `modul_hrd` ON (`modul_hrd`.`id` = `actions`.`modul_id`) WHERE `actions`.`modul_hrd` = '{$pilih}' AND `actions`.`posisi` = '{$posisi}' ORDER BY `actions`.`order`"); $total = mysql_num_rows($modulku); while ($viewmoduls = mysql_fetch_assoc($modulku)) { if (file_exists($viewmoduls['isi']) && $viewmoduls['type'] == 'module') { include $viewmoduls['isi']; kotakjudul($viewmoduls['modul'], @$out, ''); $out = ''; } if ($viewmoduls['type'] == 'block') { kotakjudul($viewmoduls['modul'], $viewmoduls['isi'], ''); } } } if ($total == 0 && $numb == 0) { $modulku = $koneksi_db->sql_query("SELECT * FROM modul_hrd WHERE published= 1 AND posisi= '{$posisi}' ORDER BY ordering"); while ($viewmodul = $koneksi_db->sql_fetchrow($modulku)) { if (file_exists($viewmodul['isi']) && $viewmodul['type'] == 'module') { include $viewmodul['isi']; kotakjudul($viewmodul['modul'], @$out, ''); $out = ''; } if ($viewmodul['type'] == 'block') { kotakjudul($viewmodul['modul'], $viewmodul['isi'], ''); } } } }
function show_abts($dbh) { global $msg; global $charset; print "<table>\n\t\t<tr>\n\t\t<th>" . $msg[103] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay"] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay_dflt"] . "</th>\n\t\t<th>" . $msg["type_abts_tarif"] . "</th>\n\t\t<th>" . $msg["type_abts_caution"] . "</th>\n\t\t</tr>"; // affichage du tableau des utilisateurs $requete = "SELECT id_type_abt, type_abt_libelle, prepay, prepay_deflt_mnt,tarif,caution FROM type_abts ORDER BY type_abt_libelle,id_type_abt"; $res = mysql_query($requete, $dbh); $nbr = mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = mysql_fetch_row($res); if ($row[2]) { $prepay = "x"; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=finance&sub=abts&action=modif&id={$row['0']}';\" "; print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>" . htmlentities($row[1], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td style='text-align:center;display:none'>{$prepay}</td><td style='display:none'>" . $row[3] . "</td><td>" . $row[4] . "</td><td>" . $row[5] . "</td>\n\t\t\t\t\t\t</tr>"); } print "</table>\n\t\t<input class='bouton' type='button' value=\" " . $msg["type_abts_add"] . " \" onClick=\"document.location='./admin.php?categ=finance&sub=abts&action=add'\" />"; }
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; }
function RetrieveRecordArray($filter = null) { $dtoArray = array(); $query = "SELECT SUBC.*, TIPC.sigla as siglaTipoContrato FROM subContrato SUBC JOIN tipoContrato TIPC ON SUBC.tipocontrato_id = TIPC.id WHERE removido = 0"; if (!empty($filter)) { $query = $query . " AND " . $filter; } $recordSet = mysql_query($query, $this->mysqlConnection); if (!$recordSet && $this->showErrors) { print_r(mysql_error()); echo '<br/><br/>'; } $recordCount = mysql_num_rows($recordSet); if ($recordCount == 0) { return $dtoArray; } $index = 0; while ($record = mysql_fetch_array($recordSet)) { $dto = new SubContractDTO(); $dto->id = $record['id']; $dto->codigoContrato = $record['contrato_id']; $dto->codigoTipoContrato = $record['tipoContrato_id']; $dto->siglaTipoContrato = $record['siglaTipoContrato']; $dtoArray[$index] = $dto; $index++; } mysql_free_result($recordSet); return $dtoArray; }
function register($name, $username, $password) { $message = []; if (empty($name) || empty($username) || empty($password)) { $message[] = "Please all fields are required"; } else { $passlength = strlen($password); if ($passlength >= 5 && $passlength <= 20) { $query_run = mysql_query("SELECT * FROM `users` WHERE \n\t \t`username`='{$username}'"); if (mysql_num_rows($query_run) >= 1) { $message[] = "Username already exists!"; } if (count($message) == 0) { // no errors $password = md5($password); if (insert('users', ['name' => $name, 'username' => $username, 'password' => $password])) { $message[] = "Thank you for joining! <a href='login.php'>Click here to log in</a>"; } } } else { $message[] = "Password characters out of required range( 5 - 20 )"; } } return $message; }
function phantrang($page, $max_results, $page_number, $search) { global $sql; $from = $page_number * $max_results - $max_results; $link = "administrator.php?p={$page}&page_number="; $type = 6; //loại sql select $type = 6; $table = $page; $field = array('id'); $sql->get_sql($type, $table, $field, $search); $qr = $sql->executable() or die('<p class="error">Không truy vấn được</p>'); $total = mysql_num_rows($qr); mysql_free_result($qr); $total_pages = ceil($total / $max_results); if ($total_pages > 1) { if ($page_number > 1) { $prev = $page_number - 1; echo "<a href='{$link}{$prev}'>Trang trước</a>"; } for ($i = $page_number - 5; $i <= $page_number + 5 & $i <= $total_pages; $i++) { if ($page_number == $i) { echo "<a href='{$link}{$i}' style='color:#F00; font-weight:bold; background-color:#ffffcc'>{$i}</a>"; } elseif ($i > 0) { echo "<a href='{$link}{$i}'>{$i}</a>"; } } if ($page_number < $total_pages) { $next = $page_number + 1; echo "<a href='{$link}{$next}'>Trang sau</a>"; } } }
function rewind() { if ($this->resource && mysql_num_rows($this->resource) > 0) { mysql_data_seek($this->resource, 0); } $this->number = 0; }
function show_zbib($dbh) { global $msg; print "<table>\n\t\t<tr>\n\t\t<th class='titre_data'>{$msg['zbib_nom']}</th>\n\t\t<th class='titre_data'>{$msg['zbib_base']}</th>\n\t\t<th class='titre_data'>{$msg['zbib_utilisation']}</th>\n\t\t<th class='titre_data'>{$msg['zbib_nb_attr']}</th>\n\t\t</tr>"; // affichage du tableau des z_bib $requete = "SELECT bib_id, bib_nom, base, search_type, count(*) as nb_attr FROM z_bib left outer join z_attr on bib_id=attr_bib_id group by bib_id, bib_nom, base, search_type ORDER BY bib_nom, base, search_type "; $res = mysql_query($requete, $dbh); $nbr = mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = mysql_fetch_object($res); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=z3950&sub=zbib&action=modif&id={$row->bib_id}';\" "; print "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>"; print "<td><strong>" . $row->bib_nom . "</strong></td>"; print "<td>" . $row->base . "</td>"; print "<td>" . $row->search_type . "</td>"; print "<td>" . $row->nb_attr . "</td>"; print "</tr>"; } print "</table>\n\t\t<input class='bouton' type='button' value='" . $msg["ajouter"] . "' onClick=\"document.location='./admin.php?categ=z3950&sub=zbib&action=add'\" />\n\t\t"; }
public static function authentication() { // print_r($_SERVER); // exit(); if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { $db = new DB(); $username = mysql_real_escape_string($_SERVER['PHP_AUTH_USER']); $password = mysql_real_escape_string($_SERVER['PHP_AUTH_PW']); $domain = 'nebula.com'; $hash = md5($username . ':' . $domain . ':' . $password); $sql = "SELECT id from n_nebulauser WHERE username='******' AND ha1='{$hash}'"; $q = $db->query($sql); if (mysql_num_rows($q)) { $fetch = mysql_fetch_assoc($q); return $fetch['id']; } else { return null; } } return false; }
protected function Content() { ?> <div class="container"> <div class="row ajax"> <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> <?php $hash = $_GET['hash']; if ($hash != "") { $conn = $this->ConnectDB(); // шукаєм хеш в базі $result = mysql_query("SELECT id FROM user WHERE hash = '{$hash}'"); $num_rows = mysql_num_rows($result); // якщо хеш знайдений - активуєм, чистим хеш if ($num_rows > 0) { $conn = $this->ConnectDB(); $result = mysql_query("UPDATE user SET status = 1, hash = '' WHERE hash = '{$hash}'"); echo "<center><br><a href='../index.php'>Активація пройшла успішно. Вернутись на головну.</a></center>"; } else { echo "<center><br><a href='../index.php'>Помилка. Вернутись на головну.</a></center>"; } } else { echo "<center><br><a href='../index.php'>Невірний лінк. Вернутись на головну.</a></center>"; } ?> </div> </div> </div> </body> </html> <?php }
function get_all_promo_events() { connect_and_select_db(DB_SERVER, DB_UN, DB_PWD, DB_NAME); $startDate = mysql_real_escape_string($_POST['startDate']); $endDate = mysql_real_escape_string($_POST['endDate']); //Retrieve all events that occur during the time period including the outer bounds if ($startDate == null || $startDate == "") { $startDate = "0000-00-00"; } if ($endDate == null || $endDate == "") { $endDate = "9999-99-99"; } //$startDate = str_replace("-", "", $startDate); //$endDate = str_replace("-", "", $endDate); $sql = "SELECT * FROM AdEvent WHERE " . "(StartDate >= '{$startDate}' " . "AND StartDate <= '{$endDate}') " . "OR (EndDate >= '{$startDate}' " . "AND EndDate <= '{$endDate}') " . "ORDER BY AdEvent.StartDate ASC;"; //$sql = "SELECT * FROM AdEvent ORDER BY AdEvent.StartDate ASC"; --older, incorrect version $error_message = "Could not successfully run query ({$sql}) from DB: "; $search_events_result = get_result_set_from_select_query($sql, $error_message); //$result is non-empty. So count the rows $numrows = mysql_num_rows($search_events_result); //Create an appropriate message $message = ""; if ($numrows == 0) { $message = "No events found in database"; } ui_show_events_retrieved($message, $search_events_result); }
function run_in_background($command, $output, $taskID = null) { if ($this->onlineMode) { $this->removeDeadProcessesFromQueue(); if (!isset($taskID)) { mysql_query("insert ignore into task (cmd, output) values ('" . mysql_escape_string($command) . "','" . mysql_escape_string($output) . "')"); } else { $runningProcessCount = mysql_num_rows(mysql_query("Select id from task where running=true")); if ($runningProcessCount < $this->processLimit) { mysql_query("update task set running=true where id=" . $taskID); $this->startProcess($command, $output); mysql_query("Delete from task where id=" . $taskID); } } $sIndex = strrpos($output, '/'); if ($sIndex === false) { $sIndex = strrpos($output, '\\'); } if ($sIndex === false) { $sIndex = strrpos($output, PATH_SEPARATOR); } if ($sIndex === false) { $sIndex = -1; } return substr($output, $sIndex + 1); } else { return $this->startProcess($command, $output); } //sleep ( rand(5,10) ); // Sleep for 5 seconds so other taks don't get ran to quickly }
function GetTables() { $xmlOutput = ""; $result = mysql_list_tables($this->database, $this->connectionId); if ($result) { $xmlOutput = "<RESULTSET><FIELDS>"; // Columns are referenced by index, so Schema and // Catalog must be specified even though they are not supported $xmlOutput .= "<FIELD><NAME>TABLE_CATALOG</NAME></FIELD>"; // column 0 (zero-based) $xmlOutput .= "<FIELD><NAME>TABLE_SCHEMA</NAME></FIELD>"; // column 1 $xmlOutput .= "<FIELD><NAME>TABLE_NAME</NAME></FIELD>"; // column 2 $xmlOutput .= "</FIELDS><ROWS>"; $tableCount = mysql_num_rows($result); for ($i = 0; $i < $tableCount; $i++) { $xmlOutput .= "<ROW><VALUE/><VALUE/><VALUE>"; $xmlOutput .= mysql_tablename($result, $i); $xmlOutput .= "</VALUE></ROW>"; } $xmlOutput .= "</ROWS></RESULTSET>"; } return $xmlOutput; }
function AcceptOrder_SMS($args) { $class = new AktuelSms(); $template = $class->getTemplateDetails(__FUNCTION__); if ($template['active'] == 0) { return null; } $settings = $class->getSettings(); if (!$settings['api'] || !$settings['apiparams'] || !$settings['gsmnumberfield'] || !$settings['wantsmsfield']) { return null; } $userSql = "SELECT `a`.`id`,`a`.`firstname`, `a`.`lastname`, `b`.`value` as `gsmnumber`\n FROM `tblclients` as `a`\n JOIN `tblcustomfieldsvalues` as `b` ON `b`.`relid` = `a`.`id`\n JOIN `tblcustomfieldsvalues` as `c` ON `c`.`relid` = `a`.`id`\n WHERE `a`.`id` IN (SELECT userid FROM tblorders WHERE id = '" . $args['orderid'] . "')\n AND `b`.`fieldid` = '" . $settings['gsmnumberfield'] . "'\n AND `c`.`fieldid` = '" . $settings['wantsmsfield'] . "'\n AND `c`.`value` = 'on'\n LIMIT 1"; $result = mysql_query($userSql); $num_rows = mysql_num_rows($result); if ($num_rows == 1) { $UserInformation = mysql_fetch_assoc($result); $template['variables'] = str_replace(" ", "", $template['variables']); $replacefrom = explode(",", $template['variables']); $replaceto = array($UserInformation['firstname'], $UserInformation['lastname'], $args['orderid']); $message = str_replace($replacefrom, $replaceto, $template['template']); $class->setGsmnumber($UserInformation['gsmnumber']); $class->setUserid($UserInformation['id']); $class->setMessage($message); $class->send(); } }
function getGameCount() { // Load game info $gameData = mysql_query("SELECT * FROM games"); // Get game count and return it return mysql_num_rows($gameData); }
function update() { $kd_jab = @$_POST['kd_jab']; $nm_jab = @$_POST['nm_jab']; $ket = @$_POST['ket']; $data = $this->model->cekData($nm_jab); $cek_data = mysql_num_rows($data); if ($cek_data > 1) { ?> <script type="text/javascript"> alert("Data Jabatan Sudah Ada!"); </script> <?php } else { $update = $this->model->update($kd_jab, $nm_jab, $ket); if ($update) { ?> <script type="text/javascript"> alert("Data Jabatan Berhasil di Edit!"); window.location.href="?page=struktur_jabatan"; </script> <?php } else { ?> <script type="text/javascript"> alert("Data Jabatan Gagal di Edit!"); </script> <?php } } }
function entries_by_dropoff_loc($id) { include CONFIG . 'config.php'; mysql_select_db($database, $brewing); $query_dropoffs = sprintf("SELECT uid FROM %s WHERE brewerDropOff='%s'", $prefix . "brewer", $id); $dropoffs = mysql_query($query_dropoffs, $brewing) or die(mysql_error()); $row_dropoffs = mysql_fetch_assoc($dropoffs); $totalRows_dropoffs = mysql_num_rows($dropoffs); $build_rows = ""; if ($totalRows_dropoffs > 0) { do { $query_dropoff_count = sprintf("SELECT * FROM %s WHERE brewBrewerID='%s'", $prefix . "brewing", $row_dropoffs['uid']); $dropoff_count = mysql_query($query_dropoff_count, $brewing) or die(mysql_error()); $row_dropoff_count = mysql_fetch_assoc($dropoff_count); $totalRows_dropoff_count = mysql_num_rows($dropoff_count); if ($totalRows_dropoff_count > 0) { do { $build_rows .= "\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td class=\"data bdr1B_gray\">" . sprintf("%04s", $row_dropoff_count['id']) . "</td>\r\n\t\t\t\t\t\t\t<td class=\"data bdr1B_gray\">" . $row_dropoff_count['brewName'] . "</td>\r\n\t\t\t\t\t\t\t<td class=\"data bdr1B_gray\">" . $row_dropoff_count['brewBrewerLastName'] . ", " . $row_dropoff_count['brewBrewerFirstName'] . "</td>\r\n\t\t\t\t\t\t\t<td class=\"data bdr1B_gray\"><p class=\"box_small\"></p></td> \r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t"; } while ($row_dropoff_count = mysql_fetch_assoc($dropoff_count)); } // end if ($totalRows_dropoff_count > 0) } while ($row_dropoffs = mysql_fetch_assoc($dropoffs)); } // end if ($totalRows_dropoffs > 0) return $build_rows; }
/** * Find pixels coords and draw these on the current image * * @param integer $image Number of the image (to be used with $this->height) * @return boolean Success **/ function drawPixels($image) { $limit = 0; do { /** Select with limit */ $result = mysql_query(sprintf($this->query, $image * $this->height, ($image + 1) * $this->height - 1) . ' LIMIT ' . $limit . ',' . $this->limit); if ($result === false) { return $this->raiseError('Query failed: ' . mysql_error()); } $count = mysql_num_rows($result); while ($click = mysql_fetch_row($result)) { $x = (int) $click[0]; $y = (int) ($click[1] - $image * $this->height); if ($x < 0 || $x >= $this->width) { continue; } /** Apply a calculus for the step, with increases the speed of rendering : step = 3, then pixel is drawn at x = 2 (center of a 3x3 square) */ $x -= $x % $this->step - $this->startStep; $y -= $y % $this->step - $this->startStep; /** Add 1 to the current color of this pixel (color which represents the sum of clicks on this pixel) */ $color = imagecolorat($this->image, $x, $y) + 1; imagesetpixel($this->image, $x, $y, $color); $this->maxClicks = max($this->maxClicks, $color); if ($image === 0) { /** Looking for the maximum height of click */ $this->maxY = max($y, $this->maxY); } } /** Free resultset */ mysql_free_result($result); $limit += $this->limit; } while ($count === $this->limit); return true; }
function LOAD_TAGS($type) { global $theme_path; $data = mysql_query("SELECT t.* FROM core_tags t ORDER BY t.tag_position DESC"); if ($type == "JAVASCRIPT") { echo "var tags=new Object();\n"; while ($t = mysql_fetch_array($data)) { $tag_id = $t["tag_id"]; $id_str = ""; $id_str = "tags.tag" . $tag_id . "="; $entries = mysql_query("SELECT e2t.entry_id FROM core_entry2tag e2t WHERE e2t.tag_id = {$tag_id}"); if (@mysql_num_rows($entries) > 0) { $id_str = $id_str . "["; while ($e = mysql_fetch_array($entries)) { $id_str = $id_str . $e["entry_id"] . ","; } $id_str = substr($id_str, 0, strlen($id_str) - 1); $id_str = $id_str . "];\n"; } else { $id_str = $id_str . "0;\n"; } echo $id_str; } } else { while ($r = mysql_fetch_array($data)) { $tag_text = $r["tag_text"]; $tag_id = $r["tag_id"]; require $theme_path . "parts/tag_link.php"; } } }
public function __construct($query, &$conn, &$orm = null) { $this->conn = $conn; $this->res = null; $this->orm = $orm; $this->rowOrm = null; $this->success = false; $this->fields = null; $this->EOF = true; $this->BOF = true; $this->index = 0; $this->count = 0; $this->insertID = 0; $type = strtolower(substr(trim(str_replace("\n", " ", $query)), 0, 7)); $typeIsSelect = $type == "select "; $typeIsShowTables = $type == "show ta"; $typeIsInsert = $type == "insert "; $query = Str::finish($query, ";"); if ($this->res = @mysql_query($query, $this->conn->res)) { $this->success = true; if ($typeIsSelect || $typeIsShowTables) { $this->count = mysql_num_rows($this->res); $this->moveFirst(); } else { if ($typeIsInsert) { $this->insertID = mysql_insert_id($this->conn->res); } } } else { trigger_error("SQL error: " . $query . "\n<br><b>'" . mysql_error($this->conn->res) . "'</b>"); } }
function retorne_host_tabela_indexar_existe($host_site) { // globals ------------------------------------------------------------------ global $nome_prefixo_tabela_novo_host; // nome de prefixo de tabela // ---------------------------------------------------------------------------- // query -------------------------------------------------------------------- $query = "select *from {$nome_prefixo_tabela_novo_host} where host_site='{$host_site}';"; // query // ---------------------------------------------------------------------------- // comando -------------------------------------------------------------- $comando = comando_executa($query); // comando // ---------------------------------------------------------------------------- // numero de linhas ---------------------------------------------------- $numero_linhas = mysql_num_rows($comando); // numero de linhas // ---------------------------------------------------------------------------- // retorno ------------------------------------------------------------------ if ($numero_linhas > 0) { return true; // esta cadastrado } else { return false; // nao esta cadastrado } // ---------------------------------------------------------------------------- }
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); } }
protected function get_managed_search_dest_form($search_dest) { if ($search_dest != "new") { $infos = $this->managed_datas['module']['search_dests'][$search_dest]; } else { $infos = array('name' => "", 'page' => 0); } $form = ""; //nom $form .= "\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'>\n\t\t\t\t\t<label for='cms_module_search_search_dest_name'>" . $this->format_text($this->msg['cms_module_search_search_dest_name']) . "</label>\n\t\t\t\t</div>\n\t\t\t\t<div class='colonne-suite'>\n\t\t\t\t\t<input type='text' name='cms_module_search_search_dest_name' value='" . $this->format_text($infos['name']) . "'/>\n\t\t\t\t</div>\n\t\t\t</div>"; //page $form .= "\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'>\n\t\t\t\t\t<label for='cms_module_search_search_dest_page'>" . $this->format_text($this->msg['cms_module_search_search_dest_page']) . "</label>\n\t\t\t\t</div>\n\t\t\t\t<div class='colonne-suite'>\n\t\t\t\t\t<select name='cms_module_search_page_dest' onchange='load_page_vars(this.value)'>"; //on va chercher les infos pour les pages du portail ! $query = "select id_page,page_name from cms_pages order by page_name asc"; $result = mysql_query($query); $pages = array(); $pages[0] = $this->msg["cms_module_menu_menu_entry_page_choice"]; if (mysql_num_rows($result)) { $form .= "\n\t\t\t\t\t\t<option value='0' " . (!$infos['page'] ? "selected='selected'" : "") . ">" . $this->format_text($this->msg['cms_module_search_classique_dest']) . "</option>"; while ($row = mysql_fetch_object($result)) { $form .= "\n\t\t\t\t\t\t<option value='" . $row->id_page . "' " . ($row->id_page == $infos['page'] ? "selected='selected'" : "") . ">" . $this->format_text($row->page_name) . "</option>"; } } $form .= "\n\t\t\t\t\t</select>\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tfunction load_page_vars(page_id){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t</script>\n\t\t\t\t</div>\n\t\t\t</div>"; return $form; }
function view_all_judges($event) { include 'dbconnect.php'; $db_name = 'forum'; $tbl_name = 'judges'; mysql_select_db("{$db_name}") or die("cannot select DB"); $view_sql = "SELECT * FROM " . $tbl_name . " WHERE event = '" . $event . "'"; $result = mysql_query($view_sql, $conn); echo "<table class='table table-striped'>\r\n \t<tr>\r\n \t<th>Judge Name</th>\r\n \t<th>Judge Status</th>\r\n \t<th>Date Added</th>\r\n \t<th>Operation</th>\r\n \t</tr>"; while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['judge_name'] . "</td>"; echo "<td>" . $row['judge_status'] . "</td>"; echo "<td>" . $row['date_added'] . "</td>"; $add_remove_str = $sql_chk = "SELECT * FROM judges_final WHERE judge_name='" . $row['judge_name'] . "' and event='" . $row['event'] . "'"; $res = mysql_query($sql_chk); // Mysql_num_row is counting table row $count = mysql_num_rows($res); // If result matched $myusername and $mypassword, table row must be 1 row if ($count == 0) { $add_remove_str = "Add to FINAL list"; $onclick_str = "'javascript:add_judge_final(\"" . $row['event'] . "\",\"" . $row['judge_name'] . "\")'"; $gly = "plus"; } else { $add_remove_str = "Remove from FINAL list"; $onclick_str = "'javascript:remove_judge_final(\"" . $row['event'] . "\",\"" . $row['judge_name'] . "\")'"; $gly = "minus"; } echo "<td> <a style='cursor:pointer;' alt='Delete this Judge' onclick='javascript:del_judge(\"" . $row['event'] . "\",\"" . $row['judge_name'] . "\")'><span class='glyphicon glyphicon-remove'></span> Delete </a>" . "<a style='cursor:pointer;' onclick=" . $onclick_str . "> , <span class='glyphicon glyphicon-{$gly}'></span> {$add_remove_str} </a></td>"; echo "</tr>"; } echo "</table>"; mysql_close($conn); }