Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $name = 'Sarah'.rand(0,999);
- $pass = 'pass';
- $join = '#1';
- $prefix = '>';
- $server = "irc.squaddiversity.com";
- $port = 6667;
- $version = "v0.0.1";
- $master = ":cmd276!NoIdent@I.Have.No.Host";
- global $socket;
- set_time_limit(0);
- date_default_timezone_set('America/Los_Angeles');
- $socket = fsockopen($server,$port);
- $x = 1;
- #:irc.codealife.com 353 Machinedramon = #1 :@rapacity ~Alias +Brenden +XTV-Info %
- #Andrew[Away] %Google +Sneaky +_ashLeyrhodeS_ &Rose +Neo|Desktop +Brenden|iPod +L
- #iquid- +Sbot +tiger45 Machinedramon +Sy
- fputs($socket,"USER Sarah - - Sarah\n");
- fputs($socket,"NICK $name\n");
- sleep(10);
- fwrite($socket,"privmsg nickserv :identify $pass\n");
- sleep(10);
- fwrite($socket,"privmsg hostserv :on\n");
- sleep(10);
- fwrite($socket, "JOIN $join\n");
- while(1)
- {
- while ($data = fgets($socket, 254))
- {
- $ex = explode(' ', $data);
- // Send PONG back to the server
- if($ex[0] == "PING"){
- fputs($socket, "PONG :".$ex[1]."\n");
- }
- $user = explode('!', $ex[0]);
- $user = str_replace(":", "", $user);
- $user = $user[0];
- #echo nl2br($data);
- #echo $data;
- #echo time() . ' <' . $user . ':'. $ex[2] .'> '. exall(3);
- echo $ex[2].' <'.$ex[0].'> '.exall(3)."<br />";
- if (isset($ex[2]))
- $IRCChannel = $ex[2];
- // Command to shut down the bot with out ghosts.
- if ((strcasecmp($command,":sleep") == 0) && ($ex[0] == $master))
- {
- msg($IRCChannel,":--");
- fputs($socket,"QUIT :*sleeping*\n");
- die();
- }
- // Common CTCP requests.
- if (strcasecmp($command,":\001VERSION\001") == 0)
- {
- ctcp($user,"\001VERSION Machinedra $version (php)\001");
- }
- if (preg_match("/:\001TIME\001/i",$command))
- {
- ctcp($user,"\001TIME ".date("l F d H:i:s Y")."\001");
- }
- if (preg_match("/:\001PING/i",$command))
- {
- ctcp($user,"\001PING ".mktime()."\001");
- }
- flush();
- }
- unset($ex);
- unset($command);
- #sleep(2);
- }
- function ctcp($user,$ctcp)
- {
- global $socket;
- fputs($socket,"notice $user :".$ctcp."\n");
- }
- function msg($channel,$message)
- {
- global $socket;
- fputs($socket,"privmsg " . $channel . " :" . $message . " \n");
- }
- function not ($channel,$message)
- {
- global $socket;
- fputs($socket,"notice " . $channel . " :" . $message . " \n");
- }
- function act($channel,$message)
- {
- global $socket;
- fputs($socket,"privmsg " . $channel . " :\001ACTION" . $message . " \n");
- }
- function exall ($a)
- {
- global $ex;
- $return = '';
- while (isset($ex[$a]))
- {
- $return .= ' '.$ex[$a];
- ++$a;
- }
- return $return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement