Drupal authentication for a non-Drupal script
You can wire up your script via a hook_menu, and instead of returning the output to render via Drupal, you can print it directly and exit at the bottom of the function.  The submission handler would do the same thing, but drupal_goto() at the end.

That said, this is a moderately bad idea for the long run.

A better solution would be to use Webforms.  Webforms are really easy to make, get stored in the database, and can be exported to Excel.  I wouldn't be surprised if there is webform hook available so you could do your filesystem thing, too.

Another option is to use the Forms API to make your form w/ your custom validation and submission handlers.