phpBMS

For the End User:

The system log displays any trapped errors that have occurred during the regular use of the phpBMS system. Your in-house technical support should be contacted to investigate any errors that show in the system log. Technical support should review the logs frequently to determine if there are any error that need to be corrected.

Log Fields:

ID of the error - The Auto Incremented ID from the MySQL database

Date/Time of error - The date and time when the error occured

Type of error - Currently, the only defined error is "Database Error", however provision for more error codes is in place. Error codes are numbered -400, -410, -420, -430, -440, -450, -460 (Database error)

Value - The resulting error text, as in the case below, "Could not connect to database server." + plus the exact query

User - Which User ID is associated with the error

IP Address - The IP address of the client computer

For the programmer:

The phpBMS system log traps and records errors thrown in the program code. The class, "phpbmsLog" is located in include/session.php and simply writes to the log. The class "appError", also located in /include/session.php, is responsible for sorting out what to do with certain errors. (Not fully implemented though).

As an Example... The class "db", located in /include/db.php, is written to override the default MySQL errors thrown when something goes wrong with a query.

In the following code, we see that the connect() method overrides the standard php error reporting (which may or may not be enabled depending on your installation) and instead throws a "pretty" error message:

function connect(){
	// This functions connects to the database.  It uses pconnect if the variable is set;
	if($this->pconnect)
	     $this->db_link = @ mysql_pconnect($this->hostname,$this->dbuser,$this->dbpass);
	else
		$this->db_link = @ mysql_connect($this->hostname,$this->dbuser,$this->dbpass);
	        	if(!$this->db_link){
				$error = new appError(-400,"Could not connect to database server.\n\n".mysql_error(),"",$this->showError,$this->stopOnError,false,$this->errorFormat);
				return false;
			} else			
				return $this->db_link;
	}
Copyright © 2010 Kreotek, LLC. All Rights reserved.