Posts: 106
Threads: 6
Joined: Oct 2009
Hello SF
This script is created to be used for connecting to IRC clients using PHP on a linux system.
PHP Code: <? function phpbot($server, $port, $user, $nick, $realname, $channel) { $sockname = fsockopen($server, $port, $errno, $errstr) or exit("$errno $errstr"); $repeat = "0"; while ($sockread = fgets($sockname, 512)) { $sockread = explode(" ", $sockread); if (!$repeat) { fputs($sockname, "USER $user x x :$realname\n"); fputs($sockname, "NICK $nick\n"); } if ($sockread[0] == "PING") { fputs($sockname, "PONG :$sockread[1]\n"); } if ($sockread[1] == "001") { fputs($sockname, "JOIN $channel\n"); } if (fnmatch("43?", $sockread[1])) { fputs($sockname, "NICK $nick".str_repeat(mt_rand(0, 9), 3)."\n"); } $repeat++; } } ?> <html> <center> <input type="button" onclick="<?=phpbot("irc.kingskrown.com","6667","phpbot","phpbot","phpbot","#kingskrown");?>" value="Connect"/> </center> </html>
That's it Enjoy
Posts: 1,351
Threads: 111
Joined: Oct 2009
Reputation:
40
Hey man thanks I've been looking for ways to do this, this is helpful!
Did you write this?
Posts: 106
Threads: 6
Joined: Oct 2009
(10-13-2009, 02:29 AM)NinjaGeek Wrote: Hey man thanks I've been looking for ways to do this, this is helpful!
Thankyou Ninja
Posts: 91
Threads: 7
Joined: Oct 2009
Reputation:
9
10-13-2009, 06:12 PM
(This post was last modified: 10-13-2009, 06:13 PM by Spl3en.)
I'm posting what i'm using for windows for connecting IRC using php :
PHP Code: <html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css">html{background:#000;color:#0F0;font:Verdana, Geneva, sans-serif;font-size:12px;}</style> </head> <body> <?php //Configuration $nick = "Spl3enBot"; $user = "Spl3en"; $channel = "#whatever"; $server = "irc.server.net";
//Begin of the script $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_connect($socket, gethostbyname($server), 6667); $in = "NICK ".$nick."\r\n"; $in .= "USER ".$user." 8 * : ".$user."\r\n"; $in .= "USERHOST Userhost\r\n"; $in .= "JOIN :".$server."\r\n"; socket_write($socket, $in, strlen($in)); while ($out = socket_read($socket, 1024)){ if (preg_match("/PING/i",$out)) socket_write($socket,"PONG ",strlen("PONG ")); echo "<font color=blue>Socket_read = <i>".$out."</i></font><br>"; } socket_close($socket); ?> </body></html>
Hope it helps
Posts: 106
Threads: 6
Joined: Oct 2009
(10-13-2009, 06:12 PM)Spl3en Wrote: I'm posting what i'm using for windows for connecting IRC using php :
PHP Code: <html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css">html{background:#000;color:#0F0;font:Verdana, Geneva, sans-serif;font-size:12px;}</style> </head> <body> <?php //Configuration $nick = "Spl3enBot"; $user = "Spl3en"; $channel = "#whatever"; $server = "irc.server.net";
//Begin of the script $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $result = socket_connect($socket, gethostbyname($server), 6667); $in = "NICK ".$nick."\r\n"; $in .= "USER ".$user." 8 * : ".$user."\r\n"; $in .= "USERHOST Userhost\r\n"; $in .= "JOIN :".$server."\r\n"; socket_write($socket, $in, strlen($in)); while ($out = socket_read($socket, 1024)){ if (preg_match("/PING/i",$out)) socket_write($socket,"PONG ",strlen("PONG ")); echo "<font color=blue>Socket_read = <i>".$out."</i></font><br>"; } socket_close($socket); ?> </body></html>
Hope it helps
I think thats very good. Thanks spleen
Posts: 379
Threads: 34
Joined: Oct 2009
Reputation:
15
Posts: 106
Threads: 6
Joined: Oct 2009
(10-20-2009, 09:44 PM)iintens Wrote: Check out PHP-iRC
hmm , whats that, any link will be appreciated
Posts: 887
Threads: 33
Joined: Oct 2009
Reputation:
8
FREE PSN CARDS, XBOX LIVE, GAMES + MORE VIEW THREAD Here
Posts: 106
Threads: 6
Joined: Oct 2009
(10-23-2009, 10:23 AM)Codine Wrote: http://www.phpbots.org/
Thanks, I will take a leap to this.
Posts: 887
Threads: 33
Joined: Oct 2009
Reputation:
8
You're welcome, i think that's the site your looking for, if not then i'll have another look for you.
FREE PSN CARDS, XBOX LIVE, GAMES + MORE VIEW THREAD Here
|