1. GSManager
    1. Funktionen
    2. Unterstützte Spiele
    3. Neuigkeiten
    4. Statistiken
    5. Serverliste
  2. Lexikon
  3. Filebase
  4. Entwicklung
  5. Forum
    1. Dashboard
    2. Unerledigte Themen
  6. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  • Anmelden
  • Registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Seiten
  • Dateien
  • Forum
  • Lexikon
  • Erweiterte Suche
  1. GSManager
  2. Forum
  3. Allgemeines
  4. Fehler

Unusual error in Chatlog plugin

  • Azad69
  • 20. Mai 2014 um 08:25
Das Projekt GSManager (vormals ManuAdminMod) wurde am 01.01.2020 eingestellt - diese Internetpräsenz bleibt verfügbar, die Software wird aber nicht länger gepflegt. Vielen Dank für eure Unterstützung in den mehr als zehn vergangenen Jahren!
  • Azad69
    Fortgeschrittener
    Reaktionen
    13
    Punkte
    1.428
    Trophäen
    2
    Beiträge
    248
    • 20. Mai 2014 um 08:25
    • #1

    Using this chatlog plugin. Its 100% working and it saves all chat in adminmod/chat.log..but in the mam mod.log file this error shows every time a player chats

    PHP-Error: Notice in :\adminmod\plugins\chatlog.php:61 => Undefined variable: logdir

    The line 61 in the chatlog.php in my pc is $chatlog_fp = fopen($logdir . $mod->getCV("chatlog", "logname"), "a");

    The plugin is working great but still why this error keep showing when someone chats ? or is it just normal...and ignore it? :confused:

    Thanks all :smile:

    Spoiler anzeigen
    PHP
    <?php
    /*
    ===============
    PLUGIN: chatlog
    ===============
    Logging the Chat of the Server.
    
    
    
    
    [chatlog] 
    enabled = 1    ; Enable/Disable the Plugin
    dateformat = "d.m.y H:i:s" ; Decide which Date/Time Format you wanna use.
    saveas = "text" ; Decide save in Mysql or as Text File
    logname = "chat.log" ; decide which log name you wanna use
    host = "" ; Mysql Hostname e.g. localhost
    user = "" ; Mysql User
    password = "" ; Mysql password
    database = "" ; Mysql database
    prefix = "mam_" ; mysql prefix
    
    
    
    
    @author manu
    @modify voices
    @license Creative Commons BY-NC-SA 3.0 (http://www.creativecommons.org/licenses/by-nc-sa/3.0/)
    @version 1.0
    */
    
    
    
    
    //Set Default CV
    $mod->setDefaultCV("chatlog", "enabled", "0");
    $mod->setDefaultCV("chatlog", "dateformat", "d.m.y H:i:s");
    $mod->setDefaultCV("chatlog", "saveas", "text");
    $mod->setDefaultCV("chatlog", "logname", "chat.log");
    $mod->setDefaultCV("chatlog", "host", "localhost");
    $mod->setDefaultCV("chatlog", "user", "adminmod");
    $mod->setDefaultCV("chatlog", "password", "verysecure");
    $mod->setDefaultCV("chatlog", "database", "mam");
    $mod->setDefaultCV("chatlog", "prefix", "mam_");
    
    
    
    
    try {
        switch (strtolower($mod->getCV("chatlog", "saveas"))) {
            case "mysql":
                $mod->registerEvent("playerSay", "chatlog_mysql");
               break;
            default:
                $mod->registerEvent("playerSay", "chatlog_text");
                break;
       }
    }
    catch (Exception $e) {
        $logging->write(MOD_ERROR, "Chatlog: " . $e->getMessage());
    }
    
    
    
    
    //Function Chatlog as *log File
    function chatlog_text($param) {
        list($guid, $text) = $param;
        global $players;
        global $mod;
    
    
    
    
        if(!$mod->getCV("chatlog", "enabled")) {
            return;
        }
    
        $chatlog_fp = fopen($logdir . $mod->getCV("chatlog", "logname"), "a");
        $timestamp = date($mod->getCV("chatlog", "dateformat"));
        $name = $players[$guid]->getName();
        $text = $mod->removecolor($text);
    
    
    
    
        fwrite($chatlog_fp, "$timestamp $name: $text\r\n");
    }
    
    
    
    
    //Function Chatlog in Mysql Database
    function chatlog_mysql($param) {
        list($guid, $text) = $param;
        global $players;
        global $mod;
    
    
    
    
        if(!$mod->getCV("chatlog", "enabled")) {
            return;
        }
    
        $timestamp = date($mod->getCV("chatlog", "dateformat"));
        $name = $players[$guid]->getName();
        $text = $mod->removecolor($text);
    
    
    
    
        $dblog = mysql_connect($mod->getCV("chatlog", "host"),$mod->getCV("chatlog", "user"),$mod->getCV("chatlog", "password"))or die("Fehler");
        mysql_select_db($mod->getCV("chatlog", "database"));
        echo mysql_error();
        $sql = "INSERT INTO " . $mod->getCV("chatlog", "prefix") . "chatlog (time, name, text) VALUES ('$timestamp','$name','$text')";
        mysql_query($sql);
        echo mysql_error();
        mysql_close($dblog);    
    }
    ?>
    Alles anzeigen
  • Voices
    Fortgeschrittener
    Reaktionen
    17
    Punkte
    1.742
    Trophäen
    2
    Beiträge
    331
    • 20. Mai 2014 um 08:38
    • #2

    use LOGDIR instead of $logdir problem solved.

    Anyway this is a really old and Dirty version :D

    SQL Injection is possible.

  • Azad69
    Fortgeschrittener
    Reaktionen
    13
    Punkte
    1.428
    Trophäen
    2
    Beiträge
    248
    • 20. Mai 2014 um 08:41
    • #3
    Zitat von Voices

    really old and Dirty version


    Is there new version of chatlog plugin?

  • Dieses Thema enthält 6 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.
  1. Mitarbeiter
  2. Datenschutzerklärung
  3. Nutzungsbedingungen
  4. Impressum
  5. Kontakt
Community-Software: WoltLab Suite™