Finally we need a way to get the troublemaker’s IP in
the first place. I do this by logging
and
URL I can view the message and monitor the IP
addresses at the same time. This has the added
bonus of being able to spot impersonators – a
common crime in these places.
the first place. I do this by logging
$name
and
$REMOTE_ADDR
in a file callediplist.html
. At a separate, secretURL I can view the message and monitor the IP
addresses at the same time. This has the added
bonus of being able to spot impersonators – a
common crime in these places.
iplist.html
is created in much the sameway as
messages.html
. First we extractthe current values from
iplist.html
,we strip out the header, footer and oldest IP record
and then create a new record, new header and new
footer. To make the layout more clear, I used
a table.
<?php
$header
= "<html><body bgcolor="#000000" text="#ffffff"><table border="0">n";
$footer = "</table></body></html>";
$new_ip = "<tr><td>$name</td><td>$REMOTE_ADDR</td></tr>n";
$ip_array = file("iplist.html");
for ($counter = 1; $counter < 20; $counter++)
$old_ips.= $ip_array[$counter];
?>
Simply write that to the disk the same way as we
did the message file and there we have it. A simple
web-based chat room. Better cross platform
compatibility than Java and no need for anything
more than a web browser – I’m told that even the
Dreamcast
works with this!
did the message file and there we have it. A simple
web-based chat room. Better cross platform
compatibility than Java and no need for anything
more than a web browser – I’m told that even the
Dreamcast
works with this!
Somethings you might want to try yourself include
combining common pieces of code into functions,
writing a script that will automatically add troublemakers
to the banned list and writing a regex expression
that scans a message text for URL’s and e-mail
addresses and automatically turning them into
likes (as Outlook Express and ICQ do).
combining common pieces of code into functions,
writing a script that will automatically add troublemakers
to the banned list and writing a regex expression
that scans a message text for URL’s and e-mail
addresses and automatically turning them into
likes (as Outlook Express and ICQ do).
Play around, have fun, experiment. I did. This is
how I started in PHP and now I’ve made a career of it.
Happy Chatting.
how I started in PHP and now I’ve made a career of it.
Happy Chatting.
–Mike