Chciałbym zrobić czat, a właściwie już zrobiłem, tylko za bardzo mi miga przy odświerzaniu... Oto skrypt:
chat.php
<html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-2\"> <title>Rozmowa</title> <link rel=\"Stylesheet\" href=\"../style.css\" type=\"text/css\"> </head> <body> <div class=\"component\">Rozmowa:</div><br> <div class=\"component_chat\"> <? include(\"messages.txt\"); ?> </div> </body> </html>
send.php
<html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html;charset=ISO-8859-2\"> <title>Wpis</title> <link rel=\"Stylesheet\" href=\"../style.css\" type=\"text/css\"> </head> <body> <div class=\"component\">Wpis:<br> <form method=\"post\" action=\"send.php\"> <center><input type=\"text\" class=\"formtext\" size=\"40\" name=\"message\"></center> <input type=\"hidden\" name=\"op\" value=\"ds\"> </form> </div> </body> </html> <?php if ($op == \"ds\") { if(($message != \"\")&&($message != \" \")) { $chat_file = \"messages.txt\"; $string = \"<b>$_SESSION['user']</b>: $message<br>n$readn\"; }; }; ?>
Wszystko działa ok, tylko czy istnieje możliwość odświeżania rozmowy tylko wtedy, gdy ktoś coś dopisze? Np. wpisuje "blabla" w pliku wpis.php klikam Enter i wtedy rozmowa sie aktualizuje? Bo jest to wkurzające, gdy cała strona tak miga.