コード例 #1
0
ファイル: accountconf_test.php プロジェクト: reillo/ninjawars
    /**
     * group accountconf
     **/
    function testPauseAccountAndLoginShouldFail()
    {
        $confirm_worked = confirm_player($this->test_ninja_name, false, true);
        // name, no confirm #, just autoconfirm.
        $this->assertTrue((bool) $confirm_worked);
        $char_id = get_char_id($this->test_ninja_name);
        $paused = @pauseAccount($char_id);
        // Fully pause the account, make the operational bit = false
        $this->assertTrue((bool) $paused);
        $account_operational = query_item('select operational from accounts 
				join account_players on account_id = _account_id where _player_id = :char_id', array(':char_id' => $char_id));
        $this->assertFalse($account_operational);
        $res = @login_user($this->test_email, $this->test_password);
        $this->assertFalse($res['success'], 'Login should not be successful when account is paused');
        $this->assertTrue(is_string($res['login_error']));
        $this->assertTrue((bool) $res['login_error']);
    }
コード例 #2
0
ファイル: stats.php プロジェクト: ninjajerry/ninjawars
$changeprofile = in('changeprofile');
$newprofile = in('newprofile', null, 'toMessage');
$username = get_username();
$user_id = get_user_id();
$player = get_player_info();
$confirm_delete = false;
$profile_changed = false;
$profile_max_length = 500;
// Should match the limit in limitStatChars.js
$delete_attempts = SESSION::is_set('delete_attempts') ? SESSION::get('delete_attempts') : null;
if ($deleteAccount) {
    $verify = false;
    $verify = is_authentic($username, $passW);
    if ($verify == true && !$delete_attempts) {
        // *** Username&password matched, on the first attempt.
        pauseAccount($username);
        // This may redirect and stuff?
    } else {
        if ($deleteAccount == 2) {
            SESSION::set('delete_attempts', 1);
            $error = 'Deleting of account failed, please email ' . SUPPORT_EMAIL;
        } else {
            $confirm_delete = true;
        }
    }
} else {
    if ($changeprofile == 1) {
        // Limit the profile length.
        if ($newprofile != "") {
            $sql->Update("UPDATE players SET messages = '" . sql($newprofile) . "' WHERE uname = '" . sql($username) . "'");
            $affected_rows = $sql->a_rows;
コード例 #3
0
ファイル: account.php プロジェクト: reillo/ninjawars
// Unfiltered input.
$self_info = self_info();
$username = $self_info['uname'];
$user_id = self_char_id();
$confirm_delete = false;
$profile_changed = false;
$profile_max_length = 500;
// Should match the limit in limitStatChars.js - ajv: No, limitStatChars.js should be dynamically generated with this number from a common location -
$delete_attempts = SESSION::is_set('delete_attempts') ? SESSION::get('delete_attempts') : null;
$successMessage = null;
if ($deleteAccount) {
    $verify = false;
    $verify = is_authentic($username, $passW);
    if ($verify && !$delete_attempts) {
        // *** Username & password matched, on the first attempt.
        pauseAccount($user_id);
        // This may redirect and stuff?
        logout_user();
    } else {
        if ($deleteAccount == 2) {
            SESSION::set('delete_attempts', 1);
            $error = 'Deleting of account failed, please email ' . SUPPORT_EMAIL;
        } else {
            $confirm_delete = true;
        }
    }
} else {
    if ($change_email) {
        if ($change_email == 2) {
            $verify = is_authentic($username, $passW);
            if ($verify) {