Seite 1 von 1

Eigene Fehlerseiten?

Verfasst: Mo 16 Jan, 2006 18:36
von Uwe
Hallo Timo,

kann das klappen?

Code: Alles auswählen

######################################################## 
## Mod Title:   phpBB 2.0 style HTTP error messages 
## Mod Version: 1.0.0 
## Author:       Matthijs van de Water < matthijs@vandewater.tk > 
## Description:  Output nice phpBB 2.0 style error message  
##               on a HTTP error. 
## 
## Installation Level:  Intermediate 
## Installation Time:   5-8 Minutes 
## Files To Edit:       3 
## Included Files:      None 
######################################################## 
## 
## Installation Notes: 
## 
## Create error.php as per instructions below. 
## Add lines to your language file(s) as per instrucions. 
## Create or add lines to your .htaccess file. 
######################################################## 

# 
#-----[ CREATE error.php IN phpBB ROOT ]------------------ 
# 
<?php 
define('IN_PHPBB', true); 

// Output phpBB 2.0 style HTTP error message 

$phpbb_root_path = "./"; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

if( empty($lang) ) 
{ 
   if( !empty($board_config['default_lang']) ) 
   { 
      include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx); 
   } 
   else 
   { 
      include($phpbb_root_path . 'language/lang_english/lang_main.'.$phpEx); 
   } 
} 

switch ($code) 
{ 
  case '401': 
  case '403': 
  case '404': 
  case '500': 
    $message = $lang[$code . '_Description']; 
    $message_title = $lang['Error'] . ": " . $lang[$code]; 
    break; 
  default: 
    $message = $lang['Unknown_error']; 
    break; 
} 

message_die(GENERAL_ERROR, $message, $message_title); 
?> 
# 
#-----[ SAVE error.php ]---------------------------------- 
# 

# 
#-----[ OPEN language/lang_YOURLANGUAGE/lang_main.php ]--- 
# 

# 
#-----[ ADD FOLLOWING LINES TO BOTTOM ]------------------- 
# 
$lang['Unknown_error'] = "Unknown Error"; 
$lang['404'] = "404 - Not Found"; 
$lang['404_Description'] = "The page you are trying to reach does not exist on this server.<br />You can browse the forum by following one of the links above.<br /><br />We apologise for the inconvenience."; 
$lang['401'] = "401 - Incorrect Password"; 
$lang['401_Description'] = "The username or password you supplied is not correct.<br />You can browse the forum by following one of the links above."; 
$lang['403'] = "403 - Access Denied"; 
$lang['403_Description'] = "You don't have the proper rights to view this page.<br />You can browse the forum by following one of the links above."; 
$lang['500'] = "500 - Internal Server Error"; 
$lang['500_Description'] = "An Internal Server Error occurred.<br />If reloading the page doens't help, please contact the system administrator."; 

# 
#-----[ SAVE lang_main.php ]-------------------------------- 
# 
  YOU CAN REPEAT THIS STEP FOR EVERY LANGUAGE IN USE. 

# 
#-----[ OPEN .htaccess IN phpBB ROOT ]---------------------- 
# 

# 
#-----[ ADD LINES ]----------------------------------------- 
# 
ErrorDocument 401 /PHPBB_PATH/error.php?code=401 
ErrorDocument 403 /PHPBB_PATH/error.php?code=403 
ErrorDocument 404 /PHPBB_PATH/error.php?code=404 
ErrorDocument 500 /PHPBB_PATH/error.php?code=500 

BE SURE TO REPLACE '/PHPBB_PATH/' WITH THE PATH PHPBB IS LOCATED 
ON YOUR SERVER (i.e. /phpBB/ for http://phpbb.sourceforge.net/phpBB2/) 

# 
#-----[ SAVE .htaccess ] ----------------------------------- 
# 

Verfasst: Di 17 Jan, 2006 21:01
von Timo
Hallo,

du wilst damit die Fehlermeldungen auf deutsch machen oder was hast du damit vor?
Warum soll es nicht funktionieren. Muss nur an den richtigen stellen eingebunden werden.

Gruß Timo

Verfasst: Di 17 Jan, 2006 22:11
von Uwe
klar, in .htaccess oder wie das heisst. Da müssen die Pfade angegeben werden. Das ist aber nicht mein Part oder?

Hat sowas Sinn?
Mann könnte dann nach der Fehleranzeige und etwas mehr Information automatisch auf die Hauptseite umleiten.
Wäre auf alle Fälle freundlicher, als die Standartmeldung vom System.

Gruß vom Urlauber