<?php
session_start();
require_once("connect.php");
$ip = $_SERVER['REMOTE_ADDR'];
$t = time();
if (isset($_POST['username'])) {
if (isset($_POST['enter'])) {
echo "<meta http-equiv='refresh' content='1' url='messages.php' target='frame2'>";
}
$ip_ck = mysql_query("SELECT * FROM `bans` WHERE `usr_ip` = '$ip'") or die("<b><u>MySql Error:</u></b> ".mysql_error());
$get = mysql_fetch_array($ip_ck);
if (mysql_num_rows($ip_ck)>0) {
die("<h1>You have been kicked from the chat room.</h1><br><h2>Reason: ".$get['reason']."</h2>");
}else{
if ($_POST['username'] == NULL) {
die("<h1>You need a username in order too chat.</h1>");
}else{
mysql_query("INSERT INTO `occupants` (`id`, `username`, `usr_ip`) VALUES('', '".$_POST['username']."', '$ip')") or die("<b><u>MySql Error:</u></b> ".mysql_error());
mysql_query("INSERT INTO `public` (`id`, `username`, `message`) VALUES('', '".$_POST['username']."', '".$_POST['message']."')") or die("<b><u>MySql Error:</u></b> ".mysql_error());
echo "<meta http-equiv='refresh' content='0;url=chat.php?username='".$_POST['username']."'>";
$_SESSION['s_username'] = $_POST['username'];
}
}
}else{
echo "
<body bgcolor='#3366CC'>
<center>
<form action='".$_SERVER['PHP_SELF']."' method='post'>
<input type='hidden' name='message'>
<input type='hidden' name='enter'>
<input type='hidden' name='to' value='Room'>
Username: <input type='text' name='username'>
<input type='submit' value='Login'>
</form>
</center>
</body>
";
}
?>
I have the frame labled as frame2, I've made sure of that. Can someone help me? ex: http://dsullivan.sil...chat/index.html
