Using user_load() and user_save() to change the status of a logged out user
In order to achieve that, I've tried
  using the following code in a page
  called auth.php I placed under my
  theme's root directory.


Normally in Drupal you don't create php files which are called externally. This can be done in some very rare cases. But most of the time you would define a menu callback in a module and have that call a function which you put your code in.

One of the issues that you have found is that Drupal is not bootstrapped from a generic PHP file. 

It is fairly straightforward to do this.


Create a module, with a .module file and a .info file.
Turn on this module via the admin interface.
In your module implement hook_menu() and provide a path to be called, in your example this could be 'mymodule/auth'.
Create a function which will be called when your menu hook is fired. 


There is a more in-depth tutorial here.