Ejemplo n.º 1
0
function getLoginCookie()
{
    //voodoo
    list($encryptedData, $iv) = explode(":", $_COOKIE["usr"]);
    $rawData = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, getSecret(), base64_decode($encryptedData), MCRYPT_MODE_CBC, $iv);
    return unserialize($rawData);
}
Ejemplo n.º 2
0
#!/usr/bin/env php
<?php 
include 'game.php';
print "Player A, enter your secret (4 Digits separated with SPACE):\n";
$secret = trim(getSecret(true));
$game = new Game();
$game->setPlayerNumbers(new GameNumberSet(explode(' ', $secret)));
while (true) {
    try {
        $hits = $game->getHits(new GameNumberSet(explode(' ', trim(readline("\nPlayer B move:\n")))));
        print implode(' ', $hits);
        if ($hits == [4, 0]) {
            print "\n\nPlayer B made it within {$game->getTries()} tries. Congratulations.\n\n";
            break;
        }
    } catch (Exception $e) {
        print $e->getMessage() . "\n";
    }
}
Ejemplo n.º 3
0
function setLoginCookie($user)
{
    $secret = getSecret();
    $login = sha1($user . $secret);
    $expiry = time() + 60 * 60 * 24 * 30;
    setcookie('user', $user, "{$expiry}");
    setcookie('dertyn', $login, "{$expiry}");
    $params = array('login' => $login, 'user' => $user);
    $result = query("user.setLoginCookie", $params);
}
Ejemplo n.º 4
0
function setLoginCookie($user)
{
    $secret = getSecret();
    $login = sha1($user . $secret);
    $expiry = time() + 60 * 60 * 24 * 30;
    setcookie('user', $user, "{$expiry}");
    setcookie('mooshu', $login, "{$expiry}");
    $query = "update user set cookie='{$login}' where name='{$user}'";
    $result = mysql_query($query);
}