Jump to content
MakeWebGames

chatroom problem


tom527103

Recommended Posts

right ive just put up a chat room the it writes to the log the text shows up when i got to chats.php but when i type in anything in the text box u cannot see it on the page its ment to be i dont know whats going on but heres my codes

chats.php

<?php
print "<meta http-equiv='refresh' content='3; url=croom.php'>
<body bgcolor='#333'><center>
<font face='verdana' size='2' color='gold'>";
if(file_exists("cbox.txt"))
{
$f=file_get_contents("cbox.txt");
$f=strip_tags($f);
$f=str_replace("/n", "<br />", $f);
} else {
$f="Chat isn't configured right. Remember to CHMOD the file chatbox.txt to 777. Thanks.";
}
print $f;
?>
</font></center></body>

croom.php

<?php

include "globals.php";

$name=$ir['username']." [$userid] : "; //The name of the user

print "<center>
<h3>Chatroom</h3>";

if($_REQUEST['message'])
{
$_GET['message'] = $_REQUEST['message'];


$mess = array("gay","****","poo","game","sign up", "porn", "nob","cock","dick");

$found = 0; //amount of dirty words found
foreach($mess as $val)
{
if(eregi($val, $_GET['message']))
{
$found ++;

} else {

}
//filterd done

$words = array("%","^","&","*","!","?","#","@");

$rand = false;


foreach($words as $w)
{
if(strlen($rand) < 5)
{
$rand .= $w;
}


}

$_GET['message'] = str_replace($val, $rand, $_GET['message']);

}
$newtotal = $name;
$newtotal .= $_GET['message'];
$newtotal .= "/n";
if(strlen(file_get_contents("cbox.txt")) <= 3000)
{
$f = @file_get_contents("cbox.txt");
}
$newtotal .= $f;
$f = fopen("cbox.txt", "w");
fwrite($f, $newtotal);
fclose($f);


}

print "<iframe frameborder='0' src='chats.php' width='100%' height='60%'>

</iframe><br />
<div id='do_a'></div><br />
<form name='newmessage' action='croom.php' method='post' onsubmit='checkbad()'>
Message: <input type='text' name='message' value='' size='30' maxlength='30'><br />
<input type='submit' id='mess' value='Add your message'>
</form>
</center>";


$h->endpage();
?>

 

anyone could tell me what im doing wrong lol would be much appreciated

Link to comment
Share on other sites

yes its creating the txt file and writing to it but on the page croom.php it is not printing the chatbox, if i go to chats.php the chat box is present with the contents of the txt file i just cant seem to put them together, lmao i did try using preg_match still same result chat page with submit button textbox saying chatroom but no chatbox haha giving me a migraine :P any other ideas ? :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...