nice PHP site!

Questions about programming languages and debugging
Post Reply
User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

nice PHP site!

Post by bad_brain »

I've been searching for a way to display the IRC users online on the site, and I've stumbled over this site:
http://www.phpclasses.org/

definitely worth to register there... :wink:

bubzuru
.net coder
.net coder
Posts: 700
Joined: 17 Apr 2007, 16:00
17
Contact:

Post by bubzuru »

this is an awesome site , thanx B_B :)

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

A way to show the people on IRC? Sounds like a project...

Edit: By the way, nice site!
¯\_(ツ)_/¯ It works on my machine...

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Well, here it is. It's still beta, and i plan to add a 'idle time' feature to it, so that people will know how long it's been since people have spoken in IRC. Here's a POC for you guys:

http://g70net.com/shop/irc.html

and the code, of course:

Code: Select all

<?PHP

set_time_limit(0);

$server = "irc.suck-oold.com";
$port = 6667;
$nick = "nbot";
$name = "gogeta70-bot";
$ft = TRUE;

$con = fsockopen($server, $port);

send("USER $name g70net.com g70net.com :$name");
send("NICK $nick");
send("OPER user pass");
send("JOIN #suck-o");
send("PRIVMSG #suck-o :I am Gogeta70's IRC Name Server bot. I don't do anything except act as a relay to tell people who is on.");

$keys = array("PART", "JOIN", "QUIT");

while(!feof($con))
{
$buffer = trim(fgets($con, 4096));
echo "[<--] $buffer\n";
if(substr($buffer, 0, 5) == "PING ")
  send("PONG :" . substr($buffer, 6));
  
$gkeys = explode(" ", $buffer);
@$gkeys = $gkeys[1];
if(in_array($gkeys, $keys) || $ft === TRUE)
{
$a = 0;
send("NAMES #suck-o");
while($a == 0)
{
$nicks = trim(fgets($con, 4096));
$tnicks = $nicks;
$tnicks = explode(" ", $tnicks);
if($tnicks[1] == "353")
{
$a = 6;
}
}
  //$drop = fgets($con, 4096);
  //unset($drop);
$nicks = explode("#suck-o :", $nicks);
$nicks = $nicks[1];
$nicks = str_replace(" ", ", ", $nicks);
$nicks = "<b>Current users on IRC:</b> $nicks";
$open = fopen("E:\\shop\\irc.html", "w");
fwrite($open, $nicks);
fclose($open);
$ft = FALSE;
}

}

function send($cmd)
{ global $con;
fputs($con, $cmd . "\r\n");
echo "[-->] $cmd\n";
}

?>
¯\_(ツ)_/¯ It works on my machine...

User avatar
n3rd
Staff Member
Staff Member
Posts: 1474
Joined: 15 Nov 2005, 17:00
18
Location: my own perfect world in ma head :)
Contact:

Post by n3rd »

Gogeta did you make Nbot?.

he is seriously anoying.

he keeps shouting names making my system alert me that I am being addressed. woke me up last night because I forgot to shut down my sound XD.
[img]http://img580.imageshack.us/img580/8009/userbar2k.png[/img]

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

Heh, nice. I've had that happen when i set my sound system to wake me up at a certain time, then someone logs into MSN...

Anyway, he doesn't shout names anymore, so i think it's safe to leave your speakers on :P
¯\_(ツ)_/¯ It works on my machine...

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

sweet gogeta, thanks! :D
I've found this one on the site and will give it a try: http://www.phpclasses.org/browse/package/1409.html

maybe you can tell me what you think about it.... :-k

Post Reply