Loading ...
Sorry, an error occurred while loading the content.

Re: [php_greek] error handling

Expand Messages
  • Symeon Charalabides
    ... Stelno to function pou hrisimopoio sta dika mou script. To egrapsa monos mou, einai aplo kai minimalistiko kai stelnei OLES tis diathesimes plirofories kai
    Message 1 of 2 , Feb 26, 2004
    • 0 Attachment
      > Kalispera kserete mipos pou mporo na bro mia error handling function gia na mou
      > stelnei email me ta lathi? Kalo tha itan na mporei na eisaxthei me ti morfi
      > require mesa ston kodika mou. Eyxaristo YG:Elpizo na eina eykola parametropoisimi
      >
      Stelno to function pou hrisimopoio sta dika mou script. To egrapsa monos mou,
      einai aplo kai minimalistiko kai stelnei OLES tis diathesimes plirofories kai to
      email borei na einai poly makry, idiaitera an eheis dilosei polles metavlites. An
      theleis ligoteres, tote einai pou prepei na grapseis perissotero kodika.

      I vasiki parametros, fysika, einai to error_reporting level (oi dyo grammes ektos
      tou function). Ego to eho sto 2039 (ta panta ektos apo warnings), an theleis na
      to allaxeis, koita sto PHP manual gia to sosto noumero gia sena.

      Genika, arkei na kaneis include i require ta parakato function syn tis dyo
      grammes apo kato tou sta script pou treheis - esy xereis pos kai apo pou.
      Enjoy:
      __________begin_code_here___________



      function ouch($er_typ,$er_msg,$er_fil,$er_lin,$er_con) {
      if ($er_typ!=8) {
      global $website_name, $administrator_email;
      foreach ($er_con as $key=>$value) {
      if (is_array($value)) {
      $temp=$value;
      $value='';
      foreach ($temp as $temp1=>$temp2)
      $value.="\n\t".$temp1.' => '.$temp2;
      }
      $context.="\n".$key.': '.$value;
      }
      mail($administrator_email, $website_name.' Script error',
      'Grave news upon us, sire:

      on the day of our lord '.date('d/m/Y').', an error occured
      in the '.$website_name.' domain. All I can tell is the following:

      ----------------------------------------------------------------
      Type: '.$er_typ.'

      Message: '.$er_msg.'

      File: '.$er_fil.'

      Line: '.$er_lin.'

      Context: '.$context.'

      ----------------------------------------------------------------

      That is all, my lord. I shall return whence I am summoned again.
      I bid you farewell and Cat bless.

      Bozorc the orc
      (don\'t kill the messenger)',
      "From: \"Bozorc the orc\"\r\n");
      }
      }

      set_error_handler("ouch");
      error_reporting(2039);




      __________end_code_here___________

      Symeon Charalabides (cosmopolite trainee)
      -------------------------------------------------
      http://www.systasis.com
    Your message has been successfully submitted and would be delivered to recipients shortly.