enanobot.php
changeset 3 02e1c3f8f0ef
parent 2 c474904ed707
child 4 8f62a406d9d9
equal deleted inserted replaced
2:c474904ed707 3:02e1c3f8f0ef
    37   {
    37   {
    38     $q = mysql_query($sql, $mysql_conn);
    38     $q = mysql_query($sql, $mysql_conn);
    39     if ( !$q )
    39     if ( !$q )
    40     {
    40     {
    41       $m_e = mysql_error();
    41       $m_e = mysql_error();
    42       $m_et = true;
    42       if ( strpos($m_e, 'gone away') && !$m_et )
    43       if ( $m_e == 'MySQL server has gone away' && !$m_et )
       
    44       {
    43       {
    45         mysql_reconnect();
    44         mysql_reconnect();
    46         continue;
    45         continue;
    47       }
    46       }
       
    47       $m_et = true;
    48       $irc->close("MySQL query error: $m_e");
    48       $irc->close("MySQL query error: $m_e");
    49       exit(1);
    49       exit(1);
    50     }
    50     }
    51     break;
    51     break;
    52   }
    52   }
   190   $m_et = false;
   190   $m_et = false;
   191   $sql = false;
   191   $sql = false;
   192   switch($message['action'])
   192   switch($message['action'])
   193   {
   193   {
   194     case 'PRIVMSG':
   194     case 'PRIVMSG':
   195       $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES
   195       if ( substr($line_db, 0, 5) != '[off]' )
   196                 ( '$chan_db', '$day', '$nick_db', '$time', '$line_db' );";
   196       {
       
   197         $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES
       
   198                   ( '$chan_db', '$day', '$nick_db', '$time', '$line_db' );";
       
   199       }
   197       break;
   200       break;
   198     case 'JOIN':
   201     case 'JOIN':
   199       $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES
   202       $sql = "INSERT INTO irclog(channel, day, nick, timestamp, line) VALUES
   200                 ( '$chan_db', '$day', '', '$time', '$nick_db has joined $chan_db' );";
   203                 ( '$chan_db', '$day', '', '$time', '$nick_db has joined $chan_db' );";
   201       break;
   204       break;