Thanks for the kind words.
To check the user type, use:
$User =& JFactory::getUser();
if ($User->gid == 24 || $User->gid == 25) {
// administrator
}
Admins have gid of 24 and Super Admins 25.
If you want to use an external database:
// your db specific settings
$options = array (
'driver' => 'mysql',
'host' => 'your-database-server.com',
'user' => 'user',
'password' => 'password',
'database' => 'database-name',
'prefix' => ''
);
// get a mysql class instance using Joomla DB Factory
$Db =& JDatabase::getInstance( $options );
If you want to use the Joomla database, there is already a connection to it. Retrieve it via:
$Db =& JFactory::getDBO();