Very basic, and doesn't do anything yet, apart from connecting, and joining a channel.
<?php
/*
Jbot Created by Jalkson
Special thanks to:
Jim @ combined-minds.net
ahref @ rmrk.net
wingard @ fireandraingfx.co.nr
*/
//disable the time limit
set_time_limit(0);
//allows you to close the browser, yet doesn't close the bot
ignore_user_abort(TRUE);
//Define your config variables
$config = parse_ini_file("conf.ini");
$serv = $config['serv'];
$port = $config['port'];
$name = $config['name'];
$nick = $config['nick'];
$host = $config['host'];
$chan = $config['chan'];
$pass = $config['pass'];
$p = $config['prefix'];
//Define and establishing a connection
$server = fsockopen($serv,$port);
//Telling the server your name/nick
fputs($server,"USER ".$name. "\n");
fputs($server,"NICK ".$nick. "\n");
//Identifying your name
usleep(10000);
fputs($server,"MSG nickserv IDENTIFY ".$pass. "\n");
//Joining chosen channel
fputs($server,"JOIN ".$chan. "\n");
//Starting the loop **
while(1) {
//Setting the allotted data usage.
while($data = fgets($server, 128)) {
echo nl2br($data);
flush();
//Explode the data
$ex = explode(' ', $data);
//Replying to PING
if($ex[0] == "PING"){
fputs($server,"PONG ".$ex[1]."\n");
}
//Stores Hostname, and Username in variables
preg_match('/^:(.*?)!(.*?)$/i', $ex[0], $matches);
$hostname = "!".$matches[2];
$username = $matches[1];
//Setting the command line
$command = str_replace(array(chr(10), chr(13)), '', $ex[3]);
/*Bot commands From here down*/
#fputs($socket, "MODE ".$ex[2]." +v ".$ex[4]);
//Autogreet
$channel = str_replace(array(chr(10), chr(13)), '', $ex[2]);
$channel = substr($channel, 1);
if($ex[1] == "JOIN ") {
fputs($server,"PRIVMSG ".$ex[2]." :Hello ".$username.", welcome to ".$channel."! \n");
}
//kill command
if($username == "Jalkson" || "ahref") {
if($command == ":".$p."die") {
fputs($server,"QUIT :<3. \n");
die();
} else {
if($command == ":".$p."die") {
fputs($server,"PRIVMSG ".$ex[2]." :Sorry ".$username.", you lack access. \n");
}
}
}
//time command
$time = date("l, F j, Y g:i a");
if($command == ":".$p."time") {
fputs($server,"PRIVMSG ".$ex[2]." :".$time."\n");
}
/*join command
if($command == ":".$p."join") {
fputs($server,"JOIN ".$chan. "\n");
}
*/
//join specific channel
if ($ex[3] == ":".$p."join"){
if(isset($ex[4])){
fputs($server, "JOIN :".$ex[4]);
}
}
//Part command
if ($ex[3] == ":".$p."part"){
if(isset($ex[4])){
fputs($server, "PART :".$ex[4]);
}
}
//Kick command
if($username == "Jalkson" || "ahref") {
if($ex[3] == ":".$p."kick") {
if(isset($ex[4])){
fputs($server, "KICK #rmrevolution :".$ex[4]."\n");
}
}
}
//** This last } ends the loop. Keep everything else above it
}
}
?>
[config]
host = RmRevolution.com
serv = irc.acidchat.net
port = 6667
chan = #rmrevolution
name = Jbot RmRevolution.com Jbot :Jbot
nick = Jbot
pass =
prefix = @
:sauced.acidchat.net NOTICE AUTH :*** Looking up your hostname...
:sauced.acidchat.net NOTICE AUTH :*** Found your hostname (cached)
PING :D9A585C
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
:sauced.acidchat.net 451 PRIVMSG :You have not registered
:sauced.acidchat.net 451 JOIN :You have not registered
:sauced.acidchat.net 001 Jbot :Welcome to the Acidchat IRC Network Jbot!Jbot@adsl-67-122-209-225.dsl.snfc21.pacbell.net
:sauced.acidchat.net 002 Jbot :Your host is sauced.acidchat.net, running version Unreal3.2.6
:sauced.acidchat.net 003 Jbot :This server was created Sun Jun 17 2007 at 18:42:35 MDT
:sauced.acidchat.net 004 Jbot sauced.acidchat.net Unreal3.2.6 iowghraAsORTVSxNCWqBzvdHtGpZ lvhopsmntikrRcaqOALQbSeIKVfMCuzNTGj
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
:sauced.acidchat.net 005 Jbot CMDS=KNOCK,MAP,DCCALLOW,USERIP NAMESX SAFELIST HCN MAXCHANNELS=10 CHANLIMIT=#:10 MAXLIST=b:60,e:60,I:60 NICKLEN=30 CHANNELLEN=32 TOPICLEN=307 KICKLEN=307 AWAYLEN=307 MAXTARGETS=20 :are supported by this server
:sauced.acidchat.net 005 Jbot WALLCHOPS WATCH=128 SILENCE=15 MODES=12 CHANTYPES=# PREFIX=(qaohv)~&@%+ CHANMODES=beI,kfL,lj,psmntirRcOAQKVCuzNSMTG NETWORK=Acidchat CASEMAPPING=ascii EXTBAN=~,cqnr ELIST=MNUCT STATUSMSG=~&@%+ EXCEPTS :are supported by this server
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
:sauced.acidchat.net 005 Jbot INVEX :are supported by this server
:sauced.acidchat.net 251 Jbot :There are 19 users and 65 invisible on 3 servers
:sauced.acidchat.net 252 Jbot 18 :operator(s) online
:sauced.acidchat.net 254 Jbot 23 :channels formed
:sauced.acidchat.net 255 Jbot :I have 35 clients and 1 servers
:sauced.acidchat.net 265 Jbot :Current Local Users: 35 Max: 223
:sauced.acidchat.net 266 Jbot :Current Global Users: 84 Max: 473
:sauced.acidchat.net 375 Jbot :- sauced.acidchat.net Message of the Day -
:sauced.acidchat.net 372 Jbot :- 17/6/2007 18:44
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- _ _ _ ____ _ _
:sauced.acidchat.net 372 Jbot :- / \ ___(_) __| |/ ___| |__ __ _| |_
:sauced.acidchat.net 372 Jbot :- / _ \ / __| |/ _` | | | '_ \ / _` | __|
:sauced.acidchat.net 372 Jbot :- / ___ \ (__| | (_| | |___| | | | (_| | |_
:sauced.acidchat.net 372 Jbot :- /_/ \_\___|_|\__,_|\____|_| |_|\__,_|\__|
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Welcome to AcidChat IRC network
:sauced.acidchat.net 372 Jbot :- -------------------------------------------
:sauced.acidchat.net 372 Jbot :- you are on sauced.acidchat.net
:sauced.acidchat.net 372 Jbot :- talk to jent if you have any problems
:sauced.acidchat.net 372 Jbot :- -------------------------------------------
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Do not cause general problems.
:sauced.acidchat.net 372 Jbot :- Do not attend in any illegal activities.
:sauced.acidchat.net 372 Jbot :- Do not troll.
:sauced.acidchat.net 372 Jbot :- Always listen to the admin/opers.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Also respect others, if you dont like a
:sauced.acidchat.net 372 Jbot :- particular group or persons do not take
:sauced.acidchat.net 372 Jbot :- it upon yourself to "enlighten" them about
:sauced.acidchat.net 372 Jbot :- their faults and how your ways are better,
:sauced.acidchat.net 372 Jbot :- people are different, learn some social
:sauced.acidchat.net 372 Jbot :- skills and deal with it.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- ==================
:sauced.acidchat.net 372 Jbot :- Terms of use:
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Acidchat does not hold liability of content
:sauced.acidchat.net 372 Jbot :- on this network, it is your responsibility
:sauced.acidchat.net 372 Jbot :- to ignore any offensive topics, channels, etc.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- What users do in private is no concern of Acidchat.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Warez, spambots, floodbots, trojan bots, etc
:sauced.acidchat.net 372 Jbot :- are strictly forbidden on this network.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Chatrooms affiliated with terrorism, child
:sauced.acidchat.net 372 Jbot :- pornography or hate related subjects are
:sauced.acidchat.net 372 Jbot :- forbidden and will be locked out and the
:sauced.acidchat.net 372 Jbot :- owners permanently G:lined, Those in question
:sauced.acidchat.net 372 Jbot :- will have their information recorded for
:sauced.acidchat.net 372 Jbot :- legal reasons.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Unauthorized web-based clients like cgi:IRC,
:sauced.acidchat.net 372 Jbot :- which allow abuse will be banned, due to CGI:IRC
:sauced.acidchat.net 372 Jbot :- using the same IP or hostname as the machine it
:sauced.acidchat.net 372 Jbot :- runs on for all clients. However, this doesnt
:sauced.acidchat.net 372 Jbot :- apply to properly set up local cgi:irc clients
:sauced.acidchat.net 372 Jbot :- (such as those hosted by acidchat.net and by proper,
:sauced.acidchat.net 372 Jbot :- those that will show the ip mask of each user.)
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Channels that share roms or mp3 files covered under
:sauced.acidchat.net 372 Jbot :- the RIAA will be shut down at once. As in the 3rd
:sauced.acidchat.net 372 Jbot :- line of the terms states: what users do in their
:sauced.acidchat.net 372 Jbot :- own personal messages is of no concern to Acidchat,
:sauced.acidchat.net 372 Jbot :- and are responsible for their own actions. ROMS
:sauced.acidchat.net 372 Jbot :- are illegal in most cases, unless they're homebrew.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Spamming, harassing, berating others, and joinflooding
:sauced.acidchat.net 372 Jbot :- channels are against the rules.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- We have the right to refuse service to anyone.
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- IRC opers are authorized to use action against mass spammers/advertisers
:sauced.acidchat.net 372 Jbot :-
:sauced.acidchat.net 372 Jbot :- Follow the terms and rules and you'll be fine.
:sauced.acidchat.net 372 Jbot :- ====================================================
:sauced.acidchat.net 376 Jbot :End of /MOTD command.
:Jbot MODE Jbot :+iwx
PING :sauced.acidchat.net
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
PING :sauced.acidchat.net
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
PING :sauced.acidchat.net
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
PING :sauced.acidchat.net
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
PING :sauced.acidchat.net
Notice: Undefined offset: 3 in c:\program files\easyphp1-8\www\jbot.php on line 50
:Jalkson!hithar@Acidchat-3C27DBE.dsl.pltn13.pacbell.net PRIVMSG jbot :@die