📜 ⬆️ ⬇️

Just a couple of words about switching to Jabber or ICQ bot

I myself, as an adherent of free technologies, have long since gotten myself a jabber account, but it has been empty for a long time, because No one from the asechno contactist succumbed to the entreaties to switch to jabber. Here, in the light of recent problems with AOL and a few habratopics about XMPP clients and ways of poaching people to them, I got the idea to put it on my UIN bot. Let him know how to talk a little and send all the talkers in the right direction. Looking for the subject of conversation on the Internet, nothing worthwhile was found. But I came across a page with a set of classes in PHP that implement the minimal functionality of the ICQ protocol.
Without thinking twice, I downloaded and tried in practice. Works!!!
and after 30 minutes wrote the following:

icqbot.php
Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  1. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  2. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  3. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  4. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  5. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  6. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  7. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  8. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  9. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  10. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  11. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  12. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  13. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  14. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  15. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  16. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  17. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  18. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  19. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  20. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  21. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  22. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  23. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  24. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  25. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  26. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  27. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  28. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  29. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  30. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  31. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  32. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  33. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  34. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  35. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  36. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  37. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  38. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  39. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  40. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  41. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  42. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  43. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  44. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  45. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  46. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  47. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  48. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  49. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  50. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  51. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  52. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  53. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  54. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  55. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  56. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  57. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  58. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  59. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  60. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  61. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  62. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  63. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  64. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  65. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  66. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  67. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  68. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  69. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  70. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  71. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  72. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  73. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  74. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  75. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  76. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }
  77. Copy Source | Copy HTML #!/usr/bin/php <?php include ( 'icq.php' ); // zendloader require 'Zend/Loader.php' ; Zend_Loader::registerAutoload(); // $config = new Zend_Config_Xml( 'config.xml' ,NULL, true ); // $db = Zend_Db::factory( $config ->dbadapter, $config ->db->toarray()); $db ->query( 'SET CHARACTER SET "' . $config ->dbcharset. '"' ); // $icq = new WebIcqLite(); log_write( "ICQ Bot started" ); // if (! $icq ->connect( $config ->icq->login, $config ->icq->password)) { log_write( $icq ->error); exit (); } log_write( "Connected ok" ); while ( $icq ->is_connected()) { // $msg = $icq ->read_message(); if ( $msg ) { // if ( $msg [ 'message' ]== "icqbotoff" ) { $icq ->disconnect(); log_write( "Exit by admin's command." ); exit (); } log_write( " Message '" . $msg [ 'message' ]. "' from " . $msg [ 'from' ]); // $msg [ 'message' ] = str_replace( array ( '(' , ')' , '/' , ':' , '.' , ',' , '?' , '!' , '@' , '#' , '$' , '%' , '^' , '&' , '*' , '-' , '_' , '=' , '+' , '~' , '`' , ';' , '|' , '\\',' \ '' , '"' ), '' , $msg [ 'message' ]); // $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' ,trim( $msg [ 'message' ]))->where( 'LENGTH(a)>0' )->order( 'RAND()' )->query()->fetch(); if ( $ans ) { // log_write( " Message '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $db ->insert( 'messages' , array ( 'q' => $msg [ 'message' ], 'a' => '' , 'from' => $msg [ 'from' ])); $query = "SELECT *, MATCH q AGAINST ('" . $msg [ 'message' ]. "') as relev FROM messages WHERE LENGTH(a)>0 ORDER BY relev DESC LIMIT 1" ; $ans = $db ->query( $query )->fetch(); if ( $ans [ 'relev' ]> 0 ) { // log_write( "Message (fulltext search) '" . $ans [ 'a' ]. "' sent to " . $msg [ 'from' ]); } else { // . . $ans = $db ->select()->from( 'messages' )->where( 'q LIKE ?' , 'default' )->query()->fetch(); log_write( "Message 'DEFAULT' sent to " . $msg [ 'from' ]); } } $icq ->send_message( $msg [ 'from' ], $ans [ 'a' ]); // } // flush(); sleep( 1 ); } // log_write( "Disconnected by unknown reason." ); $icq ->disconnect(); //----------------------------------------------------------------------------------------// // // function log_write( $str ) { echo date( 'Ymd His' ,time()). " " . $str . "\n" ; }


config.xml
Copy Source | Copy HTML
  1. <? xml version = "1.0" encoding = "UTF-8" ? >
  2. < configdata >
  3. < debug > 0 </ debug >
  4. < db >
  5. < host > localhost </ host >
  6. < username > root </ username >
  7. < password > dbpass </ password >
  8. < dbname > icqbot </ dbname > </ db >
  9. < dbcharset > CP1251 </ dbcharset >
  10. < dbadapter > Pdo_Mysql </ dbadapter >
  11. < icq >
  12. < login > UIN </ login >
  13. < password > PASSWORD </ password >
  14. </ icq >

')
dump.sql
Copy Source | Copy HTML
  1. CREATE TABLE IF NOT EXISTS `messages` (
  2. `id` int (11) NOT NULL auto_increment,
  3. `q` text NOT NULL ,
  4. `a` text NOT NULL ,
  5. ` from` varchar (16) NOT NULL ,
  6. PRIMARY KEY (`id`),
  7. FULLTEXT KEY `q` (` q`)
  8. ) ENGINE = MyISAM DEFAULT CHARSET = cp1251 AUTO_INCREMENT = 43;
  9. INSERT INTO `messages` (` id`, `q`,` a`, `from`) VALUES
  10. (1, 'default' , 'At the moment you are talking with the robot. If you want to talk with my host, you need to register on one of the Jabber servers, because in ICQ it will no longer appear. To find out more about Jabber- e, enter 1. To find out the host’s Jabber address, write how much 2 will be. To find out the host’s postal address, enter the numbers from 1 to 7 without spaces. ', ' ' )
  11. (2, '1234567' , 'My@mail.ri' , '' ),
  12. (3, '7' , 'My@jabber.ru' , '' ),
  13. (4, '1' , 'One of the most popular Jabber servers - jabber.ru http://www.jabber.ru/node/247 is the address of the page with instructions for registering to connect to it. To find out the Jabber host address, write, how much will dvuhplus5. ', ' ' ),
  14. (5, 'hello' , 'Hello)' , '' ),
  15. (6, 'how are you' , 'normal') , '' );


And do not forget to put in a daddy with a bot ZendFramework

I will not comment on something, because everything is quite trivial.
I will only note that I did not set the task to do something serious, but only to send to the address (although I already typed enough dialogues and the bot with some friends already said in messages of 5-10 pieces without throwing out the default message). The bot does not work with messages in the RTF format, but this feature is implemented in the class (it can be completed). It was certainly possible to fasten the conversation with separate UINs into separate threads. But this is another matter. The main idea)
This creation is already 4 days in flight. People 1-2 people per day in the jabber contact list is added.
Here is such a miracle happened.

Source: https://habr.com/ru/post/53017/


All Articles