Title: BLS-CHAT
Author: blsoftware
Copyright: 2004 Black List Software
Description: Online PHP Chat application
Installation: 10 minutes
Prerequisites:
a. Folder named: log
b. File named: session.txt
c. PHP installed
Features:
a. DoS protection
b. Built in commands
c. SQL FREE
Bugs:
a. Log file must be refreshed manually BEFORE chatting takes place
Code: Select all
<?php
$user = $_POSTї'uname'];
$userx = $_COOKIEї$user];
setcookie($user, $user);
switch($user) {
case "":
$note = " <font size=2><b>Error:</b> Username Not Specified!</font>";
break;
case "cleanitup":
$user = "";
$clean = "";
$fx = fopen("log/session.txt","w");
fputs($fx,$clean."\n");
fclose($fx);
$note = " <font size=2><b>Status:</b> Command Completed Successfully!</font>";
break;
default:
$file = "log/session.txt";
$lines = count(file($file));
if ($lines >= 16) {
$clean2 = "";
$fx2 = fopen("log/session.txt","w");
fputs($fx2,$clean2."\n");
fclose($fx2);
$message = $_POSTї'message'];
$message = strtolower($message);
$fp = fopen("log/session.txt","ab");
fputs($fp,"\n".$user.": ".$message."\n_________________________________________________________________________\n");
fclose($fp);
$note = " <font size=2><b>Status:</b> Transmission Completed Successfully!</font>";
} else {
$message = $_POSTї'message'];
$message = strtolower($message);
$fp = fopen("log/session.txt","ab");
fputs($fp,"\n".$user.": ".$message."\n_________________________________________________________________________\n");
fclose($fp);
$note = " <font size=2><b>Status:</b> Transmission Completed Successfully!</font>";
}}
?>
<html>
<head>
<title>BLS-CHAT v1.0.0 :: Black List Software</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script>
function doIt(_v) {
if (_v==1) {
document.all.console.src="http://blah.com/log/session.txt";
reLoad();
}}
function reLoad() {
setTimeout("doIt(1)",3000)
}
</script>
</head>
<body bgcolor=#ffffff onload="doIt(1)">
<form name="main" action="<?php $_SERVERї'PHP_SELF']; ?>" method="post">
<center>
<div align="right" style="background:#D3E2F6; width:600; border:#000000 1px solid;">
<table width=599 border=0 cellpadding=0 cellspacing=0>
<td width=70%><?php echo "".$note.""; ?></td>
<td>
<font size=2><b>Username:</b></font>
</td>
<td>
<input type="text" style="width:150;" name="uname" value="<?php echo "".$userx.""; ?>">
</td>
</table>
</div>
<table width=600 border=0 cellpadding=0 cellspacing=0>
<td width=100%>
<iframe name="console" width=598 height=303 src="http://blah.com/log/session.txt"></iframe>
</td>
</table>
<div style="border:#000000 1px solid; width:600;">
<table width=100% border=0 cellpadding=0 cellspacing=0>
<td width=100% bgcolor=#D3E2F6>
<input type="text" name="message" maxlength="60" style="width:100%; height:19; font-size:10px;">
</td>
<td>
<input type="submit" value="Submit" name="sub" style="font-size:10px;">
</td>
</table>
</div>
<br><br>
<font size=1>BLS-CHAT v1.0.0 © 2004 Black List Software, All rights reserved</font>
</center>
</form>
</body>
</html>enjoy