PHP Classes

How Can PHP Handle Error 500 and Other HTTP Errors with the Package eXperience Error Pages: Implement personalized HTTP error handling pages

Recommend this page to a friend!
  Info   View files Example   View files View files (43)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-05-04 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
experience-errorpage 1.0Custom (specified...5HTTP, PHP 5, Global
Description 

Author

This package can implement personalized HTTP error-handling pages.

It provides an error-handling PHP script that can get the HTTP error code from a URL parameter and uses a template script to show a personalized message depending on the type of HTTP error.

The error handling script uses a configuration script to define details of processing the error like:

- The email address of an administrator to notify about errors

- The current site URL

- The path of a file to log error details

- A list of subject titles to display for the error names

- A list of HTTP error codes the error handling script should support

Picture of Luca Liscio
  Performance   Level  
Name: Luca Liscio <contact>
Classes: 5 packages by
Country: Italy Italy
Innovation award
Innovation award
Nominee: 2x

Example

<?php
   
   
/*
     * errore.php
     *
     * __ __ _
     * ___\ \/ /_ __ ___ _ __(_) ___ _ __ ___ ___
     * / _ \\ /| '_ \ / _ \ '__| |/ _ \ '_ \ / __/ _ \
     * | __// \| |_) | __/ | | | __/ | | | (_| __/
     * \___/_/\_\ .__/ \___|_| |_|\___|_| |_|\___\___|
     * |_| HZKnight free PHP Scripts
     *
     * lucliscio <lucliscio@h0model.org>, ITALY
     *
     * EroorPage ver.0.1.0
     *
     * -------------------------------------------------------------------------------------------
     * Lincense
     * -------------------------------------------------------------------------------------------
     * Copyright (C)2023 HZKnight
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Affero General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     * GNU Affero General Public License for more details.
     *
     * You should have received a copy of the GNU Affero General Public License
     * along with this program. If not, see <http://www.gnu.org/licenses/agpl-3.0.html>.
     * -------------------------------------------------------------------------------------------
     */

   
namespace Experience\ErrorPages;
   
    use
phpbrowscap\Browscap;
   
   
/**
     * Personalizzed server error pages
     *
     * @author lucliscio <lucliscio@h0model.org>
     * @version v0.1.0 2023/04/24 07:56:20
     * @copyright Copyright 2023 HZKnight
     * @copyright Copyright 2013 Luca Liscio
     * @license http://www.gnu.org/licenses/agpl-3.0.html GNU/AGPL3
     *
     * @package eXperience
     * @subpackage ErrorPages
     * @filesource
     */

   
require_once 'lib/logger/hzlogger.class.php';
    require_once
'config.inc.php';
    require_once
'lib/function.inc.php';
    require_once
'lib/Browscap.php';

   
$log[] = Core\HZLogger::getLogger('arturo');
   
$log[] = Core\HZLogger::getLogger("debora");

   
/* echo "<pre>";
    var_dump(Core\HZLogger::$_instace);
    echo "</pre>"; */
   
   
$bc = new Browscap('./temp/cache/');
   
$bc->doAutoUpdate = false;
   
   
$result = (array_key_exists('err', $_GET)) ? $_GET['err'] : "000";

    if (
$result != "400" && $result != "401" && $result != "403" && $result != "404" && $result != "500"){
       
$result="000";
    }

    require_once
'assets/template/error.tpl';

    if (
$log[$result] == 'Y') notifica("L",$result);

    if (
$email[$result] == 'Y') notifica("M",$result);

?>


Details

eXperience ErrorPages

Experience-ErrorPages Release Pre-release) Licence Issue Code Climate Open Source Love

Licences

  • Experience ErrorPages code ©2022 by HZKnight is licensed under AGPL 3.0
  • Experience ErrorPages User Guide and all related documentation ©2022 by HZKnight is licensed under CC BY 4.0

Descriprion

Personalizzed Web Server error pages


  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder image.settings (2 files)
Files folder imagedoc (14 files, 1 directory)
Files folder imagesrc (4 files, 3 directories)
Accessible without login Plain text file .project Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files  /  .settings  
File Role Description
  Accessible without login Plain text file org.eclipse.php.core.prefs Data Auxiliary data
  Accessible without login Plain text file org.eclipse.wst.co...ject.facet.core.xml Data Auxiliary data

  Files folder image Files  /  doc  
File Role Description
Files folder imageresources (11 files)
  Accessible without login HTML file 404.html Doc. Documentation
  Accessible without login HTML file class-Exception.html Doc. Documentation
  Accessible without login HTML file class-HZErrorPage.Browscap.html Doc. Documentation
  Accessible without login HTML file class-HZErrorPage.Exception.html Doc. Documentation
  Accessible without login Plain text file elementlist.js Data Auxiliary data
  Accessible without login HTML file function-notifica.html Doc. Documentation
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login HTML file namespace-HZErrorPage.html Doc. Documentation
  Accessible without login HTML file namespace-None.html Doc. Documentation
  Accessible without login HTML file namespace-PHP.html Doc. Documentation
  Accessible without login HTML file source-class-HZErrorPage.Browscap.html Doc. Documentation
  Accessible without login HTML file source-class-HZErrorPage.Exception.html Doc. Documentation
  Accessible without login HTML file source-function-notifica.html Doc. Documentation
  Accessible without login HTML file tree.html Doc. Documentation

  Files folder image Files  /  doc  /  resources  
File Role Description
  Accessible without login Image file collapsed.png Icon Icon image
  Accessible without login Plain text file combined.js Data Auxiliary data
  Accessible without login Image file footer.png Data Auxiliary data
  Accessible without login Image file inherit.png Icon Icon image
  Accessible without login Image file resize.png Icon Icon image
  Accessible without login Image file sort.png Icon Icon image
  Accessible without login Plain text file style.css Data Auxiliary data
  Accessible without login Image file tree-cleaner.png Icon Icon image
  Accessible without login Image file tree-hasnext.png Icon Icon image
  Accessible without login Image file tree-last.png Data Auxiliary data
  Accessible without login Image file tree-vertical.png Icon Icon image

  Files folder image Files  /  src  
File Role Description
Files folder imageassets (2 directories)
Files folder imagelib (2 files, 1 directory)
Files folder imagelog (1 file)
  Accessible without login Plain text file browscap_update.php Example Example script
  Accessible without login Plain text file config.inc.php Conf. Configuration script
  Accessible without login Plain text file errore.php Example Example script
  Accessible without login Plain text file not_found.php Aux. Auxiliary script

  Files folder image Files  /  src  /  assets  
File Role Description
Files folder imageimages (3 files)
Files folder imagetemplate (1 file)

  Files folder image Files  /  src  /  assets  /  images  
File Role Description
  Accessible without login Image file error.png Icon Icon image
  Accessible without login Image file home.png Icon Icon image
  Accessible without login Image file logo.png Icon Icon image

  Files folder image Files  /  src  /  assets  /  template  
File Role Description
  Accessible without login Plain text file error.tpl Aux. Auxiliary script

  Files folder image Files  /  src  /  lib  
File Role Description
Files folder imagelogger (1 file)
  Plain text file Browscap.php Class Class source
  Accessible without login Plain text file function.inc.php Example Example script

  Files folder image Files  /  src  /  lib  /  logger  
File Role Description
  Plain text file hzlogger.class.php Class Class source

  Files folder image Files  /  src  /  log  
File Role Description
  Accessible without login Plain text file errore.log Data Auxiliary data

 Version Control Unique User Downloads  
 100%
Total:0
This week:0