This post show you how you can migrate data from a Drupal 5 database to a Drupal 7. It might be some easier ways using some modules for export and import, but this is how you can make it the programmatically way. This is NOT a ready to go script this is more or less a copy of a script I just made, you have to code a bit to make it work.
If you have to create a new password for your admin user in a Drupal 7 database you can't use md5() as before, you have to implement a little script that print it out.
//add in index.php after drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);