$strregion[23] = "EU";
$auth_moren = 0;
if ($logincheck == 0) {
    $authaddbyservererrorid = 3;
} else {
    if (check_data("letters_code")) {
        $postcode = db_iconv("letters_code");
        if (md5(strtolower($postcode)) == $_SESSION['letters_code']) {
            if (check_data('authname') && check_data('region') && check_data('selectpic')) {
                $region = db_iconv('region', "post", TRUE, true);
                $authname = db_iconv('authname', "post", TRUE, true);
                $selectpic = db_iconv('selectpic', "post", TRUE, true);
                if (checkauthname($authname) && checkauthregion($region) && checkauthselectpic($selectpic)) {
                    $region = $strregion[$region];
                    try {
                        $auth = @Authenticator::generate($region);
                        $authserial = $auth->serial();
                        $authserect = $auth->secret();
                        $authrestorecode = $auth->restore_code();
                        if (isset($_POST['morenauthset'])) {
                            if ($_POST['morenauthset'] == "on") {
                                $sql = "UPDATE `authdata` SET `auth_moren`=0 WHERE `user_id`='{$user_id}' AND `auth_moren`=1";
                                update($sql);
                                $auth_moren = 1;
                            }
                        }
                        if (queryValue("SELECT COUNT(*) FROM `authdata` WHERE `user_id`='{$user_id}' AND `auth_moren`=1") == 0) {
                            $auth_moren = 1;
                        }
                        if (is_null($authserial)) {
                            $authaddbyservererrorid = 5;
Beispiel #2
0
<?php

require_once 'classes/Authenticator.php';
function usage()
{
    echo "Usage:\r\n";
    echo "\tphp php-bma.php new region\r\n";
    echo "\tphp php-bma.php generate serial secret\r\n";
    echo "\tphp php-bma.php restore serial restore_code\r\n\r\n";
}
$auth = false;
$method = isset($argv[1]) ? $argv[1] : null;
switch ($method) {
    case "new":
        if (count($argv) == 3) {
            $auth = Authenticator::generate($argv[2]);
            $message = "New Authenticator requested";
        }
        break;
    case "generate":
        if (count($argv) == 4) {
            $auth = Authenticator::factory($argv[2], $argv[3]);
            $message = "Generate codes";
        }
        break;
    case "restore":
        if (count($argv) == 4) {
            $auth = Authenticator::restore($argv[2], $argv[3]);
            $message = "Restore requested";
        }
        break;