Beispiel #1
0
function isItChristmas($time = null)
{
    // May as well uncomment this from 12/27 through 12/23
    // return "NO";
    // set Christmas
    $christmas = "12/25";
    $ip = getIp();
    // debug:
    // $ip = "193.51.208.14"; // French IP
    // $christmas = "12/24";
    $location = null;
    if ($ip) {
        // db credentials, see db.php.example
        require 'db.php';
        DBconnect($server, $username, $password, $database);
        $location = ipRoughLocate($ip);
        // if we don't know the country, let's assume eastern time (mediocre)
        if ($location["countryName"] == "(Unknown Country?)") {
            $local_time = easternTime($time);
        } else {
            $local_time = trueLocalTime($time, $location["lng"]);
        }
    } else {
        $local_time = easternTime($time);
    }
    $isit = strftime("%m/%d", $local_time) == $christmas;
    return $isit ? yes($location) : "NO";
}
Beispiel #2
0
function main()
{
    $a = array();
    $a['wat'] =& $a;
    $b = $a;
    // Make sure the next line triggers COW
    if (yes()) {
        // Force a new tracelet
        $a['wat'] = 5;
    }
    var_dump($a);
}
Beispiel #3
0
                }
            } elseif ($sides[1] % $n == 1) {
                if ($sides[2] < $n) {
                    no();
                } elseif ($sides[2] % $n == 0) {
                    $sides[3] -= 1;
                    if ($sides[3] < $n) {
                        no();
                    } elseif ($sides[3] % $n == 0) {
                        yes();
                    } else {
                        no();
                    }
                } elseif ($sides[2] % $n == 1) {
                    if ($sides[3] % $n == 0) {
                        yes();
                    } else {
                        no();
                    }
                } else {
                    no();
                }
            } else {
                no();
            }
        } else {
            no();
        }
    }
}
fclose($handle);
Beispiel #4
0
<?php

ob_clean();
if ($_GET['cmd'] == "logout") {
    session_destroy();
    exit("<br>" . yes("You are logged out!"));
}
try {
    $Query = new SourceQuery();
    $Query->Connect($_SESSION['s'], $_SESSION['port'], SQ_TIMEOUT, SQ_ENGINE);
    $Query->setRconPassword($_SESSION['p']);
    $r = $Query->Rcon(trim($_GET['cmd']));
    $dictionary = array('§9' => '<span class="text-primary">', '§c' => '<span class="text-danger">', '§a' => '<span class="text-success">', '§0' => '', '§o' => '<span style="font-style:italic">', "\n" => '</br>', '§r' => '</span>');
    $r = str_replace(array_keys($dictionary), $dictionary, $r);
    exit($r);
} catch (Exception $e) {
    echo fail($e->getMessage());
}