Programmatically logout user without redirect
You need to change your hook code.

function MODULENAME_init() {
  if (!user_is_logged_in() &amp;&amp; request_uri() != '/user') {
    // Log in the user as user #31.
  }
  elseif (user_is_logged_in() &amp;&amp; request_uri() == '/user') {
    module_load_include('pages.inc', 'user');
    user_logout();
  }
}


Since user_logout() is defined in modules/user/user.pages.inc, you need to first load that file, and then call that function, or you will get an error about a not defined function. You don't need to first check the file has been already included, since it will not be included twice.

Keep in mind that http://ggames.kz/user could be directly accessed from users to see their user page, and that Drupal redirect logged-in users who try to access http://ggames.kz/user/login to http://ggames.kz/user.