View Single Post
  #1  
Old 14th October 2009, 16:47
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default Error function explained
To generate a basic error report you can use 1 of 3 PMBT error functions
first is the btsqlerror which is the Mysql error
PHP Code:
btsqlerror($sql ''
where $sql is the query
example
PHP Code:
        $sql "SELECT id FROM ".$db_prefix."_users WHERE id = '".$user->id."' AND username = '".$user->name."' AND act_key = '".addslashes($userdata[3])."' AND password = '".addslashes($userdata[2])."';"
this well return a fatal error causing the script to come to a complete stop
and display a error block reporting the query the error code and Mysql message for this error
to use this
PHP Code:
                        $sql "SELECT avatar FROM ".$db_prefix."_users WHERE id = '".$uid."';";
                        
$res $db->sql_query($sql)or btsqlerror($sql); 
the Second is the display error bterror
PHP Code:
bterror($error$title _btgenerror$fatal true
$error is the body of the error block and is a required field
$tittle is the header of the error block this field is not required
$fatal tells the script if it should come to a complete stop or just carry on after display By default it is fatal and well stop the script.
example Fatal Error
PHP Code:
bterror("Error","you have a fatal error"); 
Example Non Fatal error
PHP Code:
bterror("Error","you have a nonfatal error",false); 
the last is error log
PHP Code:
logerror($message$error _btgenerror
this well write a log error in the data base of the error for site admin to view
in the admin logs
$message is the main error and is required
$error is the title of the error and is not required
this well add to the data base a row for error type error body user IP the created the error and a time stamp
Example
PHP Code:
logerror('User login failed for '.$username'Failed Login'); 
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote