示例#1
0
  $this_user['userid'] = MMRPG_SETTINGS_GUEST_ID;
  $this_user['username'] = '******';
  $this_user['username_clean'] = 'demo';
  $this_user['imagepath'] = '';
  $this_user['colourtoken'] = '';
  $this_user['gender'] = 'male';
  $this_user['password'] = !empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'demo';
  $this_user['password_encoded'] = md5($this_user['password']);

  // Update the session with these demo variables
  $_SESSION['GAME']['DEMO'] = 1;
  $_SESSION['GAME']['USER'] = $this_user;
  $_SESSION['GAME']['counters']['battle_points'] = 0;

  // Reset the game session and reload the page
  rpg_game::reset_session();

  // Exit on success
  exit('success');

}

// Cache the currently online players
if (!isset($_SESSION['LEADERBOARD']['online_timestamp'])
  || (time() - $_SESSION['LEADERBOARD']['online_timestamp']) > 1){ // 600sec = 10min
  $_SESSION['LEADERBOARD']['online_players'] = rpg_prototype::leaderboard_online();
  $_SESSION['LEADERBOARD']['online_timestamp'] = time();
}


// Require the prototype data file