From: Joe Presbrey Date: Thu, 1 Dec 2005 09:17:43 +0000 (+0000) Subject: errors are emailed in X-Git-Url: http://andersk.mit.edu/gitweb/sql-web.git/commitdiff_plain/6ba4f54cea66522716f68591005e6e2806b86713 errors are emailed in output buffering is enabled git-svn-id: svn://presbrey.mit.edu/sql/mitsql@89 a142d4bd-2cfb-0310-9673-cb33a7e74f58 --- diff --git a/error.php b/error.php new file mode 100755 index 0000000..6446c24 --- /dev/null +++ b/error.php @@ -0,0 +1,11 @@ + diff --git a/lib/errorhandler.lib.php b/lib/errorhandler.lib.php new file mode 100644 index 0000000..b7da5b1 --- /dev/null +++ b/lib/errorhandler.lib.php @@ -0,0 +1,101 @@ + 64) ? '...' : ''); + $args .= "\"$a\""; + break; + case 'array': + //$args .= 'Array('.count($a).')'; + $args .= print_r($a,1); + break; + case 'object': + $args .= 'Object('.get_class($a).')'; + break; + case 'resource': + $args .= 'Resource('.strstr($a, '#').')'; + break; + case 'boolean': + $args .= $a ? 'True' : 'False'; + break; + case 'NULL': + $args .= 'Null'; + break; + default: + $args .= 'Unknown'; + } + } + empty($bt['class']) && $bt['class'] = ''; + empty($bt['type']) && $bt['type'] = ''; + empty($bt['function']) && $bt['function'] = ''; + $output .= "\n"; + $output .= "file: {$bt['line']} - {$bt['file']}\n"; + $output .= "call: {$bt['class']}{$bt['type']}{$bt['function']}($args)\n"; + } + return $output; +} + +set_error_handler('ErrorHandler'); + +?> diff --git a/lib/mitsql.lib.php b/lib/mitsql.lib.php index c59a434..0e9620d 100755 --- a/lib/mitsql.lib.php +++ b/lib/mitsql.lib.php @@ -10,6 +10,7 @@ require_once('dbaccess.lib.php'); require_once('mitsql.cfg.php'); require_once('security.lib.php'); +require_once('errorhandler.lib.php'); require_once('display.lib.php'); diff --git a/lib/security.lib.php b/lib/security.lib.php index d345e61..5630ebb 100644 --- a/lib/security.lib.php +++ b/lib/security.lib.php @@ -87,7 +87,7 @@ class User { private $dblist; function User($userId) { $this->userId = $userId; - $sql = sprintf("SELECT User.UserId, Username, Password, Name, Email, UL, bEnabled, nBytesSoft, nBytesHard, nBytes, nDatabases, nDatabasesHard, IF(nBytes>nBytesHard,1,0) AS bOverQuota + $sql = sprintf("SELECT User.UserId, Username, Name, Email, UL, bEnabled, nBytesSoft, nBytesHard, nBytes, nDatabases, nDatabasesHard, IF(nBytes>nBytesHard,1,0) AS bOverQuota FROM User INNER JOIN UserQuota ON User.UserId = UserQuota.UserId INNER JOIN UserStat ON User.UserId = UserStat.UserId @@ -96,13 +96,12 @@ class User { $r = fetchRows(DBSelect($sql),'UserId'); $this->info = count($r)?array_shift($r):$r; $this->dblist = $this->getDBList(); -// $this->pass = base64_decode($this->info['Password']); } function refresh() { unset($this->dblist); $this->User($this->userId); /* - $sql = sprintf("SELECT UserId, Username, Password, Name, Email, UL, bEnabled + $sql = sprintf("SELECT UserId, Username, Name, Email, UL, bEnabled FROM User WHERE UserId = '%s'", mysql_escape_string($this->userId)); diff --git a/mitsql.cfg.php b/mitsql.cfg.php index ddac119..1c96be6 100755 --- a/mitsql.cfg.php +++ b/mitsql.cfg.php @@ -37,6 +37,7 @@ define('THIS_PAGE', $THIS_PAGE); set_time_limit(0); ignore_user_abort(1); import_request_variables('cgp', 'i_'); +!DEVEL && ini_set('display_errors', 0); DEVEL && ini_set('display_errors', 1); error_reporting(E_ALL); set_include_path(get_include_path() . PATH_SEPARATOR . $BASE_PATH . 'lib/' . PATH_SEPARATOR . $BASE_PATH); diff --git a/php.ini b/php.ini index 629e3f4..a55c8f3 100755 --- a/php.ini +++ b/php.ini @@ -1,4 +1,4 @@ -display_errors = 0 extension = mysql.so auto_append_file = "global.done.php" session.save_path = "/home/sql/tmp/" +output_buffering = 4096 diff --git a/tpl/error.php b/tpl/error.php new file mode 100755 index 0000000..9b73460 --- /dev/null +++ b/tpl/error.php @@ -0,0 +1,20 @@ + + +

Page Error

+ +

+The page you were trying to view experienced an error while loading. +An email reporting this error has been sent to the Support Team. +

+

+Please accept our apologies for this inconvenience. +

+

+Return Home. +

+ +