Changeset 2484
- Timestamp:
- Aug 23, 2008, 3:18:13 AM (16 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/common.inc.php
r2479 r2484 99 99 } 100 100 } 101 if ( !empty($_SERVER["PATH_INFO"]) ) 102 { 103 $_SERVER["PATH_INFO"] = addslashes($_SERVER["PATH_INFO"]); 104 } 101 105 102 106 // … … 139 143 140 144 // Database connection 141 mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) 142 or die ( "Could not connect to database server" ); 143 mysql_select_db( $cfgBase ) 144 or die ( "Could not connect to database" ); 145 @mysql_connect( $cfgHote, $cfgUser, $cfgPassword ) or my_error( 'mysql_connect', true ); 146 @mysql_select_db( $cfgBase ) or my_error( 'mysql_select_db', true ); 145 147 146 148 defined('PWG_CHARSET') and defined('DB_CHARSET') -
trunk/include/functions.inc.php
r2479 r2484 597 597 598 598 $start = get_moment(); 599 $result = mysql_query($query) or my_error($query."\n");599 ($result = mysql_query($query)) or my_error($query, $conf['die_on_sql_error']); 600 600 601 601 $time = get_moment() - $start; … … 906 906 // my_error returns (or send to standard output) the message concerning the 907 907 // error occured for the last mysql query. 908 function my_error($header) 909 { 910 global $conf; 911 912 $error = '<pre>'; 913 $error.= $header; 914 $error.= '[mysql error '.mysql_errno().'] '; 915 $error.= mysql_error(); 916 $error.= '</pre>'; 917 918 if ($conf['die_on_sql_error']) 919 { 920 die($error); 921 } 922 else 923 { 924 echo $error; 925 } 926 } 908 909 function my_error($header, $die) 910 { 911 $error = $header; 912 $error.= "\n[mysql error ".mysql_errno().'] '.mysql_error()."\n"; 913 914 if (function_exists('debug_backtrace')) 915 { 916 $bt = debug_backtrace(); 917 for ($i=0; $i<count($bt); $i++) 918 { 919 $error .= "#$i\t".@$bt[$i]['function']." ".@$bt[$i]['file']."(".@@$bt[$i]['line'].")\n"; 920 } 921 } 922 923 if ($die) 924 { 925 @set_status_header(500); 926 echo( str_repeat( ' ', 300)."\n"); //IE doesn't error output if below a size 927 } 928 echo("<pre>"); 929 trigger_error($error, $die ? E_USER_ERROR : E_USER_WARNING); 930 !$die || die($error); // just in case the handler didnt die 931 echo("</pre>"); 932 } 933 927 934 928 935 /**
Note: See TracChangeset
for help on using the changeset viewer.