Example #1
0
 function actionSelect()
 {
     if (empty($_GET['id'])) {
         raptor_error("Trying to select character in cabinet with no id");
     }
     $check = Database::GetOne("characters", array("_id" => Database::toId($_GET['id'])));
     if ($check['player'] == $_SESSION['id']) {
         if ($check['ban'] >= time()) {
             die('<script>alert("Вы были заблокированы \\n\\n Причина: ' . $check['ban_reason'] . '"); location.href = "/";</script>');
         } else {
             $_SESSION['cid'] = $_GET['id'];
             die('<script>location.href = "/p";</script>');
         }
     } else {
         raptor_error("Bad character id");
         echo '<script>alert("Ошибка при выборе персонажа");</script>';
     }
 }
 public static function register($login, $password, $email)
 {
     if (empty($login)) {
         raptor_error("Trying to register player with no login");
     }
     if (empty($password)) {
         raptor_error("Trying to register player with no password");
     }
     if (empty($email)) {
         raptor_error("Trying to register player with no email");
     }
     $check = Database::GetOne("players", array("login" => $login));
     if (isset($check['login'])) {
         return false;
     }
     $playerid = new MongoId();
     Database::Insert("players", array("login" => $login, "password" => md5($password), "email" => $email, "reg_ip" => $_SERVER['REMOTE_ADDR'], "last_ip" => $_SERVER['REMOTE_ADDR'], "last_date" => raptor_date(), "_id" => $playerid));
     return $playerid;
 }
Example #3
0
function raptor_error_handler($errno, $errstr, $errfile, $errline)
{
    #Database::Insert("errors", array("text" => $errstr, "date" => raptor_date(), "file" => $errfile, "line" => $errline));
    log_error("[{$errno}] {$errstr} (file: {$errfile}, line {$errline}) \n");
    if (defined("HIDE_ERRORS")) {
        return false;
    }
    switch ($errno) {
        case E_USER_ERROR:
            echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n";
            echo "  Фатальная ошибка в строке {$errline} файла {$errfile}";
            echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
            raptor_error($errstr, false);
            exit(1);
            break;
        case E_USER_WARNING:
            echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n";
            raptor_warning($errstr, false);
            break;
        case E_WARNING:
            echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n";
            raptor_warning($errstr, false);
            break;
        case E_NOTICE:
            echo "<b>NOTICE</b> [{$errno}] {$errstr}<br />\n";
            raptor_notice($errstr, false);
            break;
        case E_USER_NOTICE:
            echo "<b>NOTICE</b> [{$errno}] {$errstr}<br />\n";
            raptor_notice($errstr, false);
            break;
        default:
            echo "Error {$errno}: {$errstr}<br />\n";
            break;
    }
    return true;
}
Example #4
0
<div class="row">
    <?php 
if (substr($_GET['sel'], 1, 1) == ".") {
    raptor_error("Trying to access '" . SEPARATOR . "Graphics" . SEPARATOR . $_GET['sel'] . "' directory");
    die("Ошибка системы безопасности");
}
if (isset($_GET['sel'])) {
    $dir = STATIC_ROOT . SEPARATOR . "Graphics" . SEPARATOR . $_GET['sel'];
    if (isset($_FILES['userfile']['name'])) {
        $imageinfo = getimagesize($_FILES['userfile']['tmp_name']);
        if ($imageinfo['mime'] != 'image/gif' && $imageinfo['mime'] != 'image/jpeg' && $imageinfo['mime'] != 'image/png') {
            echo '<div class="alert alert-danger">Неверный MIME-тип</div>';
        } else {
            $uploadfile = $dir . SEPARATOR . basename($_FILES['userfile']['name']);
            if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
                echo '<div class="alert alert-success">Файл загружен</div>';
            } else {
                echo '<div class="alert alert-danger">Ошибка загрузки. Проверьте права доступа.</div>';
            }
        }
    }
    $files = scandir($dir);
    foreach ($files as $file) {
        if ($file == "." or $file == "..") {
            continue;
        }
        echo '<div class="col-lg-2 text-center">
							<div class="panel panel-default">
								<div class="panel-body">
									<img src="/storage/static/Graphics/' . $_GET['sel'] . '/' . $file . '" width=100 height=100>
									<p><a href="/storage/static/Graphics/' . $_GET['sel'] . '/' . $file . '">' . $file . '</a></p>