Jump to content

php chat


TuQuoQueBrute

Recommended Posts

to pratice i made this simple chat:

 

1 file -Save it as html with the name chat2.html


<?php
$tt=file_get_contents('rec.html');
$hh=str_replace('div id="aaa"', 'div id="m"', $tt);
$ri="$hh";
$fl='rec.html';
$a3=fopen($fl, 'w');
fwrite($a3, $ri);
$a ='<div id="aaa"> <font face="Tahoma" size="2">';
$a .= "$_POST[tyPed]";
$a .='</font></div><p>';
$a1="rec.html";
$a2=fopen($a1, 'a');
fwrite($a2, $a);
?>
<html>



<head>
</head>

<body>
<p align="center"><iframe src="rec.htm#aaa" width="680" height="300" scrolling="auto" ></iframe>
<form method="post" action="chat2.html">
<p align="center"><input type="text" name="tyPed" size="60" maxlength="100" autofocus="autofocus" ><input type="submit" value="Submit" name="b1"><a href="chat2.html">Chek New Messages</a></p>
</form>

</body>

</html>

 

2 file - Save it as html with the mame rec.html and mantain in the same folder as the first file

<?php
echo '<html><head><body><meta http-equiv="refresh" content="10; url="></head></body></html>';
?>

 

The thing is it only get new messages 10 in 10 seconds,

And in I.E it will make that anoying clik clik clik of rederections.

any idea how i can make it get new messagens when there is one new message? It can be only theory i code that theory if it works.

Edited by TuQuoQueBrute
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.