function get_month_wct($date, $time) { $MONTHS = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); //Go through each month and check if it exists in the date string $month = -1; for ($i = 0; $i < count($MONTHS); $i++) { //Check each month if (stripos($date, $MONTHS[$i]) !== false) { if ($time == "start") { //If the previous month exists in the string if (stripos($date, $MONTHS[mod($i - 1, 12)]) !== false) { //This is the correct month $month = mod($i - 1, 12); } else { $month = $i; } } else { //If the next month exists in the string if (stripos($date, $MONTHS[mod($i + 1, 12)]) !== false) { $month = mod($i + 1, 12); } else { $month = $i; } } } } if ($month == -1) { echo "\nMonth was -1"; } return $month + 1; }
function randomcpf($compontos) { $n1 = rand(0, 9); $n2 = rand(0, 9); $n3 = rand(0, 9); $n4 = rand(0, 9); $n5 = rand(0, 9); $n6 = rand(0, 9); $n7 = rand(0, 9); $n8 = rand(0, 9); $n9 = rand(0, 9); $d1 = $n9 * 2 + $n8 * 3 + $n7 * 4 + $n6 * 5 + $n5 * 6 + $n4 * 7 + $n3 * 8 + $n2 * 9 + $n1 * 10; $d1 = 11 - mod($d1, 11); if ($d1 >= 10) { $d1 = 0; } $d2 = $d1 * 2 + $n9 * 3 + $n8 * 4 + $n7 * 5 + $n6 * 6 + $n5 * 7 + $n4 * 8 + $n3 * 9 + $n2 * 10 + $n1 * 11; $d2 = 11 - mod($d2, 11); if ($d2 >= 10) { $d2 = 0; } $retorno = ''; if ($compontos == 1) { $retorno = '' . $n1 . $n2 . $n3 . "." . $n4 . $n5 . $n6 . "." . $n7 . $n8 . $n9 . "-" . $d1 . $d2; } else { $retorno = '' . $n1 . $n2 . $n3 . $n4 . $n5 . $n6 . $n7 . $n8 . $n9 . $d1 . $d2; } return $retorno; }
function mod($a, $b) { if ($a <= 0) { return (int) mod($b - abs($a), $b); } else { return (int) $a % $b; } }
function traducirCifra($number) { // Mandarlo a que tradusca la cantidad en letra. if ($number == 0) { // if amount = 0, then forget all about conversions, $hundreds_final_string = " cero "; // amount is zero (cero). handle it externally, to // function breakdown } else { $millions = whole_part($number, 1000000); // first, send the millions to the string $number = mod($number, 1000000); // conversion function if ($millions != 0) { // This condition handles the plural case if ($millions == 1) { // if only 1, use 'millon' (million). if $descriptor = " millon, "; // > than 1, use 'millones' (millions) as } else { // a descriptor for this triad. $descriptor = " millones, "; } } else { $descriptor = " "; // if 0 million then use no descriptor. } $millions_final_string = string_literal_conversion($millions) . $descriptor; $thousands = whole_part($number, 1000); // now, send the thousands to the string $number = mod($number, 1000); // conversion function. if ($thousands != 0) { // This condition eliminates the descriptor $descriptor = " mil, "; // if there are no thousands on the amount } else { $descriptor = " "; } $thousands_final_string = string_literal_conversion($thousands) . $descriptor; // this will handle numbers between 1 and 999 which // need no descriptor whatsoever. $hundreds = $number; $hundreds_final_string = string_literal_conversion($hundreds); } //end if ($number ==0) $millions_final_string = strtoupper($millions_final_string); $thousands_final_string = strtoupper($thousands_final_string); $hundreds_final_string = strtoupper($hundreds_final_string); //$t->set_var("IMPORTE_LETRA",$millions_final_string.$thousands_final_string.$hundreds_final_string." USD 00/100 CTS."); $importeLetra = $millions_final_string . $thousands_final_string . $hundreds_final_string; return $importeLetra; }
function demoMod($a, $b) { echo "Demo for pair ({$a}, {$b}):\n"; $c = $a / $b; $ic = idiv($a, $b); $d = $a % $b; $mc = div($a, $b); $md = mod($a, $b); echo "Standard PHP division: {$a} / {$b} = {$c}\n"; echo "Custom integer division: {$a} / {$b} = {$ic}\n"; echo "Fixed integer division: {$a} / {$b} = {$mc}\n"; echo "Standard PHP integer modulo: {$a} % {$b} = {$d}\n"; echo "Fixed integer modulo: {$a} mod {$b} = {$md}\n\n"; }
function getuptime($var2, $var3) { $r = floor($var2); $uptimes = mod($r, 60); $r = floor($r / 60); $uptimem = mod($r, 60); $r = floor($r / 60); $uptimeh = mod($r, 24); $uptimed = number_format(floor($r / 24)); if ($var3 == 'server') { return '' . $uptimed . 'd ' . $uptimeh . 'h<br>' . $uptimem . 'm ' . $uptimes . 's'; } else { return '' . $uptimed . 'd' . $uptimeh . 'h' . $uptimem . 'm'; } }
function AddPoints($points, $perma = false, $id = false) { global $user; if (!$id) { $id = $user['id']; } //echo "Adding ".$points." to user ".$user['username']."<br />"; if ($points < 0) { $sign = "-"; $points = mod(idstring($points)); } else { $sign = "+"; } if ($perma) { $permapart = ", `perma_points` = `perma_points` " . $sign . " '" . idstring($points) . "'"; } doquery("UPDATE {{table}} SET `total_points` = `total_points` " . $sign . " '" . idstring($points) . "'" . $permapart . " WHERE `id` = '" . idstring($id) . "' ;", 'users'); }
} if ($HTTP_GET_VARS['accion'] == modificar && isset($HTTP_GET_VARS['id_pelicula'])) { ModificarPelicula($HTTP_GET_VARS['id_pelicula']); } /*if($HTTP_GET_VARS['accion'] == agregar){ AgregarPelicula( limpia($HTTP_POST_VARS['nombre_pelicula']), limpia($HTTP_POST_VARS['formato']), limpia($HTTP_POST_VARS['audio']) ); }*/ if ($HTTP_GET_VARS['accion'] == ver && isset($HTTP_GET_VARS['id_pelicula'])) { DetallePelicula($HTTP_GET_VARS['id_pelicula']); } if ($_GET['accion'] == mod) { mod(limpia($_POST['id_pelicula']), limpia($_POST['nombre_pelicula']), limpia($_POST['formato']), limpia($_POST['audio'])); } } } include "conn.php"; //conexion a postgresql $conn = pg_connect("host={$dbhost} port={$dbport} dbname={$dbname} user={$dbuser} password={$dbpass}") or die("Error al conectar la base de datos"); $_pagi_sql = "SELECT count(*)\n\t\t\t\t\t\t\t\t\t\t\t FROM pelicula"; $_pagi_nav_num_enlaces = 5; $_pagi_cuantos = 35; $_pagi_mostrar_errores = TRUE; $_pagi_nav_estilo = "paginacion"; $_pagi_propagar = array(""); include 'paginator.inc.php'; echo "<center>" . $_pagi_navegacion . "</center>"; listarPeliculas($_pagi_Lim);
public function mod($other) { return mod($this, $other); }
<?php mod("pager"); $user = mysqli_fetch_array(db_query('SELECT * FROM mybb_users WHERE uid="' . $id . '"')); if (!$user) { output_message('Error', 'User not found.'); exit; } else { function show_left() { global $user, $count; output_block_start($user['username']); echo 'Member since ' . date('Y-m-d', $user['regdate']) . '<br/>' . number_format($count) . ' sequences'; output_block_end(); } } $gp = pager_init(66); $where = ' WHERE owner="' . $id . '" AND deleted=0 '; $order = "date DESC"; $countQuery = 'SELECT COUNT(*) AS count FROM sequences' . $where; $count = db_result(db_query($countQuery), 0); function display_seq($row) { echo '<div class="game"><a href="/' . $row['id'] . '">' . preview($row['id'], $row['title']) . '</a></div>'; } output_header('Profile for ' . $user['username']); output_block_start('Sequences'); if ($count == 0) { echo 'No sequences found.'; } pager_display($gp, 'SELECT * FROM sequences' . $where . ' ORDER BY ' . $order, $countQuery, 'count', 'display_seq');
<?php mod('form'); $form = form_create('Continue', 'default', 'process_form', 'post'); function process_form() { global $form, $root, $userid; $f = $_FILES['file']; $name = $f['name']; $f['name'] = md5(rand(0, 1000000000)); $path = $root . '/uploads/midi/' . $f['name']; if (!move_uploaded_file($f['tmp_name'], $path)) { form_add_error($form, 'Error uploading file.'); } else { header('Location: /import2/' . $f['name'] . '?title=' . urlencode($name)); exit; } } form_add_param($form, 'File', 'file', 'file;mid;20000000', '', 100, 14); form_process(); output_header("Upload MIDI File"); output_block_start("Upload MIDI File"); echo '<p>Keep in mind that not all MIDI files will work well! Many MIDI files use features that are not supported by the sequencer; simple ones work best.</p>'; echo '<p>Examples: <a href="http://onlinesequencer.net/4679">Baba Yetu</a>, <a href="http://onlinesequencer.net/4680">Fangad aven korvring</a>, <a href="http://onlinesequencer.net/4681">Cliffs of Dover</a></p>'; form_display($form); output_block_end(); output_footer();
<?php define("NOT_IN_FORUM", 1); include "inc/init.php"; include 'inc/init_forum.php'; include $local . '/pages.php'; mod("page"); include $templates_path . '/' . $settings['template'] . '/main.php'; $form_id = 0; if (!isset($_GET["x"])) { $parts = array('view', '0'); } else { $parts = explode("/", $_GET['x']); } $page_name = $parts[0]; if (empty($page_name) || preg_match("/\\W/", $page_name)) { error_page("No page was specified."); } else { $params = $pages[$page_name]['params']; if (count($parts) - 1 < count($params)) { error_page('Incorrect URL specified. Did you follow a broken link?'); } $i = 0; foreach ($params as $param => $value) { $p = urldecode($parts[$i + 1]); if (validate($p, $value)) { $GLOBALS[$param] = $p; } else { error_page('Incorrect URL specified. Did you follow a broken link?'); } $i++;
function covertirNumLetras($number) { $millions_final_string=""; $thousands_final_string=""; //number = number_format (number, 2); $number1=$number.''; //settype (number, "integer"); $cent = explode('.',$number); if (isset($cent[1]) ){ $centavos = $cent[1]; }else{ $centavos = "00"; } $number= $cent[0]; if ($number == 0 || $number == "") { // if amount = 0, then forget all about conversions, $centenas_final_string=" cero "; // amount is zero (cero). handle it externally, to // function breakdown } else { $millions = ObtenerParteEntDiv($number, 1000000); // first, send the millions to the string $number = mod($number, 1000000); // conversion function if ($millions != 0) { // This condition handles the plural case if ($millions == 1) { // if only 1, use 'millon' (million). if $descriptor= " millon "; // > than 1, use 'millones' (millions) as } else { // a descriptor for this triad. $descriptor = " millones "; } } else { $descriptor = " "; // if 0 million then use no descriptor. } $millions_final_string = string_literal_conversion($millions).$descriptor; $thousands = ObtenerParteEntDiv($number, 1000); // now, send the thousands to the string $number = mod($number, 1000); // conversion function. //print "Th:".thousands; if ($thousands != 1) { // This condition eliminates the descriptor $thousands_final_string =string_literal_conversion($thousands) . " mil "; // descriptor = " mil "; // if there are no thousands on the amount } if ($thousands == 1) { $thousands_final_string = " mil "; } if ($thousands < 1) { $thousands_final_string = " "; } // this will handle numbers between 1 and 999 which // need no descriptor whatsoever. $centenas = $number; $centenas_final_string = string_literal_conversion($centenas) ; } //end if (number ==0) /*if (ereg("un",centenas_final_string)) { centenas_final_string = ereg_replace("","o",centenas_final_string); }*/ //finally, print the output. /* Concatena los millones, miles y cientos*/ $cad = $millions_final_string.$thousands_final_string.$centenas_final_string; /* Convierte la cadena a Mayúsculas*/ $cad = strtoupper($cad); if (strlen($centavos)>2) { if(substr($centavos,2,2)>= 5){ $centavos = substr($centavos,0,2)+(intval(substr($centavos,1,2))+1); } else{ $centavos = substr($centavos,0,3); } } /* Concatena a los centavos la cadena "/100" */ if (strlen($centavos)==1) { $centavos = $centavos."0"; } $centavos = $centavos. "/100"; /* Asigna el tipo de moneda, para 1 = PESO, para distinto de 1 = PESOS*/ if ($number == 1) { $moneda = " PESO "; } else { $moneda = " PESOS "; } /* Regresa el número en cadena entre paréntesis y con tipo de moneda y la fase M.N.*/ $importe=$cad.$moneda.$centavos." M.N."; return $importe; }
function sy_cnpj($compontos = true, $seed = null) { if (!is_null($seed)) { mt_srand($seed); } $n1 = mt_rand(0, 9); $n2 = mt_rand(0, 9); $n3 = mt_rand(0, 9); $n4 = mt_rand(0, 9); $n5 = mt_rand(0, 9); $n6 = mt_rand(0, 9); $n7 = mt_rand(0, 9); $n8 = mt_rand(0, 9); $n9 = 0; $n10 = 0; $n11 = 0; $n12 = 1; $d1 = $n12 * 2 + $n11 * 3 + $n10 * 4 + $n9 * 5 + $n8 * 6 + $n7 * 7 + $n6 * 8 + $n5 * 9 + $n4 * 2 + $n3 * 3 + $n2 * 4 + $n1 * 5; $d1 = 11 - mod($d1, 11); if ($d1 >= 10) { $d1 = 0; } $d2 = $d1 * 2 + $n12 * 3 + $n11 * 4 + $n10 * 5 + $n9 * 6 + $n8 * 7 + $n7 * 8 + $n6 * 9 + $n5 * 2 + $n4 * 3 + $n3 * 4 + $n2 * 5 + $n1 * 6; $d2 = 11 - mod($d2, 11); if ($d2 >= 10) { $d2 = 0; } $retorno = ''; if ($compontos) { $retorno = '' . $n1 . $n2 . "." . $n3 . $n4 . $n5 . "." . $n6 . $n7 . $n8 . "/" . $n9 . $n10 . $n11 . $n12 . "-" . $d1 . $d2; } else { $retorno = '' . $n1 . $n2 . $n3 . $n4 . $n5 . $n6 . $n7 . $n8 . $n9 . $n10 . $n11 . $n12 . $d1 . $d2; } return $retorno; }
define('IN_SITE', 1); $GLOBALS['root'] = dirname(dirname(__FILE__)); $GLOBALS['local'] = $GLOBALS['root'] . '/local'; $GLOBALS['inc'] = $GLOBALS['root'] . '/inc'; $GLOBALS['templates_path'] = $GLOBALS['local'] . '/templates'; require $GLOBALS['local'] . '/settings.php'; define('TEST', !isset($_SERVER['SERVER_NAME']) || $_SERVER['SERVER_NAME'] != 'onlinesequencer.net' || isset($_COOKIE['adminpass']) && $_COOKIE['adminpass'] == $settings['adminpass']); define('MOBILE_BROWSER', !isset($_GET['desktop']) && (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'Android'))); if (TEST) { error_reporting(E_ALL); } else { error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); } chdir($GLOBALS['root']); $link = mysqli_connect($settings['mysql_server'], $settings['mysql_user'], $settings['mysql_pass']); mysqli_select_db($link, $settings['mysql_db']); function mod($name) { global $inc, $root, $local, $templates_path, $settings, $userid; require_once $inc . '/functions.' . $name . '.php'; } require $GLOBALS['inc'] . "/functions.core.php"; mod("input"); mod("error"); mod("database"); mod('vars'); mod("data"); mod("js"); mod('sequencer'); date_default_timezone_set('America/New_York'); start_buffer();
function draw_y_axis($im, $ymin, $ymax, $xs, $ys, $height, $yoff, $do_text, $axes_color) { $grid_color = $this->allocate_color($this->grid_color); // Compute the Y axis. if (!strcmp($this->axes, "y") || !strcmp($this->axes, "xy")) { $ticks = $this->get_ticks($ymin, $ymax, $height); $length = sizeof($ticks); $whole = true; $ideal = $height / $this->font_size; if ($ideal >= $length) { $factor = 0.1; $valfactor = 0.1; } else { list($factor, $series) = $this->pleasing_numbers(ceil($length / $ideal)); if ($factor / $length < 2 && false) { if ($series == 5) { $series = 2; } elseif ($series == 2) { $series = 1; } else { $series = 5; } list($factor) = $this->pleasing_numbers(ceil(sizeof($ticks) / $ideal / 2), $series); } list($valfactor) = $this->pleasing_numbers(($ymax - $ymin) / 100, $series); } $spacing = abs($ticks[1] - $ticks[0]); for ($i = 0; $i < $length * 2; $i++) { $y = $ticks[0] + $spacing * $i; if (!mod($y, $factor)) { $offset = $i % $factor; break; } } $iy = -1; $print_real = false; for ($i = 0; $i < $length; $i += 1) { $y = $ticks[$i]; $yt = $yoff + $height - ($y * 1.0 - $ymin) / ($ymax - $ymin) * $height; if ($do_text) { if ($i >= $offset) { $iy++; } if (!((int) ($iy * 100) % ($factor * 100)) && $iy != -1) { if (ceil($spacing * 100) == 10 || ceil($spacing * 100) == 20) { $yst = sprintf("%.1f", $y); } else { if ($spacing < 1 && !mod($spacing * 10, 1)) { $yst = sprintf("%.1f", $y); } elseif (abs($spacing) < 1) { $yst = sprintf("%.2f", $y); } elseif (!($spacing % 1000000)) { $yst = sprintf("%sM", $y / 1000000); } elseif (!($spacing % 1000)) { $yst = sprintf("%sk", $y / 1000); } elseif (!$whole) { $yst = sprintf("%.1f", $y); } else { $yst = $y; } } if (strlen($yst) > 5) { $yst = (int) $yst; } if ($this->y_format == "percent") { $yst .= "%"; } if ($y * 10 % 10) { $whole = false; } if ($this->font_type == "type1") { list($llx, $lly, $urx, $ury) = imagepsbbox("{$yst}", $this->font, $this->font_size); // This is a filter to ween out any single pixel // differences in text width. $ww = $urx - $llx; if ($prev_ww != $ww && abs($prev_ww - $ww) < 3) { $ww = $prev_ww; } else { $prev_ww = $ww; } imagepstext($im, "{$yst}", $this->font, $this->font_size, $axes_color, $this->allocate_color("white"), (int) ($this->left_margin - 6 - $ww), (int) ($yt + 4), 0, 0, 0, 16); } elseif ($this->font_type == "internal") { imagestring($im, $this->font, $this->left_margin - 3 - strlen($yst) * 6, $yt - 7, $yst, $axes_color); } imageline($im, $this->left_margin - 3, $yt, $this->left_margin, $yt, $axes_color); } else { imageline($im, $this->left_margin - 1, $yt, $this->left_margin, $yt, $axes_color); } } else { // Draw the grid line. imageline($im, $this->left_margin + 1, $yt, $xs - $this->right_margin, $yt, $grid_color); } } if (!$do_text && $this->marked_grid_color) { $y = $this->marked_grid_point; $yt = $yoff + $height - ($y * 1.0 - $ymin) / ($ymax - $ymin) * $height; imageline($im, $this->left_margin + 1, $yt, $xs - $this->right_margin, $yt, $this->allocate_color($this->marked_grid_color)); } } }
<?php require 'inc/init.php'; require_once 'inc/solvemedialib.php'; mod('js'); $fail = 0; $success = 0; if (isset($_POST['adcopy_response'])) { $solvemedia_response = solvemedia_check_answer($settings['k_p'], $_SERVER["REMOTE_ADDR"], $_POST["adcopy_challenge"], $_POST["adcopy_response"], $settings['k_h']); if (!$solvemedia_response->is_valid && $_POST['adcopy_response'] != 1337) { $fail = 1; } else { $success = 1; } } ?> <html> <head> <?php show_css(array('/resources/style')); ?> <style type="text/css"> body { background: transparent; width: 310px; height: 290px; color: black; margin: 10px; padding: 0; position: relative; }
<?php include_once '../includes/core.php'; mod($action = 'fetch');
<?php mod("pager"); mod("form"); $gp = pager_init(66); $searchform = form_create('Search', 'inline', null, 'get'); form_add_param($searchform, 'Value', 'search', 'string', '', 100, 12); $search = p_string('search'); $basedon = p_int('basedon', 0); $sort = p_string('sort', 1); $date = p_string('date', empty($search) ? 1 : 4); if (isset($_GET['deleted'])) { $where = ' WHERE deleted=1 '; } else { if ($basedon) { $where = ' WHERE basedon="' . $basedon . '" '; } else { if (!empty($_GET["search"])) { $where = ' WHERE deleted=0 AND MATCH(title) AGAINST("%' . e_mysql($search) . '%") '; } else { $where = ' WHERE deleted=0 '; } } } switch ($sort) { case 2: $order = "accesscount DESC"; break; case 4: $order = "RAND()"; break;
function GerarCPF() { $n1 = '1'; $n2 = '1'; $n3 = '1'; $n4 = '1'; $n5 = rand(0, 9); $n6 = rand(0, 9); $n7 = rand(0, 9); $n8 = rand(0, 9); $n9 = rand(0, 9); $d1 = $n9 * 2 + $n8 * 3 + $n7 * 4 + $n6 * 5 + $n5 * 6 + $n4 * 7 + $n3 * 8 + $n2 * 9 + $n1 * 10; $d1 = 11 - mod($d1, 11); if ($d1 >= 10) { $d1 = 0; } $d2 = $d1 * 2 + $n9 * 3 + $n8 * 4 + $n7 * 5 + $n6 * 6 + $n5 * 7 + $n4 * 8 + $n3 * 9 + $n2 * 10 + $n1 * 11; $d2 = 11 - mod($d2, 11); if ($d2 >= 10) { $d2 = 0; } return $n1 . $n2 . $n3 . $n4 . $n5 . $n6 . $n7 . $n8 . $n9 . $d1 . $d2; }
// Include core file require_once 'core.php'; if (isset($_GET['do'])) { $butt = $_GET['do']; switch ($butt) { case "login": login($_POST['email'], $_POST['pass']); break; case "register": register($_POST['email'], $_POST['pass'], $_POST['code']); break; case "invite-generate": generate($_GET['email'], $_GET['level']); break; case "mod": mod($_GET['action'], $_GET['date'], $_GET['count'], $_GET['why'], $_GET['file'], $_GET['keyword'], $_GET['fileid'], $_GET['hash'], $_GET['orginalname']); break; case "cp": header('Location: ../panel'); break; case "search": search($_GET['q']); break; case "delete": delete($_GET['f'], $_GET['delid']); break; case "logout": session_unset(); session_destroy(); session_write_close(); header('Location: ../login');
<table width="700" height="483" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="700" height="509" align="center" valign="top"> <?php require_once 'funciones.php'; if (isset($HTTP_SESSION_VARS['usuario_registrado'])) { if (isset($_GET['menu']) && isset($_GET['accion'])) { if ($_GET['menu'] == act) { if ($_GET['accion'] == del && isset($_GET['id_cat'])) { Eliminar(limpia($_GET['id_cat'])); } if ($_GET['accion'] == modificar && isset($_GET['id_cat'])) { modificar(limpia($_GET['id_cat'])); } if ($_GET['accion'] == mod) { mod($_POST['id_cat'], limpia($_POST['id_catalogo']), limpia($_POST['ubicacion'])); } } } $id_usuario = $HTTP_SESSION_VARS['id_usuario']; //conexion a postgresql include "conn.php"; $conn = pg_connect("host={$dbhost} port={$dbport} dbname={$dbname} user={$dbuser} password={$dbpass}") or die('<div width="100%" class="error">OCURRIO UN ERROR AL INTENTAR CONECTAR A LA BASE DE DATOS <B>' . $dbname . ' </B></div>'); $_pagi_sql = "select count(*) from catalogo where id_usuario = '{$id_usuario}'"; $_pagi_nav_num_enlaces = 5; $_pagi_cuantos = 27; $_pagi_mostrar_errores = true; $_pagi_nav_estilo = "paginacion"; $_pagi_propagar = array(""); include 'paginator.inc.php'; $busca = "SELECT id_catalogo,ubicacion,id_cat\n\t\t\t\t\t\t\t\t\t\tfrom catalogo where id_usuario = '{$id_usuario}' order by id_catalogo desc";
function string_literal_conversion($number) { // first, divide your number in hundreds, tens and units, cascadig // trough subsequent divisions, using the modulus of each division // for the next. $hundreds = whole_part($number, 100); $number = mod($number, 100); $tens = whole_part($number, 10); $number = mod($number, 10); $units = whole_part($number, 1); $number = mod($number, 1); /* uncomment for debugging print('hundreds : '.$hundreds. '<br>'); print('tens : '.$tens. '<br>'); print('units : '.$units. '<br><hr>'); */ // cascade trough hundreds. This will convert the hundreds part to // their corresponding string in spanish. switch ($hundreds) { case 1: $string_hundreds = "ciento "; break; // Special case // Special case case 2: $string_hundreds = "doscientos "; break; case 3: $string_hundreds = "trescientos "; break; case 4: $string_hundreds = "cuatrocientos "; break; case 5: $string_hundreds = "quinientos "; break; // Special case // Special case case 6: $string_hundreds = "seiscientos "; break; case 7: $string_hundreds = "setecientos "; break; // Special case // Special case case 8: $string_hundreds = "ochocientos "; break; case 9: $string_hundreds = "novecientos "; break; // Special case } // end switch hundreds // casgade trough tens. This will convert the tens part to corresponding // strings in spanish. Note, however that the strings between 11 and 19 // are all special cases. Also 21-29 is a special case in spanish. switch ($tens) { case 1: // Special case, depends on units for each conversion switch ($units) { case 1: $string_tens = "once"; break; // Special case // Special case case 2: $string_tens = "doce"; break; // Special case // Special case case 3: $string_tens = "trece"; break; // Special case // Special case case 4: $string_tens = "catorce"; break; // Special case // Special case case 5: $string_tens = "quince"; break; // Special case // Special case case 6: $string_tens = "dieciseis"; break; // Special case // Special case case 7: $string_tens = "diecisiete"; break; // Special case // Special case case 8: $string_tens = "dieciocho"; break; // Special case // Special case case 9: $string_tens = "diecinueve"; break; // Special case } break; // end switch special case tens/units // end switch special case tens/units case 2: $string_tens = "veinti"; break; // Special case // Special case case 3: $string_tens = "treinta"; break; case 4: $string_tens = "cuarenta"; break; case 5: $string_tens = "cincuenta"; break; case 6: $string_tens = "sesenta"; break; case 7: $string_tens = "setenta"; break; case 8: $string_tens = "ochenta"; break; case 9: $string_tens = "noventa"; break; } // end switch tens // cascades trough units, This will convert the units part to corresponding // strings in spanish. Note however that a check is being made to see wether // the special cases 11-19 were used. In that case, the whole conversion of // individual units is ignored since it was already made in the tens cascade. if ($tens == 1) { $string_units = ""; // empties the units check, since it has alredy been handled on the tens switch } else { switch ($units) { case 1: $string_units = "un"; break; case 2: $string_units = "dos"; break; case 3: $string_units = "tres"; break; case 4: $string_units = "cuatro"; break; case 5: $string_units = "cinco"; break; case 6: $string_units = "seis"; break; case 7: $string_units = "siete"; break; case 8: $string_units = "ocho"; break; case 9: $string_units = "nueve"; break; } // end switch units } // end if-then-else //final special cases. This conditions will handle the special cases which //are not as general as the ones in the cascades. Basically four: // when you've got 100, you dont' say 'ciento' you say 'cien' // 'ciento' is used only for [101 >= number > 199] if ($hundreds == 1 and $tens == 0 and $units == 0) { $string_hundreds = "cien"; } // when you've got 10, you don't say any of the 11-19 special // cases.. just say 'diez' if ($tens == 1 and $units == 0) { $string_tens = "diez"; } // when you've got 20, you don't say 'veinti', which is used // only for [21 >= number > 29] if ($tens == 2 and $units == 0) { $string_tens = "veinte"; } // for numbers >= 30, you don't use a single word such as veintiuno // (twenty one), you must add 'y' (and), and use two words. v.gr 31 // 'treinta y uno' (thirty and one) if ($tens >= 3 and $units >= 1) { $string_tens = $string_tens . " y "; } // this line gathers all the hundreds, tens and units into the final string // and returns it as the function value. $final_string = $string_hundreds . $string_tens . $string_units; return $final_string; }
{ echo "Bad call\n"; } $i = 0; $a[$i = 1][++$i](); $a = -1; function foo1() { global $a; return ++$a; } $arr = array(array(0, 0), 0); $brr = array(0, 0, array(0, 0, 0, 5), 0); $crr = array(0, 0, 0, 0, array(0, 0, 0, 0, 0, 10), 0, 0); $arr[foo1()][foo1()] = $brr[foo1()][foo1()] + $crr[foo1()][foo1()]; $val = $arr[0][1]; echo "Expect 15 and get...{$val}\n"; $x = array(array(0), 0); function mod($b) { global $x; $x = $b; return 0; } $x1 = array(array(1), 1); $x2 = array(array(2), 2); $x3 = array(array(3), 3); $bx = array(10); $x[mod($x1)][mod($x2)] = $bx[mod($x3)]; // expecting 10,3 var_dump($x);
</td> </tr>'; unset($statrow); } $parse['who'] = $who; $parse['type_stat'] = 'PLAYER'; //$updaterank = ''; $parse['rows'] = ''; while ($statrow = mysql_fetch_array($stattable)) { $p++; $change = $statrow[$sort . "_rank"] - $p; if ($change > 0) { $ch = 'class="undermark" title="+' . mod(floor($change)) . '"'; $plus = "+"; } elseif ($change < 0) { $ch = 'class="overmark" title="-' . mod(floor($change)) . '"'; $plus = "-"; } else { $plus = "*"; } $alianza_tag = doquery("SELECT `ally_tag`, `ally_name` FROM {{table}} WHERE `id` = '" . $statrow['ally_id'] . "'", 'alliance'); $alianza_tag = mysql_fetch_array($alianza_tag); if ($statrow['ally_name'] != '' and $statrow['ally_id'] != '') { $ally = '<span class="ally-tag"><a href="./?page=ainfo&allyid=' . $statrow["ally_id"] . '" title="' . $alianza_tag["ally_name"] . '">[' . $alianza_tag["ally_tag"] . ']</span>'; } else { $ally = ''; } if ($p % 2 == 1) { $alt = ' class="alt"'; } else { $alt = '';