Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1>PhP Bot</h1>
- <?php
- // Prevent PHP from stopping the script after 30 sec
- set_time_limit(0);
- // Edit these settings
- $chan = "#afterhours";
- $server = "irc.phreik.net";
- $port = 6667;
- $nick = "PHP_Bot";
- $account = "0000070050 340c6b464ed5e1ce555a236f102795a6 PY";
- // STOP EDITTING NOW.
- $socket = fsockopen("$server", $port);
- fputs($socket,"USER $nick $nick $nick $nick :$nick\n");
- fputs($socket,"NICK $nick\n");
- fputs($socket,"Account $account\n");
- fputs($socket,"JOIN ".$chan."\n");
- while(1) {
- while($data = fgets($socket)) {
- echo nl2br($data);
- flush();
- $ex = explode(' ', $data);
- $rawcmd = explode(':', $ex[3]);
- $oneword = explode('<br>', $rawcmd);
- $channel = $ex[2];
- $nicka = explode('@', $ex[0]);
- $nickb = explode('!', $nicka[0]);
- $nickc = explode(':', $nickb[0]);
- $host = $nicka[1];
- $nick = $nickc[1];
- if($ex[0] == "PING"){
- fputs($socket, "PONG ".$ex[1]."\n");
- }
- $args = NULL; for ($i = 4; $i < count($ex); $i++) { $args .= $ex[$i] . ' '; }
- echo $args ;
- if ($rawcmd[1] == "!sayit") {
- fputs($socket, "PRIVMSG ".$channel." :".$args." \n");
- }
- elseif ($rawcmd[1] == "!md5") {
- fputs($socket, "PRIVMSG ".$channel." :MD5 ".md5('$args')."\n");
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement