Пример #1
0
function my_clock($time) {
  if (!$time) return 'less than a minute';
  $days = floor($time/1440);
  $hour = $time/60%24;
  $mins = $time%60;
  return plus($days,'day',($hour|$mins)==0).plus($hour,'hour',$mins==0).plus($mins,'minute',true);
}
Пример #2
0
function run($times, $length)
{
    $a = new Benchmark('Functional Map x' . $times);
    $a1 = new Benchmark('Functional Map(w\\o plus) my_map x' . $times);
    $a2 = new Benchmark('Functional Map(w\\o plus) array_map x' . $times);
    $b = new Benchmark('array_map x' . $times);
    $c = new Benchmark('nromal map x' . $times);
    $manager = new Manager();
    $manager->addBenchmarks([$a, $a1, $a2, $b, $c]);
    $data = [];
    for ($i = 0; $i < $length; $i++) {
        $data[] = $i * 2 + 1;
    }
    $a->start();
    $plus = plus(1);
    for ($i = 0; $i < $times; $i++) {
        $res = map($plus, $data);
    }
    $a->stop();
    $a1->start();
    for ($i = 0; $i < $times; $i++) {
        $res = map2(function ($x) {
            return $x + 1;
        }, $data);
    }
    $a1->stop();
    $a2->start();
    for ($i = 0; $i < $times; $i++) {
        $res = map(function ($x) {
            return $x + 1;
        }, $data);
    }
    $a2->stop();
    $b->start();
    $func = function ($x) {
        return $x + 1;
    };
    for ($i = 0; $i < $times; $i++) {
        $res = array_map($func, $data);
    }
    $b->stop();
    $c->start();
    $func = function ($x) {
        return $x + 1;
    };
    for ($i = 0; $i < $times; $i++) {
        $res = [];
        foreach ($data as $i) {
            $res[] = $func($i);
        }
    }
    $c->stop();
    echo $manager->getResults('Test Array len =' . $length);
}
Пример #3
0
function try_main($count)
{
    $log_file = 'log.txt';
    // 记录日志,断点续算
    $url = 'http://192.168.1.1/';
    // http://192.168.1.1/userRpm/ChangeLoginPwdRpm.htm
    $str = 'abcdefghijklmnopqrstuvwxyz0123456789';
    $size = strlen($str);
    if (file_exists($log_file)) {
        $arr = unserialize(file_get_contents($log_file));
    } else {
        $arr = array_fill(0, $count, 0);
    }
    if (count($arr) != $count) {
        echo 'your last try ' . count($arr) . ' bit password, this time you try ' . $count . 'bits password, do you really want to do this?';
        exit;
    }
    $idx = 0;
    do {
        // 试用密码
        $pwd = '';
        for ($i = 0; $i < $count; $i++) {
            $pwd .= $str[$arr[$i]];
        }
        if (try_router_web($url, $pwd)) {
            echo $idx . ' succees: pwd = ' . $pwd . " !\n";
            exit;
        } else {
            echo $idx . ' fail: try pwd = ' . $pwd . "\n";
        }
        $rt = plus($arr, $size);
        if (++$idx == 100) {
            file_put_contents($log_file, serialize($arr));
            $idx = 0;
        }
    } while ($rt !== false);
}
Пример #4
0
 public function genPet($grade, $lv, $diffGrade, $randomGrade, $addBP, $intResult = true, $times = 20, $originLv = 1, $series = 0)
 {
     $this->load->helper('vector');
     $base = array('hp' => 20, 'mp' => 20, 'atk' => 20, 'def' => 20, 'egi' => 20, 'spr' => 100, 'rec' => 100);
     $addBP = $this->pet_model->arrayToGrade(explode(',', $addBP));
     $diffGrade = $this->pet_model->arrayToGrade($this->pet_model->charsToArray($diffGrade));
     $randomGrade = $this->pet_model->arrayToGrade($this->pet_model->charsToArray($randomGrade));
     $base = mul(1000, $base);
     $addBP = mul(100, $addBP);
     $grownGrade = up0(minus($grade, $diffGrade));
     $lvOneTotalBP = mul($times, plus($grownGrade, $randomGrade));
     //echo "1bp:";print_r($lvOneTotalBP);
     $grownBP = mul(($lv - 1) * 100, $this->tnt($grownGrade));
     //echo "grown";print_r($grownBP);
     $totalBP = int(plus($lvOneTotalBP, plus($grownBP, $addBP)));
     foreach ($base as $type => $value) {
         $tmp = $this->getPropFromBP($type, $totalBP);
         $base[$type] += $tmp;
     }
     $base = array_merge($base, mul(10, $totalBP));
     if ($intResult) {
         $base = int(mul(0.001, $base));
     } else {
         $base = mul(0.001, $base);
     }
     $results = array();
     $results[0] = $base;
     //产生常见的maxmin
     $rmmindiff = $this->arrayToGrade(array(0, 0, 0, 0, 0));
     $rmmaxdiff = $this->arrayToGrade(array(0, 0, 0, 0, 0));
     foreach ($grownGrade as $key => $gd) {
         $gdmod = $gd % 5;
         switch ($gdmod) {
             case 0:
                 $rmmindiff[$key] = -1 * min($lv - 1, round(sqrt($lv - 1) * 6 + 1)) * 0.5;
                 $rmmaxdiff[$key] = +1 * min($lv - 1, round(sqrt($lv - 1) * 6 + 1)) * 0.5;
                 break;
             case 4:
             case 1:
                 $rmmindiff[$key] = -0.5 * 3;
                 $rmmaxdiff[$key] = +0.5 * 3;
                 break;
             default:
                 break;
         }
     }
     $totalBPRmmMax = plus($totalBP, $rmmaxdiff);
     $propRmmMax = mul(1000, array('hp' => 20, 'mp' => 20, 'atk' => 20, 'def' => 20, 'egi' => 20, 'spr' => 100, 'rec' => 100));
     $propRmmMin = mul(1000, array('hp' => 20, 'mp' => 20, 'atk' => 20, 'def' => 20, 'egi' => 20, 'spr' => 100, 'rec' => 100));
     foreach ($propRmmMax as $type => $value) {
         $tmp = $this->getPropFromBP($type, int($totalBPRmmMax));
         $propRmmMax[$type] += $tmp;
     }
     $propRmmMax = array_merge($propRmmMax, mul(10, $totalBPRmmMax));
     if ($intResult) {
         $propRmmMax = int(mul(0.001, $propRmmMax));
     } else {
         $propRmmMax = mul(0.001, $propRmmMax);
     }
     $totalBPRmmMin = plus($totalBP, $rmmindiff);
     foreach ($propRmmMin as $type => $value) {
         $tmp = $this->getPropFromBP($type, int($totalBPRmmMin));
         $propRmmMin[$type] += $tmp;
     }
     $propRmmMin = array_merge($propRmmMin, mul(10, $totalBPRmmMin));
     if ($intResult) {
         $propRmmMin = int(mul(0.001, $propRmmMin));
     } else {
         $propRmmMin = mul(0.001, $propRmmMin);
     }
     $results[1] = $propRmmMin;
     $results[2] = $propRmmMax;
     return $results;
 }
Пример #5
0
/**
 * Computes the sum of an array of numbers.
 * ```php
 * sum([1, 2, 3, 4]) // 10
 * sum([]) // 0
 * ```
 *
 * @signature [Number] -> Number
 * @param  array $numbers
 * @return int|float
 */
function sum()
{
    return apply(curry(function ($numbers) {
        return reduce(plus(), 0, $numbers);
    }), func_get_args());
}
Пример #6
0
 public function test4speed()
 {
     echo '<pre>';
     echo '<meta charset = utf8>';
     $this->load->helper('vector');
     $pet = '1947 2899 270 254 184 93 星菇 mo 242 158::lv93 00002 162 52 40 52 242';
     echo $pet;
     echo '<br>';
     $petData = explode(' ', $pet);
     $grade = $this->pet_model->getGradesBySearch($petData[6]);
     $prop = array($petData[0], $petData[1], $petData[2], $petData[3], $petData[4]);
     $propmax = array($petData[0] + 1, $petData[1] + 1, $petData[2] + 1, $petData[3] + 1, $petData[4] + 1);
     $lv = $petData[5];
     $t1 = microtime(true);
     $bp = $this->pet_model->getBPByProp($prop);
     $bpmax = $this->pet_model->getBPByProp(plus($prop, array(1, 1, 1, 1, 1)));
     echo (microtime(true) - $t1) * 1000 . 'ms for directly MYSQL, bp range by prop range<br>';
     $t1 = microtime(true);
     $bpcal = $this->pet_model->getBPByPropByCalc($prop);
     $bpcalmax = $this->pet_model->getBPByPropByCalc(plus($prop, array(1, 1, 1, 1, 1)));
     echo (microtime(true) - $t1) * 1000 . 'ms for directly calc, bp range by prop range<br>';
     $t1 = microtime(true);
     $bpsqls = array();
     for ($i = 0; $i < 32; $i++) {
         $bpsqls[$i] = $this->pet_model->getBPByProp(plus($prop, array($i / 16 % 2, $i / 8 % 2, $i / 4 % 2, $i / 2 % 2, $i % 2)));
     }
     $bpsqlmax = clone $bpsqls[0];
     $bpsqlmin = clone $bpsqls[0];
     for ($i = 0; $i < 32; $i++) {
         foreach ($bpsqls[$i] as $key => $value) {
             $bpsqlmax->{$key} = max($bpsqlmax->{$key}, $value);
             $bpsqlmin->{$key} = min($bpsqlmin->{$key}, $value);
         }
     }
     echo (microtime(true) - $t1) * 1000 . 'ms for directly MYSQL, maxium and minum searched.<br>';
     $t1 = microtime(true);
     $bpcals = array();
     for ($i = 0; $i < 32; $i++) {
         $bpcals[$i] = $this->pet_model->getBPByPropByCalc(plus($prop, array($i / 16 % 2, $i / 8 % 2, $i / 4 % 2, $i / 2 % 2, $i % 2)));
     }
     $bpcalmax = $bpcals[0];
     $bpcalmin = $bpcals[0];
     for ($i = 0; $i < 32; $i++) {
         foreach ($bpcals[$i] as $key => $value) {
             $bpcalmax[$key] = max($bpcalmax[$key], $value);
             $bpcalmin[$key] = min($bpcalmin[$key], $value);
         }
     }
     echo (microtime(true) - $t1) * 1000 . 'ms for directly cal, maxium and minum searched.<br>';
     $t1 = microtime(true);
     $bprange = $this->pet_model->getBPRangeByProp($prop);
     $bpsql2min = $bprange[0];
     $bpsql2max = $bprange[1];
     echo (microtime(true) - $t1) * 1000 . 'ms for directly MYSQL2, maxium and minum searched.<br>';
     die(0);
 }
Пример #7
0
     echo htmlspecialchars($row["DEADs"]);
 } else {
     echo "&nbsp;";
 }
 echo "</td>\n";
 if (!$cacherdata) {
     echo "<td align=center>";
     if (non_vide($row["RM"])) {
         echo htmlspecialchars($row["RM"]) . plus($row["RMB"]) . htmlspecialchars($row["RMB"]);
     } else {
         echo "&nbsp;";
     }
     echo "</td>\n";
     echo "<td align=center>";
     if (non_vide($row["MM"])) {
         echo htmlspecialchars($row["MM"]) . plus($row["MMB"]) . htmlspecialchars($row["MMB"]);
     } else {
         echo "&nbsp;";
     }
     echo "</td>\n";
     //$sort = preg_replace("/,/","<br>",htmlspecialchars($row["Sorts"]));
     $sort = htmlspecialchars($row["Sorts"]);
     echo "<td align=left>" . $sort . "&nbsp;</td>\n";
 } else {
     echo "<td align=center>--</td>\n";
     echo "<td align=center>--</td>\n";
     echo "<td align=center>--</td>\n";
 }
 $lien_fiche = "href='/engine_view.php?troll=" . $row["No"] . "'";
 $lien_stats = "href='/vtt/stats_perso.php?id_troll=" . $row["No"] . "'";
 echo "<td><a {$lien_fiche}><font color=black>[F]</font></a></td>";
Пример #8
0
function spiplistes_calculer_balise_titre ($titre) {

	static $i_envelop = array('a', 'b', 'c', 'd');
	
	$now = $date = date('Y-m-d H:i:s');

	// longue comme un jour sans pain
	$pattern = '='
		// rechercher le bracket de gauche
		. '(?P<a>\[)'
		// le texte entre le bracket et la parenthese
		. '(?P<texte_avant>[^\(]*)'
		// la parenthese
		. '(?P<b>\()?\s*'
		// la balise DATE
		. '(?P<balise>#DATE)'
		// le ou les filtres de la balise
		. '(?P<filtres>(\s*\|\s*\w+\s*'
			// les parametres du filtre
			. '(?P<params>(\{[^\}]*})?)'
		. ')*)\s*'
		// la parenthese de droite
		. '(?P<c>\))?'
		// le texte entre la parenthese et le bracket
		. '(?P<texte_apres>[^\]]*)'
		// le bracket de droite
		. '(?P<d>\])'
		. '='
		;
		
	$recherche = array();
	$remplace = array();
	
	if($nres = intval(preg_match_all($pattern, $titre, $matches))) {

		for($ii = 0; $ii < $nres; $ii++)
		{
					
			$envelop = '';
			
			foreach($i_envelop as $aa) {
				$envelop .= (isset($matches[$aa][$ii])) ? $matches[$aa][$ii] : '';
				
			}
			
			// balise avec filtres
			if($envelop == '[()]')
			{
				$date = $now;
				
				$filtres = trim($matches['filtres'][$ii]);
				
				$params = trim($matches['params'][$ii]);
				$params = strlen($params) ? trim($params, '’\'{}') : '';
					
				$filtres = explode('|', $filtres);
				
				foreach($filtres as $ce_filtre)
				{
					$ce_filtre = trim($ce_filtre);
					if(strlen($ce_filtre))
					{
						$filtre = $ce_filtre;
						
						// tout les filtres demandent parametre
						// mais si ajout d'autres plus tard...
						//
						$params = false;
						if(($pos = strpos($ce_filtre, '{')) !== false)
						{
							$filtre = substr($ce_filtre, 0, $pos);
							
							$params = substr($ce_filtre, $pos);
							$params = strlen($params) ? trim($params, '’\'{}') : '';
						}
						switch($filtre) {
							case 'affdate':
								$v = $params;
								$v = preg_replace('=[^dDjlNSwzWFmMntLoYyaABgGhHiseIOPTZcrU\: \-]=', '', $v);
								$date = date($v);
								break;
							case 'plus':
								$v = intval($params);
								$date = plus($date, $v);
								break;
							case 'jour':
							case 'mois':
							case 'annee':
							case 'nom_mois':
							case 'ucfirst':
							case 'saison':
								$date = $filtre($date);
								break;
						}
					}
							
				}

				$recherche[] = $pattern;
				$remplace[] = $matches['texte_avant'][$ii] . $date . $matches['texte_apres'][$ii];
			}
		}
		
		if(count($remplace))
		{
			// remplacer les balises avec filtres
			$titre = preg_replace($recherche, $remplace, $titre, 1);
		}
		
		// reste des balises sans filtre ?
		if(strpos($titre, $s = '#DATE') !== false)
		{
			$titre = str_replace($s, $now, $titre);
		}
	}
	return($titre);
}
Пример #9
0
echo "<br>&nbsp;<br>\n";
echo "<table cellspacing=0 border=1 cellpadding=1 class=impair>\n";
echo "<tr><td align=right>Race</td>" . "<td align=left><select name=race size=1>" . "<option" . ($row["Race"] == "Kastar" ? " SELECTED" : "") . ">Kastar</option>" . "<option" . ($row["Race"] == "Skrim" ? " SELECTED" : "") . ">Skrim</option>" . "<option" . ($row["Race"] == "Durakuir" ? " SELECTED" : "") . ">Durakuir</option>" . "<option" . ($row["Race"] == "Tomawak" ? " SELECTED" : "") . ">Tomawak</option>" . "</select></td>" . "</tr>\n";
echo "<tr><td align=right>DLA<br>(Duree normale du Tour<br>+ Bonus/Malus sur la dur&eacute;e<br>+ Poids de l'&eacute;quipement)</td>" . "<td align=left><input name=dlah size=2 maxlength=2 value='" . htmlspecialchars($row["DLAH"], ENT_QUOTES) . "'>h" . "<input name=dlam size=2 maxlength=2 value='" . htmlspecialchars($row["DLAM"], ENT_QUOTES) . "'>min</td>" . "</tr>\n";
echo "<tr><td align=right>VUE</td>" . "<td align=left><input name=vue size=2 maxlength=2 value='" . htmlspecialchars($row["VUE"], ENT_QUOTES) . "'>" . "<input name=vueb size=3 maxlength=3 value='" . plus($row["VUEB"]) . htmlspecialchars($row["VUEB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>Niv</td><td align=left><input name=niveau size=2 maxlength=2 value='" . htmlspecialchars($row["Niveau"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>PVs</td><td align=left><input name=pvs size=3 maxlength=3 value='" . htmlspecialchars($row["PVs"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>REG</td>" . "<td align=left><input name=reg size=2 maxlength=2 value='" . htmlspecialchars($row["REG"], ENT_QUOTES) . "'>D3" . "<input name=regb size=3 maxlength=3 value='" . plus($row["REGB"]) . htmlspecialchars($row["REGB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>ATT</td>" . "<td align=left><input name=att size=2 maxlength=2 value='" . htmlspecialchars($row["ATT"], ENT_QUOTES) . "'>D6" . "<input name=attb size=3 maxlength=3 value='" . plus($row["ATTB"]) . htmlspecialchars($row["ATTB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>ESQ</td>" . "<td align=left><input name=esq size=2 maxlength=2 value='" . htmlspecialchars($row["ESQ"], ENT_QUOTES) . "'>D6" . "<input name=esqb size=3 maxlength=3 value='" . plus($row["ESQB"]) . htmlspecialchars($row["ESQB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>DEG</td>" . "<td align=left><input name=deg size=2 maxlength=2 value='" . htmlspecialchars($row["DEG"], ENT_QUOTES) . "'>D3" . "<input name=degb size=3 maxlength=3 value='" . plus($row["DEGB"]) . htmlspecialchars($row["DEGB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>ARM</td>" . "<td align=left><input name=arm size=2 maxlength=2 value='" . htmlspecialchars($row["ARM"], ENT_QUOTES) . "'>" . "<input name=armb size=2 maxlength=2 value='" . plus($row["ARMB"]) . htmlspecialchars($row["ARMB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>KILLs</td><td align=left><input name=kills size=3 maxlength=3 value='" . htmlspecialchars($row["KILLs"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>Décès</td><td align=left><input name=deads size=2 maxlength=2 value='" . htmlspecialchars($row["DEADs"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>RM</td>" . "<td align=left><input name=rm size=4 maxlength=4 value='" . htmlspecialchars($row["RM"], ENT_QUOTES) . "'>" . "<input name=rmb size=5 maxlength=5 value='" . plus($row["RMB"]) . htmlspecialchars($row["RMB"], ENT_QUOTES) . "'></td>" . "</tr>\n";
echo "<tr><td align=right>MM</td>" . "<td align=left><input name=mm size=4 maxlength=4 value='" . htmlspecialchars($row["MM"]) . "'>" . "<input name=mmb size=5 maxlength=5 value='" . plus($row["MMB"]) . htmlspecialchars($row["MMB"]) . "'></td>" . "</tr>\n";
# fin de la 1ère table
echo "</table>\n";
echo "<br>&nbsp;<br>\n";
# début de la 2nde table
echo "<table cellspacing=0 border=1 cellpadding=1 class=impair>\n";
echo "<tr><td align=right>Nom (complet) du Troll</td><td align=left>" . $row[nom_troll] . "></td></tr>\n";
echo "<tr><td align=right>Joueur</td><td class=pair align=left><input name=joueur size=50 maxlength=50 value='" . htmlspecialchars($row["Joueur"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>Age du Joueur</td><td class=pair align=left><input name=agejoueur size=3 maxlength=3 value='" . htmlspecialchars($row["AgeJoueur"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>Ville du Joueur</td><td class=pair align=left><input name=villejoueur size=50 maxlength=50 value='" . htmlspecialchars($row["VilleJoueur"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>MSN</td><td class=pair align=left><input name=msn size=50 maxlength=255 value='" . htmlspecialchars($row["MSN"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>ICQ</td><td class=pair align=left><input name=icq size=20 maxlength=20 value='" . htmlspecialchars($row["ICQ"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>Email</td><td class=pair align=left><input name=email size=50 maxlength=255 value='" . htmlspecialchars($row["EMail"], ENT_QUOTES) . "'></td></tr>\n";
echo "<tr><td align=right>Divers</td><td class=pair align=left><textarea name=divers cols=50 rows=5>" . htmlspecialchars($row["Divers"], ENT_QUOTES) . "</textarea></td></tr>\n";
# fin de la 2nde table
echo "</table>\n";
Пример #10
0
function ymnoj($pole, $pole1)
{
    return $pole * $pole1;
}
echo <<<END
<form name="" method="POST" action="">
   <input type="text" name="pole">
   <button type="submit" name="btn" value="+">+</button>
   <button type="submit" name="btn" value="-">-</button>
   <button type="submit" name="btn" value="/">/</button>
   <button type="submit" name="btn" value="*">*</button>
   <input type="text" name="pole1"> 
 </form>
END;
switch ($btn) {
    case '+':
        echo '= ' . plus($pole, $pole1);
        break;
    case '-':
        echo '= ' . minus($pole, $pole1);
        break;
    case '/':
        echo '= ' . del($pole, $pole1);
        break;
    case '*':
        echo '= ' . ymnoj($pole, $pole1);
        break;
    default:
        echo "Вводите числа!";
        break;
}
Пример #11
0
function my_check($time) {
  global $disks;
  if (!$time) return "unavailable (system reboot or log rotation)";
  $days = floor($time/86400);
  $hmss = $time-$days*86400;
  $hour = floor($hmss/3600);
  $mins = $hmss/60%60;
  $secs = $hmss%60;
  return plus($days,'day',($hour|$mins|$secs)==0).plus($hour,'hour',($mins|$secs)==0).plus($mins,'minute',$secs==0).plus($secs,'second',true).". Average speed: ".(isset($disks['parity']['sizeSb'])?my_scale($disks['parity']['sizeSb']*1024/$time,$unit,1)." $unit/sec":"unknown");
}
Пример #12
0
function getCategoryString($category, $subCategory, $title)
{
    global $leggings, $active, $palazzo, $pants, $printed, $missy, $leather, $fitness, $sublimation, $jeggings, $capri, $skirts, $jogger, $jeans, $harem, $seamless, $shorts, $basic;
    $categoryStr = '';
    $removableChars = array(" ", "_", ":", ";");
    $category = strtolower(str_replace($removableChars, "-", $category));
    $subcat = strtolower(str_replace($removableChars, "-", $subCategory));
    if (!($category == 'plussize' || $category == 'plus-size' || $category == 'kids' || $category == 'activewear' || $category == 'active-wear' || $category == 'pants' || $category == 'shorts' || $category == 'skirt' || $category == 'skirts')) {
        $category = getCategoryByStr($title);
    }
    $temp = getCategoryByStr($title);
    if ($temp == '-1') {
        return '';
    }
    if ($category == 'pants' || $category == 'shorts') {
        if ($temp != '') {
            $category = $temp;
        }
    }
    if ($temp == 'plus-size') {
        $category = 'plus-size';
    }
    if ($category == 'plussize' || $category == 'plus-size') {
        return 'plus-size' . plus($category, $subCategory, $title);
    } else {
        if ($category == 'kids') {
            return 'kids' . kids($category, $subCategory, $title);
        } else {
            if ($category == 'activewear' || $category == 'active-wear') {
                return 'activewear' . activewear($category, $subCategory, $title);
            } else {
                if ($category == 'skirt' || $category == 'skirts') {
                    return 'skirts';
                } else {
                    if ($category == 'leggings') {
                        return 'leggings' . leggings($category, $subCategory, $title);
                    } else {
                        if ($category == 'pants' || $category == 'shorts') {
                            return 'pants' . pants($category, $subCategory, $title);
                        }
                    }
                }
            }
        }
    }
}
Пример #13
0
{
    $args = func_get_args();
    $f = op(array_shift($args));
    return function () use($args, $f) {
        static $curried = true;
        return call_user_func_array('call_user_func', array_merge($args, func_get_args()));
    };
}
defun('parens', function ($x) {
    return "({$x})";
});
defun('upto', function ($n) {
    return $n ? range(0, $n - 1) : [];
});
defun('between', function ($x, $y) {
    return $x - $y ? map(plus($x), upto($y - $x + 1)) : [];
});
defun('branch', function ($then, $else, $condition, $x) {
    return $condition($x) ? $then($x) : $else($x);
});
defun('fanout', function ($funcs, $x) {
    return map(with($x), $funcs);
});
defun('until', function ($f, $x) {
    return loop(function ($y, $n) use($f) {
        return $f($y);
    }, $x);
});
defun('loop', function ($f, $acc) {
    return trampoline(y(function ($y, $f, $n, $x, $_) {
        list($stop, $x) = $f($x, $n);
Пример #14
0
function formatarResult($html)
{
    preg_match_all('#\\b((((ht|f)tps?://)|(www|ftp)\\.)[a-zA-Z0-9\\.\\#\\@\\:%_/\\?\\=\\~\\-]+)#i', $html, $match);
    $contUrl = 1;
    $contTotal = 0;
    $match[1] = array_unique($match[1]);
    plus();
    for ($i = 0; $i < count($match[1]); $i++) {
        if (isset($match[1][$i]) && !strstr($match[1][$i], "google") && !strstr($match[1][$i], "youtube") && !strstr($match[1][$i], "orkut") && !strstr($match[1][$i], "schema") && !strstr($match[1][$i], "blogger")) {
            $info = infoserver(gerarErroDB(urldecode($match[1][$i])));
            $url = gerarErroDB(urldecode($match[1][$i]));
            $url = "<a target='_black' href={$url} {$_SESSION['vull_style']}>{$url}</a>";
            echo "<p class='bordas'>\n                      <info>[<cont>{$contUrl}</cont>] - </info>  <url>{$url}</url> </br>{$info}\n\t\t      </p>";
            $contUrl++;
            $contTotal++;
        }
    }
    plus();
    $resultado = isset($_SESSION['resultado_vull']) ? $_SESSION['resultado_vull'] : exit;
    $resultado = explode("|", $resultado);
    $contRes = count($resultado) - 1;
    $resultadotxt = NULL;
    $nomeArquivo = "{$_POST['arquivo']}";
    $resultadotxt = base64_decode("U0NBTk5FUiBJTlVSTEJSIDEuMCAtIFsgYmxvZy5pbnVybC5jb20uYnIgXQ==") . " /DATA:" . date("d/m/Y H:i:s") . " /DORK: {$_POST['dork']}  /EXPLOIT: {$_POST['exploit']}\r\nTOTAL VULL:{$contRes}\r\n " . implode("\r\n", $resultado) . "\r\n\r\n";
    $resultado = implode("<br>", $resultado);
    print_r("<div class='resultado'>\n                 <p>TOTAL DE URL's: <info>{$contTotal}</info></p>\n                 <p>EXPLOIT USADO: <info>{$_POST['exploit']}</info></p>    \n                 <p>DORK: <info>{$_POST['dork']}</info></p>\n\t\t <p>TOTAL DE POSSÍVEIS VULL: <info>{$contRes}</info></p>\n\t\t <p>ARQUIVO COM RESULTADO: <info><a href='{$nomeArquivo}' target='_black'>{$nomeArquivo}</a></info></p>\t\n\t\t <p>LISTA: </p>\n\t\t <p>{$resultado}<p>\n\t\t </div>");
    $_SESSION['resultado_vull'] = NULL;
    $abrirtxt = fopen($nomeArquivo, "a");
    if ($abrirtxt == false) {
        die('Não foi possível criar o arquivo.');
    }
    fwrite($abrirtxt, $resultadotxt);
    fclose($abrirtxt);
}
Пример #15
0
}, 'flip2' => function () {
    return flip('map', [-1, -2], plus(5)) !== [4, 3];
}, 'compose1' => function ($x, $y, $z) {
    return call(compose(plus($x), mult($y)), $z) !== $x + $y * $z;
}, 'compose2' => function ($x, $y, $z) {
    return call(compose(mult($x), plus($y)), $z) !== $x * ($y + $z);
}, 'compose3' => function ($x, $y, $z) {
    $f = flip('map', [$x, $y]);
    $c = compose($f, 'plus');
    return $c($z) !== [$x + $z, $y + $z];
}, 'compose4' => function ($n) {
    return call(compose('id', 'id'), $n) !== $n;
}, 'compose5' => function ($x, $y, $z) {
    return call(compose(plus($x), plus($y)), $z) !== $x + $y + $z;
}, 'compose6' => function ($x, $y, $z) {
    return call(compose(flip('plus', $x), plus($y)), $z) !== $x + $y + $z;
}, 'compose7' => function ($x, $y, $z) {
    $f = flip('map', [$x, $y]);
    $c = compose($f, 'plus');
    return $c($z) !== [$x + $z, $y + $z];
}, 'compose8' => function ($x, $y) {
    $c = compose(with($x), 'plus');
    return $c($y) !== $x + $y;
}, 'sum' => function () {
    return sum($xs = range(0, mt_rand(1, 100))) !== array_reduce($xs, 'plus', 0);
}, 'random1' => function () {
    return !is_int(random(null));
}, 'mem1' => function () {
    return mem('true') <= 0;
}, 'upto1' => function ($n) {
    return count(upto($n % 100)) !== $n % 100;
Пример #16
0
function dessine_mm($s, $t)
{
    $coef = 0.05;
    echo "<tr class='mh_tdtitre'>";
    echo "<td colspan='10' align='center'> Maitrise Magique</td>";
    echo "</tr>";
    $a = $s->get_max_mm();
    dessine_barre("Min Guilde MM", "{$a['value']} " . $a[nom_troll] . " ({$a['normal']}" . plus($a[bonus]) . $a[bonus] . ")", $a[value], $coef);
    $a = $s->get_moyenne_mm();
    dessine_barre("Moy Guilde MM", "{$a['value']} " . $a, $a, $coef);
    $a = $s->get_max_race_mm();
    dessine_barre("Max Race MM", "{$a['value']} " . $a[nom_troll] . " ({$a['normal']}" . plus($a[bonus]) . $a[bonus] . ")", $a[value], $coef);
    $a = $s->get_moyenne_race_mm();
    dessine_barre("Moyenne Race MM", "{$a}", $a, $coef);
    $a = $s->get_max_alentour_race_mm();
    dessine_barre("Max Race niv+1/-1", "{$a['value']} " . $a[nom_troll] . " ({$a['normal']}" . plus($a[bonus]) . $a[bonus] . ")", $a[value], $coef);
    $a = $s->get_moyenne_alentour_race_mm();
    dessine_barre("Moy Race niv+1/-1", "{$a}", $a, $coef);
    dessine_barre("{$t->nom_troll} MM", $t->total_mm . " (" . $t->mm . plus($t->mm_bonus) . $t->mm_bonus . ")", $t->total_mm, $coef);
}
Пример #17
0
			<input type="submit" />
		</form>
	</body>
</html>
<?php
include("./lib.php");
$operand1 = isset($_POST["operand1"]) ? $_POST["operand1"] : false;
$operand2 = isset($_POST["operand2"]) ? $_POST["operand2"] : false;
if (($operand1 == false) || ($operand2 == false)) {
	exit;
}
if (!(is_numeric($operand1) && is_numeric($operand2))) {
	die("No numeric");
}
$operator = isset($_POST["operator"]) ? $_POST["operator"] : false;
if ($operator == false) {
	exit;
}
$result = 0;
if ($operator == "plus") {
	$result = plus($operand1, $operand2);
} else if ($operator == "minus") {
	$result = minus($operand1, $operand2);
} else if ($operator == "multiple") {
	$result = multiple($operand1, $operand2);
} else {
	$result = divide($operand1, $operand2);
}
echo($operand1." ".$operator." ".$operand2." = ".$result);
?>
Пример #18
0
function afficherFicheTrollVtt($id_troll)
{
    $vtt = selectDbVtt($id_troll);
    /* ------ Informations stratégiques ------- */
    ?>
   <table  border='0' cellpadding='0' cellspacing='2' class='mh_tdborder' align='center'width='100%'>
     <tr class='mh_tdpage'><td valign='top'>
    	<table  border='0' cellpadding='0' cellspacing='1' width='100%' align='center'>
     	 <tr class='mh_tdtitre'>
        <td align='center' colspan='2' >
	<?php 
    echo "Informations VTT " . RELAISMAGO . " - maj le " . date("d/m/y H:i", $vtt["date_maj"]) . "";
    echo " &nbsp;<img src=\"vtt/bullet_";
    if ($vtt["DateMaj"] == "20040331000000") {
        echo "white.gif\" alt=\"jamais\" title=\"jamais\"";
    } else {
        if ($vtt["Peremption"] <= 7) {
            echo "green.gif\" alt=\"< 1 semaine\" title=\"< 1 semaine\"";
        } else {
            if ($vtt["Peremption"] <= 30) {
                echo "blue.gif\" alt=\"< 1 mois\" title=\"< 1 mois\"";
            } else {
                echo "red.gif\" alt=\"> 1 mois\" title=\"> 1 mois\"";
            }
        }
    }
    echo ">";
    echo "</td></tr>";
    echo "<tr class='mh_tdpage'><td width='120' valign='top'>";
    /* --------- gauche ----- */
    echo "<table>";
    echo "<tr>";
    echo "<td>Race</td><td align=center>";
    echo htmlspecialchars($vtt["race_troll"]) . "</td>";
    echo "<tr><td>DLA</td><td align=center>";
    $dla = htmlspecialchars($vtt["DLAH"] . "h");
    $dla .= $vtt["DLAM"] < 10 ? "0" : "";
    $dla .= htmlspecialchars($vtt["DLAM"]);
    echo ecrireCacherTexte($cacherdata, $dla);
    echo "</td></tr>";
    echo "<tr><td>";
    echo "Taille Vue";
    echo "<td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["VUE"]) . plus($vtt["VUEB"]) . htmlspecialchars($vtt["VUEB"]));
    echo "</td></tr>";
    echo "<tr><td>Niveau</td><td align=center>";
    echo htmlspecialchars($vtt["niveau_troll"]);
    echo "</td></tr>";
    echo "<tr><td>Pv</td><td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["PVs"]));
    echo "</td></tr>";
    echo "<tr><td>REG</td><td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["REG"]) . "D3" . plus($vtt["REGB"]) . htmlspecialchars($vtt["REGB"]));
    echo "</td></tr>";
    echo "<tr><td>ATT</td><td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["ATT"]) . "D6" . plus($vtt["ATTB"]) . htmlspecialchars($vtt["ATTB"]));
    echo "</td></tr>";
    echo "<tr><td>ESQ</td><td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["ESQ"]) . "D6" . plus($vtt["ESQB"]) . htmlspecialchars($vtt["ESQB"]));
    echo "</td></tr>";
    echo "<tr><td>DEG</td><td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["DEG"]) . "D3" . plus($vtt["DEGB"]) . htmlspecialchars($vtt["DEGB"]));
    echo "</td></tr>";
    echo "<tr><td>ARM</td><td align=center>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["ARM"]) . plus($vtt["ARMB"]) . htmlspecialchars($vtt["ARMB"]));
    echo "</td></tr>";
    echo "</table>";
    /* --------- fin gauche --------- */
    echo "</td><td valign='top' width='280'>";
    /* --------- début droite --------- */
    echo "<table>";
    echo "<tr><td valign='top'>Kills</td><td>";
    echo htmlspecialchars($vtt["KILLs"]);
    echo "</td></tr>";
    echo "<tr><td>Morts</td><td>";
    echo htmlspecialchars($vtt["DEADs"]);
    echo "</td></tr>";
    echo "<tr><td>RM</td><td>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["RM"]) . plus($vtt["RMB"]) . htmlspecialchars($vtt["RMB"]));
    echo "</td></tr>";
    echo "<tr><td>MM</td><td>";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["MM"]) . plus($vtt["MMB"]) . htmlspecialchars($vtt["MMB"]));
    echo "</td></tr>";
    echo "<tr valign='top'><td>Sorts</td><td align=left>&nbsp;";
    echo ecrireCacherTexte($cacherdata, htmlspecialchars($vtt["Sorts"]));
    echo "</td></tr>";
    echo "<tr><td valign='top'>Compétences</td>";
    echo "<td align=left valign='top'>&nbsp;";
    $comp = preg_replace("/,/", "<br>", $vtt["Comps"]);
    echo ecrireCacherTexte($cacherdata, $comp);
    echo "</td></tr>";
    echo "</table>";
    /* -------- fin droite ---------- */
    echo "</td></tr>";
    echo "</table>";
    if ($_SESSION['AuthTroll'] == $id_troll) {
        echo "<center>";
        echo "<input type=button class='mh_form_submit' onClick='javascript=document.location.href=\"";
        echo "/vtt/parser_profil.php?id={$id_troll}\"' value='Mettre à jour'>";
        echo "</center>";
    }
    echo "</td></tr>";
    echo "</table>";
}
     break;
 case 'express':
     echo "teraz: " . express() . "\r\n";
     break;
 case 'famakielce':
     foreach (FaMaKielce() as $key => $info) {
         echo $key . ": " . $info . "\r\n";
     }
     break;
 case 'famatomaszow':
     foreach (FaMaTomaszow() as $key => $info) {
         echo $key . ": " . $info . "\r\n";
     }
     break;
 case 'plus':
     echo "teraz: " . plus() . "\r\n";
     break;
 case 'plusfm':
     foreach (plusFm() as $key => $info) {
         echo $key . ": " . $info . "\r\n";
     }
     break;
 case 'vanessa':
     echo "teraz: " . vanessa() . "\r\n";
     break;
 case 'rmffm':
     foreach (rmfFm() as $key => $info) {
         echo $key . ": " . $info . "\r\n";
     }
     break;
 case 'rmfmaxxx':
Пример #20
0
 function provider()
 {
     return [[[1, 2, 3, 4], id(), [1, 2, 3, 4]], [[], id(), []], [[1, 2, 3, 4], plus(1), [2, 3, 4, 5]], [[], plus(1), []]];
 }
Пример #21
0
function formatarResult($html)
{
    plus();
    echo "0xCarregando...\n";
    preg_match_all('#\\b((((ht|f)tps?://)|(www|ftp)\\.)[a-zA-Z0-9\\.\\#\\@\\:%_/\\?\\=\\~\\-]+)#i', $html, $match);
    $contUrl = 1;
    $contTotal = 0;
    $match[1] = array_unique($match[1]);
    for ($i = 0; $i < count($match[1]); $i++) {
        if (isset($match[1][$i]) && !strstr($match[1][$i], "google") && !strstr($match[1][$i], "youtube") && !strstr($match[1][$i], "orkut") && !strstr($match[1][$i], "schema") && !strstr($match[1][$i], "blogger") && !strstr($match[1][$i], "gstatic")) {
            $info = infoserver(gerarErroDB(urldecode($match[1][$i])));
            $url = urldecode($match[1][$i]);
            echo "\r\n----------------------------------------------------------------------------------------------------------------------------\n";
            echo "0x[ {$contUrl} ] - {$_SESSION['config']['vull_style']}{$url}{$_SESSION['config']['exploit']}\r\n{$info}\n";
            echo isset($_SESSION['config']['erroReturn']) && !empty($_SESSION['config']['erroReturn']) ? "{$_SESSION['config']['erroReturn']}\n" : "";
            echo "----------------------------------------------------------------------------------------------------------------------------\r\n";
            $contUrl++;
            $contTotal++;
        }
    }
    plus();
    $resultado = isset($_SESSION['config']['resultado_vull']) ? $_SESSION['config']['resultado_vull'] : exit;
    $resultado = explode("|", $resultado);
    $contRes = count($resultado) - 1;
    $resultadotxt = NULL;
    $nomeArquivo = "{$_SESSION['config']['arquivo']}";
    $resultadotxt = base64_decode("U0NBTk5FUiBJTlVSTEJSIDEuMCAtIFsgYmxvZy5pbnVybC5jb20uYnIgXQ==") . " /DATA:" . date("d/m/Y H:i:s") . " /DORK: {$_SESSION['config']['dork']}  /EXPLOIT: {$_SESSION['config']['exploit']}\r\nTOTAL VULL:{$contRes}\r\n " . implode("\r\n", $resultado) . "\r\n\r\n";
    $resultado = implode("\r\n", $resultado);
    print_r("\r\nTOTAL DE URL's: {$contTotal}\r\nEXPLOIT USADO: {$_SESSION['config']['exploit']}\r\nDORK: {$_SESSION['config']['dork']}\r\nTOTAL DE POSSÍVEIS VULL: {$contRes}\r\nARQUIVO COM RESULTADO:{$nomeArquivo}\r\nLISTA:\r\n {$resultado}\r\n");
    $_SESSION['config']['resultado_vull'] = NULL;
    $abrirtxt = fopen($nomeArquivo, "a");
    if ($abrirtxt == false) {
        die("\r\nNão foi possível criar o arquivo.");
    }
    $resultadotxt = str_replace("", '', $resultadotxt);
    $resultadotxt = str_replace("", '', $resultadotxt);
    fwrite($abrirtxt, $resultadotxt);
    fclose($abrirtxt);
}