Esempio n. 1
0
				file_put_contents($lPasswordFilePath,$lAccountsText);
				echo format("Wrote accounts to ".$lPasswordFilePath,"S");
			}else{
				throw new Exception("Oh snap. Trying to create an text version of the accounts file did not work out.");
			}//end if
		}catch(Exception $e){
			echo format("Could not write accounts XML to ".$lPasswordFilePath." - ".$e->getMessage(),"W");
			echo format("Using default version of accounts.txt","W");			
		};// end try
		
	} else {
		$lErrorDetected = TRUE;
		echo format("Warning: No records found when trying to build XML and text version of accounts table ".$lQueryResult,"W");
	}// end if ($lResultsFound)	
			
	$MySQLHandler->closeDatabaseConnection();

} catch (Exception $e) {
	$lErrorDetected = TRUE;
	echo $CustomErrorHandler->FormatError($e, $lQueryString);
}// end try

// if no errors were detected, send the user back to the page that requested the database be reset.
//We use JS instead of HTTP Location header so that HTML5 clearing JS above will run
if(!$lErrorDetected){
	/*If the user came from the database error page but we do not have 
	 * database errors anymore, send them to the home page.
	 */	
	$lReferredFromDBOfflinePage = preg_match("/database-offline.php/", $_SERVER["HTTP_REFERER"]);
	$lReferredFromPageWithURLParameters = preg_match("/\?/", $_SERVER["HTTP_REFERER"]);