|
Posted by Mailing Lists on 10/16/02 11:12
hello
i'm a newcomer to this list, fairly experienced PHP programmer but coding
mostly for personal web sites or hobbies. I also run an irc chat network and am
curious as to if I can integrate php into it somehow. for example:
I want to have a webpage that can present a list of all connected users to my
irc network, or maybe a webpage to facilitate nickname registration/activation.
my idea is to somehow connect a randomly-nicknamed client to the server like
"PHP-19942333" or something, which would execute the commands. I fully
understand the irc protocol and have written a working irc client in VB.
i don't have experience enough to know if PHP has some sort of "event"
mechanism, for example, to be like on ircNamesList($names) { echo $names['1'];
} or something. (pseudo-code)
does anyone have an idea as to how this stuff could be done?
Here's a sort of pseudo-code of what I'd want, PHP-style but obviously most of
the functions are fake.
// Begin pseudo-code.
<?php
echo "Activating nickname...";
$php_nickname = "PHPInterface" // or have it generate a random number
irc_connect(192.168.1.1,6667,$php_nickname)
$nick_command = "REGISTER $_GET['nick'] $_GET['email'] $_GET['pass']";
irc_send_privmsg("NickServ",$nick_command);
// some way to hold processing until the response is received...
wait_for_response();
// or maybe a while loop, like while $success = "false"...
// after response, die
exit("Finished");
// parse response
on event irc_privmsg($nick,$msg) {
if ($nick == "NickServ") {
if ($msg == "Your nickname has been successfully registered.") {
echo "Registration succeeded!";
}
elseif ($msg == "Invalid syntax") {
echo "Error.";
}
irc_quit("PHP Script finished.");
}
?>
obviously I'd also have to dress that page up a lot more, adding HTML code and
such.
This would also need a lot of error-trapping. Like if IRC couldn't connect for
whatever reason, or if NickServ wasn't available, or who knows what.
Well that's basically what I'm after. IDEAS??..
Flint
Navigation:
[Reply to this message]
|