Ah, but being dangerous is fun.
The best source to figure out how the styles work and how authentication works is ultimatebb.cgi itself.
The styles are pretty straightforward... pretty much everything from the old Styles.file is there, as well as the header/footer from UltBB.setup. The trick is that they're in a hash... Ted didn't use hashes much back in the 5 series - are you familiar with their use?
Inside the code, the vars_style files are never really touched manually - that's all delegated to the LoadStyleTemplate subroutine. Check out part of ultimatebb.cgi, around line 130, starting with "if(defined $templatefile) {"
verify_id is also straightforward.. pass it a username and password, and it will return the PDN, daysprune, user number, modq flag, PNTF pref, and avatar prefs for the user. You can then use the user number to open up the profile. Check out the code in the do_login block in ultimatebb.cgi, around line 340.
Do beware the verify_id will throw StandardHTML if the user authentication fails. If you need to just auth the user, then you'll need to do so manually.
Now, actually using these subs can be a real pain... you can't just include the library and call the functions, as there are certain globals that need to be present.
Off the top of my head, you'll need, in order:
vars_config, vars_display, vars_misc, vars_wordlets, vars_wordlets_err, ubb_lin, ubb_lib_filehandler, ubb_lib_filehandle, ubb_lib_files, ubb_lib_time....
Don't forget to initialize the filehandler! You'll probably also need to load public_common, or at least provide the subs it contains...
Check out the code around line 80 of ultimatebb.cgi to see how all this is done...
Overwhelmed yet?
Getting that redirect trick done might be a real pain... all the transitions are handled by sub Transition in public_common, but it can only take one URL as an argument. Hijacking it to be able to take additional URLs would probably be the best route.