Hi Craig,
Just something to try: change the variable '$database_stonepits1' back to '$database_powergallery', i.e:
<?php
require_once(realpath($abs_prefix . '../') . '/Connections/powergallery.php');
mysql_select_db($database_stonepits1);
To:
<?php
require_once(realpath($abs_prefix . '../') . '/Connections/powergallery.php');
mysql_select_db($database_powergallery);