I came across this site which contains a load of PHP templates to use. I wanted this IRC bot script so I downloaded it. I installed it properly to my web server but I just get a time out error. Detailed info below:
The PHP code:
Code:
<!-- This Script is from www.hawkee.com, found at www.phpfreecode.com-->
<?
function phpbot($server, $port, $user, $nick, $realname, $channel) {
$sockname = fsockopen($server, $port, $errno, $errstr) or exit("$errno $errstr");
$repeat = "0";
while ($sockread = fgets($sockname, 512)) {
$sockread = explode(" ", $sockread);
if (!$repeat) {
fputs($sockname, "USER $user x x :$realname\n");
fputs($sockname, "NICK $nick\n");
}
if ($sockread[0] == "PING") {
fputs($sockname, "PONG :$sockread[1]\n");
}
if ($sockread[1] == "001") {
fputs($sockname, "JOIN $channel\n");
}
if (fnmatch("43?", $sockread[1])) {
fputs($sockname, "NICK $nick".str_repeat(mt_rand(0, 9), 3)."\n");
}
$repeat++;
}
}
?>
<html>
<center>
<input type="button" onclick="<?=phpbot("irc.gtanet.com","6667","phpbot","phpbot","phpbot","#sanl");?>" value="Connect"/>
</center>
</html>
<br><font face="Tahoma"><a target="_blank" href="http://www.phpfreecode.com/"><span style="font-size: 8pt; text-decoration: none">PHP Free Code</span></a></font>
And the Error when going to page:
Code:
<input type="button" onclick="
Warning: fsockopen() [function.fsockopen]: unable to connect to irc.gtanet.com:6667 (Connection timed out) in /home/liquidga/public_html/development/callum/SANL/public_html/IRC.php on line 5
110 Connection timed out