How do I override the login function I have inherited an outdated Drupal 6 site with hacked modules. I did update core and all the modules that I could.

This php code is from a block for logging in. This redirects an authorized user to be directed to node-20.tpl.php.

&lt;?php  global $user; ?&gt;
&lt;form action="&lt;?php print "/{$base_path}user/login/?travelagents"?&gt;" method="post" id="user-login"&gt;
  &lt;div class="restrictedloginwrapper"&gt;
    &lt;div class="restrictedlogin"&gt;
      &lt;h4&gt;CLIA number or Agent key:&lt;/h4&gt;
      &lt;input type="text" maxlength="60" name="name" id="edit-name" size="22" value="" tabindex="1" class="form-text required" /&gt;
      &lt;input type="hidden" name="pass" size="20" value="password" /&gt;
      &lt;input type="hidden" name="form_id" value="user_login" /&gt;
      &lt;br&gt;
      &lt;input type="submit" align="middle" name="op" class="form-submit" id="edit-submit" tabindex="2" value="Log in" src="/&lt;?php print path_to_theme() ?&gt;/images/login.gif" alt="Submit" /&gt;
&lt;/form&gt;


My client asked me to override the login for users without authentication (ultimately allowing anonymous users to login and see what authorized users see). The other requirement is that authorized users with their unique ID must still be able to use the login box and get redirected appropriately.

I have been able to create a way to automatically login using 00407606 (a special functional generic ID) in the value=field and if I change the text field to hidden a user can click the submit button and be logged in automatically and redirected appropriately. But applying this removes the ability for registered users to input their unique ID and login normally.
This login is not the username-password of Drupal, it is a unique 8 digit number in a created table in the database.

Is there a php solution to do this? Is there some code in logintobbogan I could mimic/use? Am I looking for a javascript solution?
Hey if you have any idea about drupal form alter then go with http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_form_alter/6.  

hope this will help you.