Page 1 of 2

Shoutbox @ vigge.net not working

Posted: Thu Feb 26, 2004 12:20 pm
by vigge89
After i developed my new outputting system @ http://www.vigge.net, the shoutbox on the right side of the page have stopped working for IE users.

THe shoutbox is designed to be included on a page, where, when it is, outputs a HTML-table with a shout-form, and under the form, an iframe which shows the latest shouts. when shouts are submitted by the shout-form, the form uses method POST with TARGET='shouts'. the shoutbox have worked before i changed the way the rest of the page is outputted, but before i show that code, i wanna know if I should change the submitting and design of the shoutbox.

Right now, what currently happens with IE-users when they submit a shout, is that the iframe reloads, but no shout is submitted, have a look at the code below, or visit http://www.vigge.net to check it yourselves.

Here's the code for shoutbox.php (form and iframe):

Code: Select all

<table class='content_tbl' border='1' align='center' cellspacing='2' width='200' cellpadding='1'>
<tr><td class='titlebar'>@shoutbox</td></tr>

<tr>
	<td><form name='shout' method='post' action='shoutbox.php' target='shouts'>
	<textarea name='shout_message' id='shout_message' cols='34' rows='3' maxlength='150' onKeyDown='textCounter(this.form.shout_message,this.form.lenght,150);' onKeyUp='textCounter(this.form.shout_message,this.form.lenght,150);'></textarea></td>
</tr>

<tr>
	<td>      <input type='submit' name='submit_shout' value='shout' onclick="javascript:clear_field(this.form.shout_message);">  <input readonly='readonly' type='text' name='lenght' size='2' maxlength='3' value='150'> chars left</form></td>
</tr>

<tr>
	<td valign='top'><iframe name='shouts' id='shouts' src='shoutbox.php' width='198' height='180' frameborder='0' scrolling='auto' allowtransparency='true'></iframe></td>
</tr>

<tr>
	<td> <a href='shoutbox.php' target='shouts' class='button'>refresh shouts</a> </td>
</tr>

</table>
Shouts.php (the iframe, handling of submissions etc.., BTW; i know the echo_sb_head() function is ugly and bad, its just temporary):

Code: Select all

<?php

require_once ('modules/top.php'); // require top-file

############### submit shout ###############
if (!empty ($_POST['shout_message'])) { //Shout

	if (!isSet($_SESSION['online']) || $_SESSION['online'] != true) { //Check if online
		exit(); // prevent logged out users to shout
	}

	if ($_POST['submit_shout'] != ""  && strlen($_POST['shout_message']) >= 6) {
		$shout = addslashes(nl2br(htmlentities($_POST['shout_message'])));
		$date = addslashes(date("H:i:s - D jS F Y"));
		$query = "INSERT INTO shoutbox (date, nick, msg) VALUES ('$date', '{$_SESSION['username']}', '$shout')";
		mysql_query($query);

		$_SESSION['status'] = "shouted";

	} else { $shout_msg = "Your shout must not contain less than 6 characters!"; }		
	

}
############### /submit shout ###############


############### delete shout ###############
if (isSet($_GET['del']) && !empty($_GET['del'])) { //Delete a shout

	//Load userlevel
	$sql = "SELECT level FROM keeper WHERE nick = '{$_SESSION['username']}'";
	$result = @mysql_fetch_row( @mysql_query($sql));
	if ($result[0] >= 4) { //Only allow user with level above or at 4

		$query4 = "DELETE FROM shoutbox WHERE id = {$_GET['del']}";
		mysql_query($query4);

	$shout_msg = "deleted shout (id: {$_GET['del']}).";

	}
}
############### /delete shout ###############


############### output shouts ###############

## header
echo_sb_head("shouts");

require ('modules/format_string.php'); // include format_string function

if (!empty ($shout_msg)) { #### output shout message if there are any
echo "
<tr>
	<td>
	$shout_msg
	</td>
</tr>
";
} ### /output shout message if there are any

$sql_shouts = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 20"; //Return 20 last shouts
$query_shouts = @mysql_query($sql_shouts);

while ($result_shouts = mysql_fetch_array ($query_shouts)) {
	$sql_shouts2 = "SELECT level FROM keeper WHERE nick = '{$result_shouts['nick']}'";
	$result_shouts2 = @mysql_fetch_array ( @mysql_query ($sql_shouts2));

	//Load userlevel
	$sql_shouts3 = "SELECT level FROM keeper WHERE nick = '{$_SESSION['username']}'";
	$result_shouts3 = @mysql_fetch_row( @mysql_query($sql_shouts3));
	if ($result_shouts3[0] >= 4) {
		$adminopt = " | <a href='shoutbox.php?show=shouts&del={$result_shouts['id']}' title='Delete shout'>x</a>";
	}

	echo "
	<tr><td>« ";
	if ($result_shouts2['level'] > 3) { $usr_prefix = '@'; } else { $usr_prefix = ''; }; // if user is admin, print out an @ infront of the name 
	echo "<a href='profile.php?user={$result_shouts['nick']}' target='_parent' title='shouted at ".stripslashes($result_shouts['date'])."'>$usr_prefix{$result_shouts['nick']}</a>";
	echo $adminopt;
	echo " »<br>" . format_string (stripslashes ($result_shouts['msg'])) . "<br /></td></tr>";
}

## footer
echo_sb_head("footer");

############### /output shouts ###############


############### output-functions ###############

function echo_sb_head($op = "normal") { //Function echo_sb_head

require_once ('modules/skin.php'); // require get_skin function file 
$usr_skin = get_skin ($_SESSION['username']);

if ($op == "footer") { //Echo footer

echo "
</table>
</BODY>
</HTML>";

} elseif ($op = "shouts") { //Echo shouts header

echo "
<HTML>
<HEAD>
<link rel='stylesheet' href='skins/{$usr_skin['file']}'>
</HEAD>
<BODY style='background-color:transparent'>
<table class='shouts' align='center' valign='top' cellspacing='0' cellpadding='3'>
";

} elseif ($op = "normal") { //Echo normal header

echo "
<HTML>
<HEAD>
<link rel='stylesheet' href='skins/{$usr_skin['file']}'>
</HEAD>
<BODY>
<table class='shouts' align='center' cellspacing='0' style='border: 0;'>
";

}

} //Function echo_sb_head

?>
Hope someone could help me solve this :? :cry:

Posted: Thu Feb 26, 2004 1:49 pm
by vigge89
Oh, btw, if you are gonna check out vigge.net (im not advertising the site or anything), you have to sign up, becuase the site is intended to be a web resource site, so everyone will have to signup. I have no intention to advertise the site or anything, but to see what happens, you have to login to gain acces to the site and shoutbox, becuase i haven't made it public (for non registrated users)...

I'm hoping that someone can help me out :?
Thanks in advance...

Posted: Thu Feb 26, 2004 4:03 pm
by John Cartwright
*cough cough advertissing* hehe

Posted: Fri Feb 27, 2004 9:37 am
by vigge89
did you notice my 2nd post? :P

but, if noone could solve this, could you give me an idea on how to redesign it, or check if it works in your borwser (if you do, please tell me which browser you are using)?

Posted: Fri Feb 27, 2004 12:25 pm
by ol4pr0
Couldnt you just make a tmp login ( test / test ;-) )

That would be a idea

Posted: Fri Feb 27, 2004 1:38 pm
by vigge89
oh, right, ill do it right away :D

done, username: test, pass: test

Posted: Fri Feb 27, 2004 3:41 pm
by ol4pr0
vigge89 wrote: After i developed my new outputting system @ http://www.vigge.net, the shoutbox on the right side of the page have stopped working for IE users.
if that was in youre worried mind.. i can tell you that i have just visited youre page with IE and NETSCAPE. and it came up empty anyway couldnt make a entry either way

So i guess its not a IE issue.


not that it will mather alot however is there some reason why you do this

Code: Select all

if (isSet(

// instead of 

if (isset(

Posted: Fri Feb 27, 2004 3:43 pm
by vigge89
hmmm, it appears to work in firefox (for me atleast)

I really dont know why i use isSet instead of isset, maybe cuz isset looks like 1 word :P

Posted: Fri Feb 27, 2004 3:44 pm
by ol4pr0
Also if i am not mistaken you can not use sessions and cookies if a page is loaded within a iframe

However if somebody knows more about that than me..

Please correct me wrong :-)

Posted: Fri Feb 27, 2004 3:45 pm
by vigge89
it have worked before, so I think you can do that...

Posted: Fri Feb 27, 2004 3:48 pm
by ol4pr0
Its cause did it with a login page before....

i couldnt get it to call the password and have a link added to change it.

Posted: Fri Feb 27, 2004 3:51 pm
by Illusionist
it have worked before...
is english your first language?

Posted: Fri Feb 27, 2004 3:54 pm
by Illusionist
deosn't seem to work for me in firefox... ill try IE

[edit] Nope, doesn't work in IE either

Posted: Fri Feb 27, 2004 3:57 pm
by Illusionist
you might want to echo out your insert $query and amke sure it looks right... Because it doesn't look like its adding anything to the Database

Posted: Fri Feb 27, 2004 4:04 pm
by vigge89
Illusionist wrote:
it have worked before...
is english your first language?
1st reply: nope, i live in sweden so it's swedish...

2nd reply: strange, it's something with my browser which makes it work :?

3rd reply: the strange thing is that it doesn't send any output at all, which it should do... :? :cry: