tomfmason Posted July 20, 2006 Share Posted July 20, 2006 Ok I have several questions regarding a live support Script that I am creating. Here is the code that I have so far. The layout is very simple. This is just for testing purposes.[b]The chat login[/b][code=php:0]<?phpif (isset($nick)) { if (empty($nick)) { $error = "nick";} include('db.php');$sql = mysql_query("INSERT INTO chat(nick) VALUES('$nick')") or die (mysql_error());if (!$sql) { $error = "sql";} $filename = "$nick.html";$handle = fopen($filename, "x+b");$body = "<meta http-equiv=\"refresh\" content=\"2\"><meta name=\"robots\" content=\"noindex\"><p> Welcome <b>$nick</b>, an operator will be with you shortly.</p><!--Start of chat--><!--end of chat--></p>";fwrite($handle, $body);fclose($handle);include('chat.php'); } ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Untitled Document</title></head><body><p><h3>Please Enter your nick name</h3></p><?phpif ($error == "nick") { echo "You did not enter a nick name";}if ($error == "sql") { echo "Something when wrong with the MySQL query.";} ?><form action="enter_chat.php" method="post"><input type="text" name="nick" size="20"><input type="submit" name="submit" value="Submit"></form></body></html>[/code]ok I guess I will start with the questions about this script.First, how can I retrieve the chat_id from the data base so that I may create a html file like this [b]$nick.$chat_id.html[/b]Second, is a refresh rate of 2 seconds to much? Can I make it refresh, on both the client side and operator side, when a new line is added?Third, when I have enough messages where you need to scroll down to see the last message. Every time the page refreshes it starts me over at the top line again. Is there a way that, when it refreshes, I can make it go to the bottom of the html file.Thanks,Tom Link to comment https://forums.phpfreaks.com/topic/15092-several-questions-regarding-chat-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.