AGB     Downloads     Impresum    Sitemap   
      
Keine Mobilversion verfügbar; Nur Desktopversion!

Logfile Klasse

Logfile in OOP ab PHP 5.6 bis PHP 5.x

 

OOP (Obejekt-Orienmtierte-Programmierung) ohne Basiswissen nicht möglich!

Nur in Verbindung mit der MYSQLi Klasse

 

Beispiel

 

 

LogFileSpeichern.class.php - einfach makieren und kopieren
  1. <?php
  2. /*
  3. ------------------------------------------------------------------------------------------------------------------------------------------
  4. script name:      LogFileSpeichern.class.php
  5. script autor:     Johann Glechner GJweb e.U.
  6. aenderung von:    Johann Glechner
  7. erstellt am:      16.05.2012
  8. geaendert am:     23.09.2015
  9. letzte aenderung:
  10. 23.09.2015  umbau auf MYSQLi
  11. ------------------------------------------------------------------------------------------------------------------------------------------
  12. script-history:
  13. loggfile_speichern_ueber_mysqli_klasse
  14.   logfile_variablen
  15.   logfile_functionen
  16.     construct_uebergabe_der_daten_und_mysqli_construct_anstossen
  17.     speichern_des_log_in_die_datenbank
  18. ------------------------------------------------------------------------------------------------------------------------------------------
  19. datenban anlegen:
  20.  
  21. CREATE TABLE IF NOT EXISTS `db_1_Edit_Logs` (
  22.   `Id` bigint(20) NOT NULL,
  23.   `cmdName` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  24.   `editUser` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  25.   `editIP` varchar(45) COLLATE utf8_unicode_ci NOT NULL,
  26.   `editInfo` longtext COLLATE utf8_unicode_ci NOT NULL,
  27.   `editZeit` varchar(25) COLLATE utf8_unicode_ci NOT NULL,
  28.   `time` int(15) NOT NULL
  29. ) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  30. ------------------------------------------------------------------------------------------------------------------------------------------
  31. script-klasse einbauen:
  32.  
  33. $LogfileInformation = 'INFOS UEBER DAS EREIGNISS';
  34. $EditSeitenId = ID DER SEITE ANGEBEN;
  35. $LogFileSichern = new LogFileSpeichern($EditSeitenId, $editUser, $_SERVER["REMOTE_ADDR"], time(), $LogfileInformation);
  36. ------------------------------------------------------------------------------------------------------------------------------------------
  37. */
  38.  
  39. /* loggfile_speichern_ueber_mysqli_klasse ANFANG */
  40. class LogFileSpeichern extends AbfrageSQL
  41. {
  42.   /* logfile_variablen ANFANG */
  43.   public  $editseite          = '';
  44.   public  $userName           = '';
  45.   public  $editip             = '';
  46.   public  $LogfileInformation = '';
  47.   public  $editzeit           = '';
  48.   public  $edituserzeit       = '';
  49.   /* logfile_variablen ENDE */
  50. /* ------------------------------------------------------------------------------------------------------------------------------------------ */
  51.   /* logfile_functionen ANFANG */
  52.     /* construct_uebergabe_der_daten_und_mysqli_construct_anstossen ANFANG */
  53.     public function __construct($editseite, $userName, $editip, $edituserzeit, $LogfileInformation)
  54.     {
  55.     parent::__construct ($this->db_host,$this->db_user,$this->db_pass,$this->db_data);
  56.  
  57.     $this->editseite = $editseite;
  58.     $this->userName = $userName;
  59.     $this->editip = $editip;
  60.     $this->edituserzeit = $edituserzeit;
  61.     $this->editzeit = date("d.m.Y - H:i:s", $this->edituserzeit);
  62.     $this->LogfileInformation = $LogfileInformation;
  63.     $this->LogFileSpeichernDatenbank();
  64.     }
  65.     /* construct_uebergabe_der_daten_und_mysqli_construct_anstossen ENDE */
  66. /* ------------------------------------------------------------------------------------------------------------------------------------------ */
  67.     /* speichern_des_log_in_die_datenbank ANFANG */
  68.     function LogFileSpeichernDatenbank()
  69.     {
  70.     return $this->checkQuery("INSERT INTO ".$this->db_link."_Edit_Logs (cmdName, editUser, editIP, logfileInformation, editZeit, time) VALUES
  71.     ('$this->editseite', '$this->userName', '$this->editip', '$this->LogfileInformation', '$this->editzeit', '$this->edituserzeit')");
  72.     }
  73.     /* speichern_des_log_in_die_datenbank ENDE */
  74. /* ------------------------------------------------------------------------------------------------------------------------------------------ */
  75.   /* logfile_functionen ENDE */
  76. }
  77. /* loggfile_speichern_ueber_mysqli_klasse ENDE */
  78. ?>
powered by GJweb e.U.

  


 

 

 

 

GJweb News
GJweb Angebote
GJweb QR-Code Generator
GJweb Referenzen
GJweb r-CMS gjOps
Domain suche
GJweb Downloads
GJweb Statistiken
GJweb - Google PageSpeed