Ejemplo n.º 1
0
">
      
 <?php 
if (!$_GET['num']) {
    echo '<button class="btn btn-primary" type="submit">启动炸弹!</button>';
} else {
    echo '<button class="btn btn-warning" type="reset"><a href="http://sms.treeforests.com/">停止攻击!</a></button>';
}
?>
      
      </form>
      <span class="label label-inverse">***仅供娱乐,请用自己手机测试***</span>
<?php 
$num = $_GET['num'];
if ($num) {
    if (!checknum($num)) {
        header("location:/index.php?msg=num_error");
    } else {
        $n = $_GET['n'] ? $_GET['n'] : 0;
        $n++;
        ?>
<div class="alert alert-success">
Well done! 正在发送第<?php 
        echo $n;
        ?>
波炸弹. 30秒后自动发送第<?php 
        echo $n + 1;
        ?>
波.&nbsp;<button class="btn btn-danger"><a style="color:#fff;" href="index.php?num=<?php 
        echo $_GET['num'];
        ?>
Ejemplo n.º 2
0
#
#
#
#
#
#
#
#
# get settings
require "settings.php";
require "core-settings.php";
# decide what to do
if (isset($_REQUEST["key"])) {
    switch ($_REQUEST["key"]) {
        case "check":
            $OUTPUT = checknum();
            break;
        case "slctCat":
            $OUTPUT = slctCat($_REQUEST);
            break;
        case "confirm":
            $OUTPUT = confirm($_REQUEST);
            break;
        case "subacc":
            $OUTPUT = subacc($_REQUEST);
            break;
        case "confirmsub":
            $OUTPUT = confirmsub($_REQUEST);
            break;
        case "writesub":
            $OUTPUT = writesub($_REQUEST);
Ejemplo n.º 3
0
function checknum($var)
{
    if (is_numeric($var) == false) {
        // Se è un numero dà true, altrimenti false
        echo "Devi inserire un numero!\n";
        exit(1);
        // Il programma ha concluso l'esecuzione con errore
    }
}
echo "Quanti numeri hai? ";
$numeri = trim(fgets(STDIN));
// Ricevo l'input
checknum($numeri);
// Controllo che sia un numero
$somma = 0;
// Inizializzo a 0 la variabile
echo "\n";
// Vado a capo
// Dovrei usare $i=0 ma lo diminuisco di 1 nella verifica così l'output parte da 1
for ($i = 1; $i - 1 < $numeri; $i++) {
    echo "Numero {$i}: ";
    $somma += trim(fgets(STDIN));
    // Aumenta $somma del valore degli input
    checknum($somma);
}
$media = $somma / $numeri;
// Calcolo la media
echo "La media dei numeri è {$media}\n";
exit(0);
// Il programma ha concluso l'esecuzione con successo