Esempio n. 1
0
        echo loca("OPTIONS_APPLY");
        ?>
" /></th>  </tr>
 </form>
 </table>

<?php 
        // ======================================================================================
        // Обычное меню.
    } else {
        // Обработать POST-запрос.
        if (method() === "POST" && !key_exists('urlaub_aus', $_POST)) {
            if ($GlobalUser['name_changed'] == 0 && $_POST['db_character'] !== $GlobalUser['oname']) {
                // Сменить имя.
                $forbidden = explode(",", "hitler, fick, adolf, legor, aleena, ogame, mainman, fishware, osama, bin laden, stalin, goebbels, drecksjude, saddam, space, ringkeeper, administration");
                if (IsUserExist($_POST['db_character'])) {
                    $OptionsError = loca("OPTIONS_ERR_EXISTNAME");
                } else {
                    if (!CanChangeName($GlobalUser['player_id'])) {
                        $OptionsError = loca("OPTIONS_ERR_NAME_WEEK");
                    } else {
                        if (mb_strlen($_POST['db_character']) < 3 || mb_strlen($_POST['db_character']) > 20) {
                            $OptionsError = loca("OPTIONS_ERR_NAME_3_20");
                        } else {
                            if (preg_match('/[<>()\\[\\]{}\\\\\\/\\`\\"\'.,:;*+]/', $_POST['db_character'])) {
                                $OptionsError = loca("OPTIONS_ERR_NAME_SPECIAL");
                            }
                        }
                    }
                }
                $lower = mb_strtolower($_POST['db_character'], 'UTF-8');
Esempio n. 2
0
require_once 'db.php';
$password = md5($_POST["password"]);
$username = $_POST["username"];
function IsUserExist($u)
{
    $result = mysql_query("select count(*) from user where username='******'");
    if ($result) {
        $row = mysql_fetch_row($result);
        if ($row[0] == 1) {
            return TRUE;
        }
    }
    return FALSE;
}
if (IsUserExist($username)) {
    echo "exist username";
    $result = mysql_query("SELECT id,usergroup FROM user WHERE username='******' and pw = '" . $password . "'");
    if ($result && mysql_num_rows($result) > 0) {
        $row = mysql_fetch_row($result);
        $uid = $row[0];
        $usergroup = $row[1];
        echo $uid;
        session_start();
        $_SESSION["log"] = true;
        if ($usergroup == $ADMIN_USERGROUP) {
            $_SESSION["admin"] = true;
        } else {
            $_SESSION["admin"] = false;
        }
        $_SESSION["uid"] = $uid;
Esempio n. 3
0
function AddBot($name)
{
    global $db_prefix;
    // Сгенерировать пароль.
    $len = 8;
    $r = '';
    for ($i = 0; $i < $len; $i++) {
        $r .= chr(rand(0, 25) + ord('a'));
    }
    $pass = $r;
    if (!IsUserExist($name)) {
        $player_id = CreateUser($name, $pass, '', 'en', true);
        $query = "UPDATE " . $db_prefix . "users SET validatemd = '', validated = 1 WHERE player_id = " . $player_id;
        dbquery($query);
        StartBot($player_id);
        SetVar($player_id, 'password', $pass);
        return true;
    } else {
        return false;
    }
}