コード例 #1
0
 /**
  * @phutil-external-symbol function mysql_multi_query
  * @phutil-external-symbol function mysql_fetch_result
  * @phutil-external-symbol function mysql_more_results
  * @phutil-external-symbol function mysql_next_result
  */
 protected function rawQueries(array $raw_queries)
 {
     $conn = $this->requireConnection();
     $results = array();
     if (!function_exists('mysql_multi_query')) {
         foreach ($raw_queries as $key => $raw_query) {
             $results[$key] = $this->processResult($this->rawQuery($raw_query));
         }
         return $results;
     }
     if (!mysql_multi_query(implode("\n;\n\n", $raw_queries), $conn)) {
         $ex = $this->processResult(false);
         return array_fill_keys(array_keys($raw_queries), $ex);
     }
     $processed_all = false;
     foreach ($raw_queries as $key => $raw_query) {
         $results[$key] = $this->processResult(@mysql_fetch_result($conn));
         if (!mysql_more_results($conn)) {
             $processed_all = true;
             break;
         }
         mysql_next_result($conn);
     }
     if (!$processed_all) {
         throw new Exception(pht('There are some results left in the result set.'));
     }
     return $results;
 }
コード例 #2
0
ファイル: mysql_db.php プロジェクト: jgianpiere/ZanPHP
 public function query($SQL)
 {
     if ($SQL !== "") {
         if (stristr($SQL, "call") and stripos($SQL, "call") === 0) {
             @mysql_multi_query($SQL, self::$connection);
             $this->query = @mysql_store_result(self::$connection);
             if (@mysql_more_results(self::$connection)) {
                 @mysql_next_result(self::$connection);
             }
         } else {
             $this->query = mysql_query($SQL, self::$connection);
         }
     }
     return $this->query ? $this->query : false;
 }
コード例 #3
0
function irc_scan_log_auslesen($pfad, $datei, $datum)
{
    $scan_typ1 = array("sektorscan", "einheitenscan", "gesch.*zscan", "mili.*scan");
    $scan_typ2 = array("sek", "unit", "g", "mili");
    $scan_timeout = 6;
    // Nach wie vielen Zeilen ein unvolständiger Scan übersprungen wird
    $chan = preg_replace('/(_' . $datum . '\\.log)/', '', $datei);
    $query[0] = 'SELECT tag, zeile FROM gn4irc_scans WHERE chan="' . $chan . '"';
    $eintrag = mysql_multi_query($query, 1, 0);
    $last = $eintrag['zeile'];
    if ($last == "") {
        $last = 0;
    } else {
        if ($eintrag['tag'] != date("d")) {
            $last = 0;
        }
    }
    settype($lsat, "int");
    $last++;
    $z0 = 0;
    $z1 = 0;
    $handle = fopen($pfad . $datei, "r");
    while (!feof($handle)) {
        $z0++;
        $buffer = trim(fgets($handle, 400));
        if ($z0 >= $last) {
            $muster[0] = '/' . chr(3) . '[0-9]{2}\\,[0-9]{2}/';
            $muster[1] = '/' . chr(3) . '/';
            $muster[2] = '/' . chr(32) . '+/';
            $muster[3] = '/</';
            $muster[4] = '/>/';
            $ersetzen[0] = '';
            $ersetzen[1] = '';
            $ersetzen[2] = chr(32);
            $ersetzen[3] = '';
            $ersetzen[4] = '';
            $buffer = preg_replace($muster, $ersetzen, $buffer);
            $log[$z1] = $buffer;
            $z1++;
        }
    }
    fclose($handle);
    $len0 = count($log);
    for ($i0 = 0; $i0 < $len0; $i0++) {
        $len1 = count($scan_typ1);
        for ($i1 = 0; $i1 < $len1; $i1++) {
            if (preg_match('/(' . $scan_typ1[$i1] . ')/', strtolower($log[$i0])) && preg_match('/%/', $log[$i0])) {
                preg_match('/[0-9]{2}\\|[0-9]{2}\\|[0-9]{2}/', $log[$i0], $scan_datum, PREG_OFFSET_CAPTURE);
                $a_typ = $scan_typ2[$i1];
                $scan_start = $i0 + 1;
                // Zeilen angabe(Immer eins mehr als aktuells Array)
                for ($i2 = 1; $i2 <= $scan_timeout; $i2++) {
                    $zeile = $log[$i0 + $i2];
                    if (!isset($log[$i0 + $i2])) {
                        break 1;
                    }
                    $split = preg_split('/' . chr(32) . '/', $log[$i0 + $i2]);
                    $len3 = count($split);
                    for ($i3 = 1; $i3 <= $len3; $i3++) {
                        $split[$i3] = preg_replace('/[^0-9:]/', '', $split[$i3]);
                        if (koord_check($split[$i3]) || stristr($zeile, "gn-scr1pt by wurst - #wursts.scr1pt1ng-ecke")) {
                            $scan_ende = $scan_start + $i2;
                            $last = $last + $scan_ende - 1;
                            break 4;
                        }
                    }
                }
                if (!isset($scan_ende) && $i2 == 6) {
                    unset($scan_start);
                }
            }
        }
    }
    if (!isset($scan_ende)) {
        $last--;
        if (!isset($scan_start)) {
            $last = count($log) + $last - 1;
        }
    }
    $query[0] = 'DELETE FROM gn4irc_scans WHERE chan="' . $chan . '"';
    $query[1] = 'INSERT INTO gn4irc_scans (tag, zeile, chan) VALUES ("' . date("d") . '", "' . $last . '", "' . $chan . '")';
    mysql_multi_query($query);
    if (isset($scan_ende)) {
        // mindestens ein scan gefunden
        for ($i0 = $scan_start; $i0 <= $scan_ende; $i0++) {
            $log[$i0 - 1] = trim($log[$i0 - 1]);
            $scan .= $log[$i0 - 1] . chr(13) . chr(10);
        }
        //eval('irc_'.$a_typ.'_scan('.$scan.');');
        $s_datum = preg_replace('/\\|/', ':', $scan_datum[0][0]);
        $s_datum .= " " . date("d.m.Y");
        $s_datum = substr($s_datum, 0, 5) . substr($s_datum, 8);
        if ($a_typ == "sek") {
            irc_sek_scan($scan, $s_datum, 1);
        } elseif ($a_typ == "unit") {
            irc_unit_scan($scan, $s_datum, 1);
        } elseif ($a_typ == "g") {
            irc_g_scan($scan, $s_datum, 1);
        } elseif ($a_typ == "mili") {
            irc_mili_scan($scan, $s_datum, 1);
        }
        unset($scan_start);
        unset($scan_ende);
        irc_scan_log_auslesen($pfad, $datei, $datum);
    }
}
コード例 #4
0
 function add_nick_to_db($gala, $planet, $name)
 {
     if ($this->debug == 1) {
         print_r($scan);
         print_r($sek);
     } else {
         $query[0] = 'DELETE FROM gn4gnuser WHERE gala="' . $gala . '" AND planet="' . $planet . '"';
         $query[1] = 'INSERT INTO gn4gnuser (gala, planet, name, erfasst) ' . 'VALUES ("' . $gala . '", "' . $planet . '", "' . $name . '", "' . time() . '")';
         mysql_multi_query($query);
     }
 }
コード例 #5
0
ファイル: inc_kampf.php プロジェクト: albertlast/ticenter_tic
function a_koord()
{
    global $a, $v, $me, $ke, $Benutzer;
    if (preg_match('/^[0-9]{1,4}$/', $_POST['a_gala']) && preg_match('/^[0-9]{1,2}$/', $_POST['a_planet'])) {
        $mysql_senden[0] = 'SELECT * FROM gn4scans WHERE rg="' . $_POST['a_gala'] . '" AND rp="' . $_POST['a_planet'] . '" AND type="0" LIMIT 1;';
        $mysql_senden[1] = 'SELECT * FROM gn4scans WHERE rg="' . $_POST['a_gala'] . '" AND rp="' . $_POST['a_planet'] . '" AND type="1" LIMIT 1;';
        $mysql_senden[2] = 'SELECT * FROM gn4scans WHERE rg="' . $_POST['a_gala'] . '" AND rp="' . $_POST['a_planet'] . '" AND type="3" LIMIT 3;';
        $mysql_senden[3] = 'SELECT * FROM gn4scans WHERE rg="' . $Benutzer['galaxie'] . '" AND rp="' . $Benutzer['planet'] . '" AND type="1" LIMIT 3;';
        $daten = mysql_multi_query($mysql_senden, 1);
        if ($daten[0]['id'] != '') {
            $me = $daten[0]['me'];
            $ke = $daten[0]['ke'];
        }
        if ($daten[1]['id'] != '') {
            $v[0] = $daten[1]['sfj'];
            $v[1] = $daten[1]['sfb'];
            $v[2] = $daten[1]['sff'];
            $v[3] = $daten[1]['sfz'];
            $v[4] = $daten[1]['sfkr'];
            $v[5] = $daten[1]['sfsa'];
            $v[6] = $daten[1]['sft'];
            $v[7] = $daten[1]['sfka'];
            $v[8] = $daten[1]['sfsu'];
        }
        if ($daten[2]['id'] != '') {
            $v[9] = $daten[2]['glo'];
            $v[10] = $daten[2]['glr'];
            $v[11] = $daten[2]['gmr'];
            $v[12] = $daten[2]['gsr'];
            $v[13] = $daten[2]['ga'];
        }
        if (isset($_POST['e_flotte']) && $daten[3]['id'] != '') {
            $a[0] = $daten[3]['sfj'];
            $a[1] = $daten[3]['sfb'];
            $a[2] = $daten[3]['sff'];
            $a[3] = $daten[3]['sfz'];
            $a[4] = $daten[3]['sfkr'];
            $a[5] = $daten[3]['sfsa'];
            $a[6] = $daten[3]['sft'];
            $a[7] = $daten[3]['sfka'];
            $a[8] = $daten[3]['sfsu'];
        }
    }
}
コード例 #6
0
ファイル: bogus_connection.php プロジェクト: badlamer/hhvm
<?php

$bogus = 42;
var_dump(mysql_next_result($bogus));
var_dump(mysql_fetch_result($bogus));
var_dump(mysql_more_results($bogus));
var_dump(mysql_multi_query('SELECT 1;', $bogus));