Changeset 105
- Timestamp:
- Aug 10, 2008, 10:45:34 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/www/chat/irc_bot.php
r98 r105 25 25 $this->Command('NICK '.$this->Nick); 26 26 //sleep($JoinWaitTime); 27 $this->Command('JOIN '.$ Channel);27 $this->Command('JOIN '.$this->Channel); 28 28 } 29 29 … … 71 71 } 72 72 73 $Commands = array(substr($Line, 0, strpos($Line, ':') + 1)); 74 $Line = substr($Line, strlen($Commands[0])); 75 $Commands[1] = substr($Line, 0, strpos($Line, ':') + 1); 76 $Commands[2] = substr($Line, strlen($Commands[1])); 77 //print_r($Commands); 78 73 79 // Log messages to database 74 80 if(strpos($Line, 'PRIVMSG') !== false) 75 81 { 76 $LineParts = explode(':', $Line); 77 $Text = $LineParts[2]; 78 $LineParts2 = explode(' ', $LineParts[1]); 82 $Text = addslashes($Commands[2]); 83 $LineParts2 = explode(' ', $Commands[1]); 79 84 $LineParts3 = explode('@', $LineParts2[0]); 80 $Host = $LineParts3[1];85 $Host = addslashes($LineParts3[1]); 81 86 $LineParts4 = explode('!', $LineParts3[0]); 82 $Nick = $LineParts4[0];87 $Nick = addslashes($LineParts4[0]); 83 88 $Database->insert('ChatHistory', array('Nick' => $Nick, 'Text' => $Text, 'Host' => $Host, 'Time' => 'NOW()', 'RoomName' => 'Všichni')); 84 89 } 85 90 86 $Commands = explode(':', $Line); 91 92 explode(':', $Line); 87 93 foreach($Commands as $Index => $Item) 88 94 $Commands[$Index] = trim($Item);
Note:
See TracChangeset
for help on using the changeset viewer.