考え直すことなく、実際にダウンロードして試してみました。 動作します!!!
そして30分後に次のことを書きました。
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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" ; }
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
- <? xml version = "1.0" encoding = "UTF-8" ? >
- < configdata >
- < debug > 0 </ debug >
- < db >
- < ホスト > localhost </ ホスト >
- < ユーザー名 >ルート</ ユーザー名 >
- < パスワード > dbpass </ パスワード >
- < dbname > icqbot </ dbname > </ db >
- < dbcharset > CP1251 </ dbcharset >
- < dbadapter > Pdo_Mysql </ dbadapter >
- < icq >
- < ログイン > UIN </ ログイン >
- < パスワード > パスワード </ パスワード >
- </ icq >
dump.sql
Copy Source | Copy HTML
- `messages`が存在しない場合のテーブルの作成(
- `id` int (11) NOT NULL auto_increment、
- `q`テキストNOT NULL 、
- `a`テキストNOT NULL 、
- ` from` varchar (16) NOT NULL 、
- 主キー ( `id`)、
- 全文キー `q`(` q`)
- )エンジン= MyISAM DEFAULT CHARSET = cp1251 AUTO_INCREMENT = 43;
- INSERT INTO `messages`(` id`、 `q`、` a`、 `from`) 値
- (1、 'default' 、 'あなたがロボットと話している瞬間。私のホストと話したい場合、Jabberサーバーの1つに登録する必要があります。彼はICQに表示されなくなります。 e、1を入力します。ホストのJabberアドレスを見つけるには、2プラスになる金額を書きます。ホストの住所を見つけるには、1〜7の数字をスペースなしで入力します。
- (2、 '1234567' 、 'My@mail.ri' 、 '' )、
- (3、 '7' 、 'My@jabber.ru' 、 '' )、
- (4、 '1' 、 '人気のあるJabberサーバーの1つ-jabber.ru http://www.jabber.ru/node/247-は、接続するための登録手順を記載したページのアドレスです。Jabberホストアドレスを見つけるには、 2つのプラス5はいくらになるでしょうか。 '、 ' ' )、
- (5、 'hello' 、 'hello)' 、 '' )、
- (6、 「お元気ですか」 、 「普通 」 )、 '' );
そして、ボットZendFrameworkでパパを入れることを忘れないでください
何もコメントしません すべてが非常に簡単です。
深刻なことをするタスクを設定せず、アドレスに送信するだけであることに注意してください(ただし、既に十分なダイアログをダイヤルし、ボットはデフォルトのメッセージをダンプせずに5〜10人の知人とメッセージを既に話していました)。 ボットはRTF形式のメッセージを処理しませんが、この機能はクラスに実装されています(終了できます)。 もちろん、個別のUINとの会話を個別のスレッドにねじ込むこともできました。 しかし、これは別の問題です。 主なアイデア)
この作成はすでに4日間のフライトです。 1日あたり1-2人がjabber連絡先リストに追加されます。
こんな奇跡が起こりました。