Log in

View Full Version : PHP Chat Room Problems



Johnnymushio
05-21-2006, 06:52 PM
Okay, I'm having problems with my chat rooms,,,

http://japantown.awardspace.com/generalchat/chat.htm & http://japantown.awardspace.com/languagechat/chat.htm

the first problem is after about 30 or so posts, the chat wont refresh anymore. i look at the source of the page and the bottom half gets erased somehow because the user posts take it over and push it off so it gets deleted.

the second problem i have is that once the "Post!" button is pushed, the page is not refreshed. it still only refreshes every 15 seconds (assuming more than 30 posts aren't in the messages section). how can i make the post button also refresh?

third problem, when a user logs in it simply says "username -", how can i make it say "username-san has logged in."

fourth problem, there is no log off button. i would like a log off button that says "username-san has logged off." once pushed and for the user to go back to the main page /japantown.shtml

fifth problem, the text input box doesn't follow the text if it goes out of the box length, how can i make it follow?

sixth problem..... i cant get the forum jump menu centered between old posts and active users, how do i get it centered?

7th problem, there is a bgsound embedded into the page, i do not want it and every time i remove it, it just comes back. how do i remove it?

that's all the problems i don't know how to fix.

i really appreciate your help.

email me for each of the 9 files of the general chat if it would help you.

Twey
05-21-2006, 10:03 PM
chat.php, lines 44-49:

$header = "<html><head>".
"<embed src=\"sound.wav\" width=2 height=0 autostart=true loop=false> <noembed> <bgsound src=\"sound.wav\" loop=none> </noembed>\n";
"<meta http-equiv=\"pragma\" content=\"no-cache\">".
"<meta http-equiv=\"refresh\" CONTENT=\"15\">".
"<meta name=\"robots\" content=\"noindex\"></head>".
"<body bgcolor=\"#3399ff\" text=\"#ffffff\"><p>".That semicolon should be at the end of the string, not in the middle :)
To change the number of stored posts, with regards to a question asked in the chat room itself, find "40" in chat.php:20, and set it to the desired number.
3) is trickier, technically and culturally. If you look at the source, you'll see that the "logged-in" message is just a normal blank message. You could use something like this (chat.php:43):
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : "-san has logged in.") . "<p>\n </font>";Also, san might not always be appropriate.
4) chat.php:112:
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>chat.php:43:
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : (isset($_POST['logout']) ? "-san has logged out." : "-san has logged in.")) . "<p>\n </font>";chat.php, under line 62:
if(isset($_POST['logout'])) header("Location: http://japantown.awardspace.com/");6) Looks pretty centred to me.
7) Remove chat.php:45.

Johnnymushio
05-22-2006, 02:33 AM
ummm.. yeah

httpL//japantown.awardspace.com/generalchat/chat.htm

i went t line 63 and deleted it, and i logged in but the bottom part went blank and it never said i logged in, so i put line 63 back and i got the error message again.

Twey
05-22-2006, 06:27 AM
Eh? Where did I say to delete line 63? I'm sure I never did.

All line numbers refer to the unedited file, by the way.

Johnnymushio
05-22-2006, 04:21 PM
yeah but if you go to that chat you will see what i mean

Twey
05-22-2006, 04:25 PM
If you delete line 63, then yes, things are going to screw up. :) That's a function declaration. :)
Therefore, I suggest you don't delete line 63, and put it back.

Johnnymushio
05-22-2006, 06:15 PM
it is backkkkk... look at the error message! please

Twey
05-22-2006, 07:13 PM
At a guess, I'd say you've inserted my if statement between function ... and the opening brace. Move it up a line.

This is why the note about all line numbers applying to the unedited version. :)

Johnnymushio
05-22-2006, 09:52 PM
if u go to the language chat, you will notice more problems. the background turns blue once a message is posted. each time a message is typed the old one is replaces with the new. there is still no log off button for some reason.

Twey
05-22-2006, 10:06 PM
Could you attach the current version of chat.php here please?
There is a "log out" button, by the way. It's just that your frame is too small for it to be seen. However, it doesn't do the redirection properly. I suggest you use:
(isset($_POST['logout']) ? '<script type="text/javascript">'."\n".'top.location.href="japantown.awardspace.com";'."\n".'</script>' : "<meta http-equiv=\"refresh\" CONTENT=\"15\">").instead of:
"<meta http-equiv=\"refresh\" CONTENT=\"15\">".and remove the header() call I suggested earlier.

Twey
05-22-2006, 10:35 PM
I said attach. Attach! Or at least use [code] tags!

Johnnymushio
05-23-2006, 12:33 AM
<html>
<head>
<title>Japan Town - General Chat</title>
<?
if(!$chathandle) {
print_form();
exit;
};
$my_icon = "default.gif";
if(!$message && ($faceshow == $my_icon)) {
print_form_nameset();
exit;
};
$time = date("H:i d/m");
$timeis = time();
$holdtime = $timeis - 900 ;
$message_array = file("messages.htm");
$history_array = file("archive.htm");
$show_who = file("users.txt");
for ($talley = 1; $talley < 40; $talley++) {
$old_messages .= $message_array[$talley];
}
for ($talley = 1; $talley < 200; $talley++) {
$old_history .= $history_array[$talley];
}
foreach ($show_who as $user_on) {
$displayed = explode(",",$user_on);
if( $displayed[0] < $holdtime ){
break;
}
if( $displayed[1] == "$chathandle\n" ){
break;
}
$updated .= $user_on;
}
$updated .= "$timeis\,$chathandle\n";
$online = stripslashes($updated);
$open_file = fopen("users.txt", w);
fputs($open_file, $online);
fclose($open_file);
$chathandle = htmlspecialchars($chathandle);
$message = htmlspecialchars($message);
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : "-san has logged in.") . "<p>\n </font>";
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : (isset($_POST['logout']) ? "-san has logged out." : "-san has logged in.")) . "<p>\n </font>";
$header = "<html><head>".
"<meta http-equiv=\"pragma\" content=\"no-cache\">".
(isset($_POST['logout']) ? '<script type="text/javascript">'."\n".'top.location.href="japantown.awardspace.com";'."\n".'</script>' : "<meta http-equiv=\"refresh\" CONTENT=\"15\">").
"<meta name=\"robots\" content=\"noindex\"></head>".
"<body bgcolor=\"#ffffff\" text=\"#000000\"><p>";
$open_file = fopen("messages.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_messages);
fputs($open_file, $footer);
fclose($open_file);
$open_file = fopen("archive.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_history);
fputs($open_file, $footer);
fclose($open_file);
print_form_nameset();
if(isset($_POST['logout'])) header("Location: http://japantown.awardspace.com/");
function print_form()
{
global $chathandle;
global $self_post;
echo <<<FORM1
</head>
<body bgcolor="cc0000">
<BODY bgcolor="cc0000">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username:</font> <input type="text" name="chathandle" size="20" maxlength="20" value="$chathandle">
<font color="ffffff"> Text Color:</font> <select name="myfont">
<option value="#000000">Default</option>
<option value="#0000FF">Blue</option>
<option value="#A52A2A">Brown</option>
<option value="#696969">DimGray</option>
<option value="#FF00FF">Fuchsia</option>
<option value="#008000">Green</option>
<option value="#808080">Grey</option>
<option value="#6495ED">Mid Blue</option>
<option value="#000080">Navy Blue</option>
<option value="#FFA500">Orange</option>
<option value="#800080">Purple</option>
<option value="#FF0000">Red</option>
<option value="#008080">Teal</option>
<option value="#EE82EE">Violet</option>
</select>
<input type="submit" value="Log In!">&nbsp;<font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font><br>
</form>
</font>
FORM1;
}
function print_form_nameset()
{
global $myfont;
global $chathandle;
global $self_post;
echo <<<FORM2
</head>
<body>
<BODY bgcolor="cc0000">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username: <i>$chathandle</i></font> <input type="hidden" name="chathandle" value="$chathandle">
<input type="hidden" name="myfont" value="$myfont">
<font color="ffffff"> Message:</font> <input type="text" name="message" size="50" maxlength="255">
<input type="submit" value="Post!"><br><font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font>
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>
</font>
FORM2;
}
?>
</body>
</html>

Twey
05-23-2006, 04:43 PM
Can you follow the advice I've already given you first, please? You haven't removed the header() call.

Johnnymushio
05-23-2006, 04:54 PM
whats the header call?

Twey
05-23-2006, 05:08 PM
The call to the function header().
The line beneath:
fclose($open_file);
print_form_nameset();

Johnnymushio
05-23-2006, 08:39 PM
alright i did


<html>
<head>
<title>Japan Town - General Chat</title>
<?
if(!$chathandle) {
print_form();
exit;
};
$my_icon = "default.gif";
if(!$message && ($faceshow == $my_icon)) {
print_form_nameset();
exit;
};
$time = date("H:i d/m");
$timeis = time();
$holdtime = $timeis - 900 ;
$message_array = file("messages.htm");
$history_array = file("archive.htm");
$show_who = file("users.txt");
for ($talley = 1; $talley < 40; $talley++) {
$old_messages .= $message_array[$talley];
}
for ($talley = 1; $talley < 200; $talley++) {
$old_history .= $history_array[$talley];
}
foreach ($show_who as $user_on) {
$displayed = explode(",",$user_on);
if( $displayed[0] < $holdtime ){
break;
}
if( $displayed[1] == "$chathandle\n" ){
break;
}
$updated .= $user_on;
}
$updated .= "$timeis\,$chathandle\n";
$online = stripslashes($updated);
$open_file = fopen("users.txt", w);
fputs($open_file, $online);
fclose($open_file);
$chathandle = htmlspecialchars($chathandle);
$message = htmlspecialchars($message);
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : "-san has logged in.") . "<p>\n </font>";
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : (isset($_POST['logout']) ? "-san has logged out." : "-san has logged in.")) . "<p>\n </font>";
$header = "<html><head>".
"<meta http-equiv=\"pragma\" content=\"no-cache\">".
(isset($_POST['logout']) ? '<script type="text/javascript">'."\n".'top.location.href="japantown.awardspace.com";'."\n".'</script>' : "<meta http-equiv=\"refresh\" CONTENT=\"15\">").
"<meta name=\"robots\" content=\"noindex\"></head>".
"<body bgcolor=\"#ffffff\" text=\"#000000\"><p>";
$open_file = fopen("messages.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_messages);
fputs($open_file, $footer);
fclose($open_file);
$open_file = fopen("archive.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_history);
fputs($open_file, $footer);
fclose($open_file);
print_form_nameset();
function print_form()
{
global $chathandle;
global $self_post;
echo <<<FORM1
</head>
<body bgcolor="cc0000">
<BODY bgcolor="cc0000">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username:</font> <input type="text" name="chathandle" size="20" maxlength="20" value="$chathandle">
<font color="ffffff"> Text Color:</font> <select name="myfont">
<option value="#000000">Default</option>
<option value="#0000FF">Blue</option>
<option value="#A52A2A">Brown</option>
<option value="#696969">DimGray</option>
<option value="#FF00FF">Fuchsia</option>
<option value="#008000">Green</option>
<option value="#808080">Grey</option>
<option value="#6495ED">Mid Blue</option>
<option value="#000080">Navy Blue</option>
<option value="#FFA500">Orange</option>
<option value="#800080">Purple</option>
<option value="#FF0000">Red</option>
<option value="#008080">Teal</option>
<option value="#EE82EE">Violet</option>
</select>
<input type="submit" value="Log In!">&nbsp;<font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font><br>
</form>
</font>
FORM1;
}
function print_form_nameset()
{
global $myfont;
global $chathandle;
global $self_post;
echo <<<FORM2
</head>
<body>
<BODY bgcolor="cc0000">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username: <i>$chathandle</i></font> <input type="hidden" name="chathandle" value="$chathandle">
<input type="hidden" name="myfont" value="$myfont">
<font color="ffffff"> Message:</font> <input type="text" name="message" size="50" maxlength="255">
<input type="submit" value="Post!"><br><font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font>
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>
</font>
FORM2;
}
?>
</body>
</html>

Twey
05-23-2006, 08:55 PM
Not from General Chat... in fact, it still gives the "Unexpected T_IF" error that says you haven't even moved it back up a line.

Johnnymushio
05-23-2006, 09:07 PM
imso freaking ocnfused. both the chats say general chat now....

Twey
05-23-2006, 09:09 PM
Lol, so they do. Did you copy the same file across to both without editing it?

Johnnymushio
05-23-2006, 09:12 PM
i had to of. i might just go to my backup copy on my flash drive and start all over

Johnnymushio
05-23-2006, 09:25 PM
<html>
<head>
<title>Japan Town - General Chat</title>
<?
if(!$chathandle) {
print_form();
exit;
};
$my_icon = "default.gif";
if(!$message && ($faceshow == $my_icon)) {
print_form_nameset();
exit;
};
$time = date("H:i d/m");
$timeis = time();
$holdtime = $timeis - 900 ;
$message_array = file("messages.htm");
$history_array = file("archive.htm");
$show_who = file("users.txt");
for ($talley = 1; $talley < 40; $talley++) {
$old_messages .= $message_array[$talley];
}
for ($talley = 1; $talley < 200; $talley++) {
$old_history .= $history_array[$talley];
}
foreach ($show_who as $user_on) {
$displayed = explode(",",$user_on);
if( $displayed[0] < $holdtime ){
break;
}
if( $displayed[1] == "$chathandle\n" ){
break;
}
$updated .= $user_on;
}
$updated .= "$timeis\,$chathandle\n";
$online = stripslashes($updated);
$open_file = fopen("users.txt", w);
fputs($open_file, $online);
fclose($open_file);
$chathandle = htmlspecialchars($chathandle);
$message = htmlspecialchars($message);
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : "-san has logged in.") . "<p>\n </font>";
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : (isset($_POST['logout']) ? "-san has logged out." : "-san has logged in.")) . "<p>\n </font>";
$header = "<html><head>".
"<meta http-equiv=\"pragma\" content=\"no-cache\">".
"<meta http-equiv=\"refresh\" CONTENT=\"15\">".
"<meta name=\"robots\" content=\"noindex\"></head>".
"<body bgcolor=\"#ffffff\" text=\"#000000\"><p>".;
$open_file = fopen("messages.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_messages);
fputs($open_file, $footer);
fclose($open_file);
$open_file = fopen("archive.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_history);
fputs($open_file, $footer);
fclose($open_file);
print_form_nameset();
function print_form()
{
global $chathandle;
global $self_post;
echo <<<FORM1
</head>
<body bgcolor="3399ff">
<BODY bgcolor="3399ff">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username:</font> <input type="text" name="chathandle" size="20" maxlength="20" value="$chathandle">
<font color="ffffff"> Text Color:</font> <select name="myfont">
<option value="#000000">Default</option>
<option value="#0000FF">Blue</option>
<option value="#A52A2A">Brown</option>
<option value="#696969">DimGray</option>
<option value="#FF00FF">Fuchsia</option>
<option value="#008000">Green</option>
<option value="#808080">Grey</option>
<option value="#6495ED">Mid Blue</option>
<option value="#000080">Navy Blue</option>
<option value="#FFA500">Orange</option>
<option value="#800080">Purple</option>
<option value="#FF0000">Red</option>
<option value="#008080">Teal</option>
<option value="#EE82EE">Violet</option>
</select>
<input type="submit" value="Log In!">&nbsp;<font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font><br>
</form>
</font>
FORM1;
}
function print_form_nameset()
{
global $myfont;
global $chathandle;
global $self_post;
echo <<<FORM2
</head>
<body>
<BODY bgcolor="3399ff">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username: <i>$chathandle</i></font> <input type="hidden" name="chathandle" value="$chathandle">
<input type="hidden" name="myfont" value="$myfont">
<font color="ffffff"> Message:</font> <input type="text" name="message" size="50" maxlength="255">
<input type="submit" value="Post!"><br><font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font>
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>
</font>
FORM2;
}
?>
</body>
</html>


OKAY GENERAL CHAT ALL TIDIED UP

Twey
05-23-2006, 09:46 PM
You can't have that semicolon on line 8 after the closing brace of the if block.

Johnnymushio
05-23-2006, 09:51 PM
okay took it out, then it said line 49 enexpected ;, so i took that out, now it says
Parse error: parse error, unexpected T_SL, expecting ',' or ';' in /home/www/japantown.awardspace.com/generalchat/chat.php on line 67

Twey
05-23-2006, 09:55 PM
On line 48, remove the . before the semicolon, not the semicolon.

Johnnymushio
05-23-2006, 10:26 PM
ERRORS!!! WHY ALAYS AN ERROR! go to the chat and read its error message i have no freaking idea wht its talking about

Twey
05-23-2006, 11:09 PM
Peculiar... I used the code on my local PC and it worked fine. Let's check we're working with the same code here:
<html>
<head>
<title>Japan Town - General Chat</title>
<?
if(!$chathandle) {
print_form();
exit;
};
$my_icon = "default.gif";
if(!$message && ($faceshow == $my_icon)) {
print_form_nameset();
exit;
};
$time = date("H:i d/m");
$timeis = time();
$holdtime = $timeis - 900 ;
$message_array = file("messages.htm");
$history_array = file("archive.htm");
$show_who = file("users.txt");
for ($talley = 1; $talley < 40; $talley++) {
$old_messages .= $message_array[$talley];
}
for ($talley = 1; $talley < 200; $talley++) {
$old_history .= $history_array[$talley];
}
foreach ($show_who as $user_on) {
$displayed = explode(",",$user_on);
if( $displayed[0] < $holdtime ){
break;
}
if( $displayed[1] == "$chathandle\n" ){
break;
}
$updated .= $user_on;
}
$updated .= "$timeis\,$chathandle\n";
$online = stripslashes($updated);
$open_file = fopen("users.txt", w);
fputs($open_file, $online);
fclose($open_file);
$chathandle = htmlspecialchars($chathandle);
$message = htmlspecialchars($message);
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : "-san has logged in.") . "<p>\n </font>";
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : (isset($_POST['logout']) ? "-san has logged out." : "-san has logged in.")) . "<p>\n </font>";
$header = "<html><head>".
"<meta http-equiv=\"pragma\" content=\"no-cache\">".
"<meta http-equiv=\"refresh\" CONTENT=\"15\">".
"<meta name=\"robots\" content=\"noindex\"></head>".
"<body bgcolor=\"#ffffff\" text=\"#000000\"><p>";
$open_file = fopen("messages.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_messages);
fputs($open_file, $footer);
fclose($open_file);
$open_file = fopen("archive.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_history);
fputs($open_file, $footer);
fclose($open_file);
print_form_nameset();
function print_form()
{
global $chathandle;
global $self_post;
echo <<<FORM1
</head>
<body bgcolor="3399ff">
<BODY bgcolor="3399ff">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username:</font> <input type="text" name="chathandle" size="20" maxlength="20" value="$chathandle">
<font color="ffffff"> Text Color:</font> <select name="myfont">
<option value="#000000">Default</option>
<option value="#0000FF">Blue</option>
<option value="#A52A2A">Brown</option>
<option value="#696969">DimGray</option>
<option value="#FF00FF">Fuchsia</option>
<option value="#008000">Green</option>
<option value="#808080">Grey</option>
<option value="#6495ED">Mid Blue</option>
<option value="#000080">Navy Blue</option>
<option value="#FFA500">Orange</option>
<option value="#800080">Purple</option>
<option value="#FF0000">Red</option>
<option value="#008080">Teal</option>
<option value="#EE82EE">Violet</option>
</select>
<input type="submit" value="Log In!">&nbsp;<font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font><br>
</form>
</font>
FORM1;
}
function print_form_nameset()
{
global $myfont;
global $chathandle;
global $self_post;
echo <<<FORM2
</head>
<body>
<BODY bgcolor="3399ff">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<font color="ffffff"> Username: <i>$chathandle</i></font> <input type="hidden" name="chathandle" value="$chathandle">
<input type="hidden" name="myfont" value="$myfont">
<font color="ffffff"> Message:</font> <input type="text" name="message" size="50" maxlength="255">
<input type="submit" value="Post!"><br><font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font>
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>
</font>
FORM2;
}
?>
</body>
</html>

Johnnymushio
05-24-2006, 12:27 AM
Okay that code is what is on the server now. Here is a list of current problems. (BTW, I can't thank you enoughf or all of your help.)

- The "Post!" button does not refresh the page also.

- The "Log off" button is not one space to the right of the "Post!" button.

- The messages get erased as new ones are posted.

- After 60 minutes of inactivity, I want the messages section to say "username-san has logged off.

- BTW, you said "-san" might not always be appropriate... Why?

Twey
05-24-2006, 01:05 PM
1) Find:
<form name="chat" method="post" action="$self_post" ><br>Replace with:
<form name="chat" method="post" action="$self_post" onsubmit="window.setTimeout('parent.mainFrame.location.href = parent.mainFrame.location.href', 1000);"><br>
2) Find:
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>Replace with:
</form><form method="post" action="$self_post" style="display: inline;" onsubmit="window.setTimeout('parent.mainFrame.location.href = parent.mainFrame.location.href', 1000);"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>3) Answer below first; this doesn't matter if we're going to rewrite the code to use a database anyway.
4) You'll need to save the time of each post too, then. Have you considered using a database for all this? Do you have one at your disposal?
5) Somebody with another title might prefer that to be used instead, especially if it's job-related such as 医者 (いしゃ) or 先生 (せんせい). A title-selection box should probably be used instead of always using さん.

Johnnymushio
05-24-2006, 03:18 PM
No, I only have 1 database and I used it on the message board. I didn't want the chat rooms to have databases anyway, maybe in a couple years.

How would I put a title selection box in?

Twey
05-24-2006, 03:43 PM
No, I only have 1 database and I used it on the message board.That's not a problem, you can have more than one application using the same database without too much trouble.

I didn't want the chat rooms to have databases anyway, maybe in a couple years.This would be one heck of a lot easier with databases. It probably would be possible to hack together a solution using text files, but if at all possible, databases are definitely the way to go.

How would I put a title selection box in?
<html>
<head>
<title>Japan Town - General Chat</title>
<?
if(!$chathandle) {
print_form();
exit;
};
if(!$title) $title = "san";
$my_icon = "default.gif";
if(!$message && ($faceshow == $my_icon)) {
print_form_nameset();
exit;
};
$time = date("H:i d/m");
$timeis = time();
$holdtime = $timeis - 900 ;
$message_array = file("messages.htm");
$history_array = file("archive.htm");
$show_who = file("users.txt");
for ($talley = 1; $talley < 40; $talley++) {
$old_messages .= $message_array[$talley];
}
for ($talley = 1; $talley < 200; $talley++) {
$old_history .= $history_array[$talley];
}
foreach ($show_who as $user_on) {
$displayed = explode(",",$user_on);
if( $displayed[0] < $holdtime ){
break;
}
if( $displayed[1] == "$chathandle\n" ){
break;
}
$updated .= $user_on;
}
$updated .= "$timeis\,$chathandle\n";
$online = stripslashes($updated);
$open_file = fopen("users.txt", w);
fputs($open_file, $online);
fclose($open_file);
$chathandle = htmlspecialchars($chathandle);
$message = htmlspecialchars($message);
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : "-$title has logged in.") . "<p>\n </font>";
$new_message = "<font color=\"$myfont\">$chathandle" . ($message ? " - $message" : (isset($_POST['logout']) ? "-$title has logged out." : "-$title has logged in.")) . "<p>\n </font>";
$header = "<html><head>".
"<meta http-equiv=\"pragma\" content=\"no-cache\">".
"<meta http-equiv=\"refresh\" CONTENT=\"15\">".
"<meta name=\"robots\" content=\"noindex\"></head>".
"<body bgcolor=\"#ffffff\" text=\"#000000\"><p>";
$open_file = fopen("messages.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_messages);
fputs($open_file, $footer);
fclose($open_file);
$open_file = fopen("archive.htm", "w");
fputs($open_file, $header);
fputs($open_file, stripslashes($new_message));
fputs($open_file, $old_history);
fputs($open_file, $footer);
fclose($open_file);
print_form_nameset();
function print_form()
{
global $chathandle;
global $self_post;
echo <<<FORM1
</head>
<body bgcolor="3399ff">
<BODY bgcolor="3399ff">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<label>Title: <input type="text" name="title"></label>
<font color="ffffff"> Username:</font> <input type="text" name="chathandle" size="20" maxlength="20" value="$chathandle">
<font color="ffffff"> Text Color:</font> <select name="myfont">
<option value="#000000">Default</option>
<option value="#0000FF">Blue</option>
<option value="#A52A2A">Brown</option>
<option value="#696969">DimGray</option>
<option value="#FF00FF">Fuchsia</option>
<option value="#008000">Green</option>
<option value="#808080">Grey</option>
<option value="#6495ED">Mid Blue</option>
<option value="#000080">Navy Blue</option>
<option value="#FFA500">Orange</option>
<option value="#800080">Purple</option>
<option value="#FF0000">Red</option>
<option value="#008080">Teal</option>
<option value="#EE82EE">Violet</option>
</select>
<input type="submit" value="Log In!">&nbsp;<font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font><br>
</form>
</font>
FORM1;
}
function print_form_nameset()
{
global $myfont;
global $chathandle;
global $self_post;
echo <<<FORM2
</head>
<body>
<BODY bgcolor="3399ff">
<p>
<font size="-1">
<form name="chat" method="post" action="$self_post" ><br>
<input type="hidden" name="title" value="$title">
<font color="ffffff"> Username: <i>$chathandle</i></font> <input type="hidden" name="chathandle" value="$chathandle">
<input type="hidden" name="myfont" value="$myfont">
<font color="ffffff"> Message:</font> <input type="text" name="message" size="50" maxlength="255">
<input type="submit" value="Post!"><br><font size="-7" color="000000">Original Code: <a href="http://homedesign.8m.com/pcimchat/" target="_parent">PCIM</a>, Design: &copy;2006 Japan Town</font>
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>
</font>
FORM2;
}
?>
</body>
</html>Your code, both server-side and client-side, leaves much to be desired. This would probably be best rewritten.

Johnnymushio
05-24-2006, 04:55 PM
How does it leave too much to be desired? You mean all the things I want added to it?

And, how are databases easier? It would seem harder...

Actually,Yes, I am going to hold off on making a database for it, the chat room is already almost done except for the messages getting erased. I don't want to spend a lot more time on the website, since I am taking a 3 month break from it strating June 1st. I'm spending a lot of time on it, and putting a lot of things off!

I want to put a special thanks to you somewhere on my site for helping me with the chat rooms. Do you care if I do?

Twey
05-24-2006, 05:54 PM
No, using a database would greatly simplify the task. With a file, for each dimension of data you wish to add, you need to use a different seperator. What happens when somebody enters data that contains your field seperator? Boom, broken script.
How does it leave too much to be desired? You mean all the things I want added to it?Both the HTML and the PHP are badly formed. Run your site through a validator (http://validator.w3.org/) to check the HTML. Unfortunately, there's no such repository of good PHP practices; you've just got to know your way around. But trust me when I say you've done things that aren't a wise idea (like reliance on register_globals).

Johnnymushio
05-24-2006, 05:56 PM
Well... okay.

So, the site can look just as it does even if we make it use a database?

And, would users have to register in order to use it?

And,,, would the files be easy to tranfer to a new server in the future?

Twey
05-24-2006, 06:24 PM
Yes, no, and moreso than they are currently :)

I want to put a special thanks to you somewhere on my site for helping me with the chat rooms. Do you care if I do?Not particularly :) Do it if you feel you want to, but I won't push the issue one way or the other.

Johnnymushio
05-24-2006, 09:02 PM
okay, sooo... i have no idea where to start

Twey
05-24-2006, 09:16 PM
I'm working on it :)

Johnnymushio
05-24-2006, 11:41 PM
you are so helpful. thanks so much

Twey
05-24-2006, 11:46 PM
Still got a few errors yet... thank me when it's finished :)
The current state can be seen at http://home.twey.co.uk/ddstuff/むしお/chat.htm.

djr33
05-24-2006, 11:51 PM
Twey, that link is wrong.... shows ALL the files on your server. Edit quickly if there's anything you'd want to keep secure.

Twey
05-25-2006, 12:00 AM
No it isn't, works fine here. Maybe you need Japanese support.
Don't worry, all the directories with possibly-vulnerable scripts in have index pages :)
I've moved it to here (http://home.twey.co.uk/ddstuff/mushio/chat.htm) so all you poor people without Japanese support can gasp at my genius ;)

djr33
05-25-2006, 01:13 AM
Haha, thanks. :p

Johnnymushio
05-25-2006, 11:15 AM
the links lead to an error page that says the page cannot be found, at least for me they do.

Twey
05-25-2006, 11:27 AM
Yeah, I've merged everything into one file. [url]http://home.twey.co.uk/ddstuff/mushio/chat.php?frames (source (http://home.twey.co.uk/ddstuff/mushio/chat.phps))
All I've got to do now is sort the forum-jump box out (it goes wrong in IE) and then I'll be done.

Twey
05-25-2006, 03:58 PM
Here we go. All done.

Demo: http://www.twey.co.uk/files/chat.php?frames
Source: http://www.twey.co.uk/files/chat.phps
mysqldump of the tables: http://www.twey.co.uk/files/japantown.sql

Cold Gunmetal
05-29-2006, 01:05 AM
Another journey into... The Twilight Zone.

It's an inside joke, only a few people would get it.

It's a trend of mine.

Cold Gunmetal
05-29-2006, 01:05 AM
Never mind.

Twey
05-29-2006, 01:10 AM
I've seen it. Don't worry. :p

Johnnymushio
06-02-2006, 11:25 AM
is the link to the source new? and where do i put the mysql table thing?

Twey
06-02-2006, 01:22 PM
No, and you should execute it on your database.

Johnnymushio
06-02-2006, 04:21 PM
can u please give me the link to the updated file?

Twey
06-02-2006, 07:18 PM
Everything is still in the same place as the last links above.

Johnnymushio
06-02-2006, 09:25 PM
the mysql link doesnt work.

Twey
06-03-2006, 11:47 AM
Oh, sorry! Should now.
http://www.twey.co.uk/files/japantown.sql

Johnnymushio
06-03-2006, 07:11 PM
i cant get it to work,,, named it generalchat.php then executed the sql file to the database and it said executed successfully, but i go to the chat and get error messages

Twey
06-03-2006, 07:31 PM
Failure to connect to the database. Did you edit the file and put in your database details properly?

Johnnymushio
06-03-2006, 07:38 PM
okay in the general chat.php file it says username and password, will people be able to see it if they view the source?

Twey
06-03-2006, 07:51 PM
No, the source is never sent to the browser.

Johnnymushio
06-03-2006, 07:55 PM
cant get it to work...... now it says line 3 error, thats dbhost. it says its db2.awardspace.com but that didnt work.

btw, the chat code is what the code of the demo, right?

Twey
06-03-2006, 08:03 PM
Exactly, except for the username and password. I just copied it. :)
Make sure you have the quotes in there still. It should look like this:


$dbhost = "db2.awardspace.com";

Johnnymushio
06-03-2006, 10:56 PM
okay now all i get is the bottom frame when i go to http://japantown.awardspace.com/generalchat.php

Twey
06-03-2006, 11:53 PM
Means it's all working fine.
http://japantown.awardspace.com/generalchat.php?frames

djr33
06-04-2006, 12:08 AM
Er... you really should remove the ?frames part, have that be default, and use ?form for the bottom page.


Note: I refreshed and stuff, and not sure why, but on one load, I got an "internal error"... I think it was code 500. No clue if this matters... might have just been me clicking back or something. Works again after that... so... probly just a one time thing. Just so you know, though.

Twey
06-04-2006, 01:01 AM
Er... you really should remove the ?frames part, have that be default, and use ?form for the bottom page.Yeah, but the form needs to be posted to, so I left it as the default for simplicity's sake.
Note: I refreshed and stuff, and not sure why, but on one load, I got an "internal error"... I think it was code 500. No clue if this matters... might have just been me clicking back or something.That'll happen if something goes wrong with the server, or if it's just particularly slow and the script outlives its maximum execution time limit.

djr33
06-04-2006, 06:45 AM
Well... you don't want to have people needing to type the ?frames thing... it'll confuse them.

Ok, figured it wasn't too important of an error.

Twey
06-04-2006, 11:48 AM
djr33, this is why we have links. :)

Johnnymushio
06-04-2006, 05:09 PM
okay would i need a seperate sql file to execute in order to make another chat? and how do i change the image color to cc0000?

Twey
06-04-2006, 06:31 PM
okay would i need a seperate sql file to execute in order to make another chat?No, you can get away with editing that one. Change the table names, and remember to change them in chat.php as well.
and how do i change the image color to cc0000?The image is base64_encode()'ed. Save the image, edit it in your favourite image editor, then use PHP to base64_encode() it and put the resulting string in the place of the old one.

djr33
06-04-2006, 09:20 PM
"this is why we have links"

but still... just seems cleaner if the default is the right one. You NEVER will want just the form. Right?
Or is that login the right first page? So you login then go to the frames view after?

Johnnymushio
06-04-2006, 09:30 PM
so, i will need to seperate sql files? what tables do i change? and where are they in the 2 files?

and, i have no idea how to encode the image to php...

djr33
06-04-2006, 09:48 PM
sql databases allow for multiple tables. As twey said, change the table names, and you can use one database to hold both... but you do need unique names.

Maybe use something like this:
chat1_messages
chat2_messages
...for each table, rename it with chatname_.
just to keep it organized.

Twey
06-04-2006, 09:59 PM
and, i have no idea how to encode the image to php...The easiest way is using PHP...
<?php
die(base64_encode(file_get_contents("image.gif")));
?>

Johnnymushio
06-04-2006, 10:49 PM
im lost. how can that but the image into it?

djr33
06-04-2006, 11:13 PM
it'll encode that, outputting the encoded version, i'm assuming text. Not sure, though.

Just run that, with the "image.gif" replaced with the URL of your image.

Johnnymushio
06-04-2006, 11:26 PM
okay i didnt know it had to be done on a server.

and as for the sql tables, they r getting mixed up. for exapmple,,

test 1 loggs into chat 1. then he logs off.

he will log of in chat 1 and chat 2, even tho he was never in chat 2.

it seems to happen when using the forum jump without logging off.

and the forum jump menu, sometimes when something is selected it will go to the homepage of my site instead of the link.

djr33
06-04-2006, 11:37 PM
oh, i'm not sure. I'm not familiar with that function. maybe there's a slight syntax error.
die() displays whatever is inside, and stops executing the script after that. so... yes, it should display whatever output was meant to be displayed.

yeah, you need to change the table names in the php as well as in the database.
Or they're gonna be conflicting.

Johnnymushio
06-04-2006, 11:49 PM
yes i did change them in the php and sql files.

djr33
06-04-2006, 11:59 PM
clearly not all of them, somehow... that's why it's doing it.
You probly just missed one in some obscure place.

if you really did find every one, then i'm not sure what to say.

Johnnymushio
06-05-2006, 12:06 AM
i triple checked each file.

generalchat.php
generalchat.sql

languagechat.php
languagechat.sql

djr33
06-05-2006, 12:20 AM
Ok. Then we'll have to see what Twey says.

Twey
06-05-2006, 08:49 AM
Yes, it sounds like you've missed changing the $msgtable variable in languagechat.php.

Johnnymushio
06-05-2006, 11:17 AM
no i didnt.. the php files each have 1 $msgtable and 1 $usertable, right? if thats so i didnt miss anything. i checked the files again and again.

Twey
06-05-2006, 04:34 PM
Yes, but they should be the same as the tables you created in your SQL.

Johnnymushio
06-05-2006, 05:14 PM
Yes... they are all the same. Would you like to see the files to see if I missed anything? I searched all over, and used the find button in notepad and didnt see any that I missed, but you never know.

here is the sql codes


-- MySQL dump 10.9
--
-- Host: db2.awardspace.com Database: johnnymushio_MB
-- ------------------------------------------------------
-- Server version 4.1.20-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `generalchat_messages`
--

DROP TABLE IF EXISTS `generalchat_messages`;
CREATE TABLE `generalchat_messages` (
`id` int(11) NOT NULL auto_increment,
`msg` text,
`user` int(11) default NULL,
`time` datetime default NULL,
`special` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Table structure for table `generalchat_users`
--

DROP TABLE IF EXISTS `generalchat_users`;
CREATE TABLE `generalchat_users` (
`id` int(11) NOT NULL auto_increment,
`handle` text,
`font` text,
`lastseen` datetime default NULL,
`title` text,
`logged` tinyint(1) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

/*!40000 ALTER TABLE `generalchat_users` ENABLE KEYS */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;


-- MySQL dump 10.9
--
-- Host: db2.awardspace.com Database: johnnymushio_MB
-- ------------------------------------------------------
-- Server version 4.1.20-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `languagechat_messages`
--

DROP TABLE IF EXISTS `languagechat_messages`;
CREATE TABLE `languagechat_messages` (
`id` int(11) NOT NULL auto_increment,
`msg` text,
`user` int(11) default NULL,
`time` datetime default NULL,
`special` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Table structure for table `languagechat_users`
--

DROP TABLE IF EXISTS `languagechat_users`;
CREATE TABLE `languagechat_users` (
`id` int(11) NOT NULL auto_increment,
`handle` text,
`font` text,
`lastseen` datetime default NULL,
`title` text,
`logged` tinyint(1) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

/*!40000 ALTER TABLE `languagechat_users` ENABLE KEYS */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES

Johnnymushio
06-06-2006, 01:03 AM
and how do i put this into the color selection? i tried but it always says "error please fill in all fields."



<label>Font Color:
<select name="select">
<option value="#000000" selected><font color="#000000">Black</font></option>
<option value="#00ffff"><font color="#00ffff">Aqua</font></option>
<option value="#000fff"><font color="#000fff">Blue</font></option>
<option value="#ff00ff"><font color="#ff00ff">Fushsia</font></option>
<option value="#808080"><font color="#808080">Gray</font></option>
<option value="#008000"><font color="#008000">Green</font></option>
<option value="#00ff00"><font color="#00ff00">Lime</font></option>
<option value="#800000"><font color="#800000">Maroon</font></option>
<option value="#000080"><font color="#000080">Navy</font></option>
<option value="#808000"><font color="#808000">Olive</font></option>
<option value="#800080"><font color="#800080">Purple</font></option>
<option value="#ff0000"><font color="#ff0000">Red</font></option>
<option value="#c0c0c0"><font color="#c0c0c0c0">Silver</font></option>
<option value="#008080"><font color="#008080">Teal</font></option>
<option value="#ffff00"><font color="#ffff00">Yellow</font></option>
<option>Other</option>
</select>
</label>

Twey
06-06-2006, 11:46 AM
The SQL is fine. The problem, then, is probably that you haven't set the variables in the script to reflect your changes.

Oh, and you'll need to use some Javascript for that.

Johnnymushio
06-06-2006, 03:15 PM
how would i do that...?

Johnnymushio
06-10-2006, 12:41 AM
the chat has a log off problem, it will jsut log people off randomly two times.

and, the forum jump just sends the user to the home page most of the time, then logs the user off in both rooms even if the person wasnt in the other room.

Twey
06-10-2006, 12:57 PM
Still sounds to me as if you've set the tables wrongly.
Can you post the top bit of generalchat.php and languagechat.php here? Take your username and password out, of course.

Johnnymushio
06-10-2006, 03:37 PM
<?php
$dbname = "johnnymushio_MB";
$dbhost = "db2.awardspace.com";
$usertable = "generalchat_users";
$msgtable = "generalchat_messages";
$dbuser = "";
$dbpass = "";
$refreshdelay = "5000"; // milliseconds
$msglimit = 50;


<?php
$dbname = "johnnymushio_MB";
$dbhost = "db2.awardspace.com";
$usertable = "languagechat_users";
$msgtable = "languagechat_messages";
$dbuser = "";
$dbpass = "";
$refreshdelay = "5000"; // milliseconds
$msglimit = 50;

Twey
06-11-2006, 10:25 AM
Hm... that looks about right. I have no graphical display at the moment, so I can't check it, but if you post a link to a sample of the problem here, I'll have a look when I can.

Johnnymushio
06-11-2006, 04:41 PM
http://japantown.awardspace.com/generalchat.php?frames

For example, go to language chat, log in, then go to general chat using the forum jump. It will log you off in language chat, and general chat even though you never logged into general chat, then it will send you to the home page.

Another example, just chat for a few minutes and sometimes it will start going on a logging out spasm. Then once you log back in it will log you off two times.

Johnnymushio
06-14-2006, 10:26 PM
Umm.. any luck?

boxxertrumps
06-14-2006, 11:30 PM
<html>
<head>
<title>Japan Town - General Chat</title>
<?
if(!$chathandle) {
print_form();
exit;
};
$my_icon = "default.gif";
if(!$message && ($faceshow == $my_icon)) {
print_form_nameset();
exit;
.....................
</form><form method="post" action="$self_post"><input type="hidden" name="logout" value="true"><input type="hidden" name="chathandle" value="$chathandle"><input type="hidden" name="myfont" value="$myfont"><input type="submit" value="Log out"></form>
</font>
FORM2;
}
?>
</body>
</html>
it would all be veiwed like it was in <head></head> tags b/c there isnt a</head> closing tag. if your using that stuff as your code thats the immediate problem

Twey
06-15-2006, 02:56 PM
He's not any more.

Johnny: I will build a parallel environment for testing at some point. Be patient. :)

Johnnymushio
06-16-2006, 05:17 PM
I will list the problems & things I want changed of the chat room so you can fix them wehn you have the time... ^^

- Change chat's time to Japan Time

- if you go to DD's gradient image maker, i like the size and brightness of the color picker it has. can you make the current one like it? i wouldnt want a exact color option if the chats color picker would look like this, and even get the little cross cursor when the cursor goes over it.

- Remove IE horizontal scrollbar (if possible!)

- fix the forum jump/logging off problem.

- when the window is small, the top section text gets smushed together, i dont like it.

- i recently got rid of the users section because after a while it gets cluttered and pointless to see past users. i deleted as much code that incolved seeing this as i could, but seeing as how you created the code, you could find the rest of the offline and online users code. am i right in saying that the usertable is still required for the messages section?

- ummmm sore ga desu ne~

Johnnymushio
07-25-2006, 10:09 PM
i found something related to the logging off problem. i was in general chat and clicked on message board and clicked go and it took me there.

i then went to see language chat and it said i logged off in that too, even though i wasnt in it.:confused:

Twey
07-25-2006, 10:54 PM
I still haven't managed to reproduce this, even with up to five chats running simultaneously off the same database :-\

Johnnymushio
07-31-2006, 02:06 AM
do u wanna use the exact code i use?

Twey
07-31-2006, 02:20 AM
I think that would be helpful, yes.

Johnnymushio
07-31-2006, 09:32 PM
the 100th post!! :p

ima email u the code

Johnnymushio
04-17-2010, 03:24 PM
dusting off the site. there are two things i am curious of. one of those things being the chat room twey made for me.

http://japantown.awardspace.com/japanchat.php?frames

it appears http://japantown.awardspace.com/japanchat.php?messages

doesnt exist anymore, but thats odd since ?messages is contained within the chat room code itself.

its been years but, im curious why it would go away all of the sudden

i went to http://japantown.awardspace.com/japanchat.php

and logged in and typed some message. the mysql database shows that the message did indeed go through and post.

if i try to go to

http://japantown.awardspace.com/japanchat.php?messages,

404 error

why would ?messages go away, but ?header and ?users not 404? so odd.

djr33
04-17-2010, 05:09 PM
This and another post you just made show some weird issues with the host. Did you change hosts recently? Did your host change something? I am guessing that it's just the host changing so that the code no longer works.
For example, when I load your link, the host forwards me to an ad and doesn't let me view your website.

PHP is a lot like Javascript-- it doesn't always work the same way if you use it on different systems. This is a problem with Javascript (everyone using different browsers), but not really in PHP (it's always running from your server). The time this IS a problem is when you change/modify servers.* Then it's like running the code on a whole new computer and it may just not work for any number of reasons. It's probably possible to get it working, but based on the redirect to your host's ad, I think you have bigger problems to deal with first.

(*or, for the same reason, when you create a script to distribute to others to use, since their server may not be configured like yours.)

Johnnymushio
04-17-2010, 10:31 PM
When I spoke of a 404 page, that redirect ad is what I was referring to. Since this free hosting plan doesnt allow for custom 404 pages, it redirects to the hosts website when a page does not exist, in this case japanchat?messages

I didn't change host, It's always been this one, so I guess they changed something.

Also, long time no see. I remember you from years back. Also, what happened to twey? I see he mysteriously disappeared

djr33
04-17-2010, 10:35 PM
Yes, it looks like they changed something. It's really hard to diagnose something operating on the server without being able to access it. I'm not sure where to start. Considering the complexity (just that there's a lot going on) it might be easiest to hire someone and give them access to your account (FTP, etc) so that they can just fix it. Feel free to see if someone can help, but this is unfortunately difficult to describe and understand.

As for Twey, he's been gone for a while. I think he's just doing other things in real life. You could always send him a private message-- he seems to visit here very rarely, but he'll may see that and since he wrote this could fix it faster than someone else.