Location: PHPKode > projects > All in one guestbook-shoutbox-chatroom > all-in-one-guestbook-shoutbox-chatroom/commentlist.php
<html>
<head>
<title> Comments Listing </title>
<noscript>
<!-- This section sets the refresh. This is a 'silent' refresh, no annoying IE 'tick' sound, and ensures that the browsers cached version is not used...

	We have the "refresh" meta-tag in case the user's browser does
	not correctly support JavaScript or has JavaScript disabled.

	Notice that this is nested within a "noscript" block.
-->
<meta http-equiv="refresh" content="20">

</noscript>

<script language="JavaScript">
<!--

var sURL = unescape(window.location.pathname);

function doLoad()
{
	
	// the timeout value should be the same as in the "refresh" meta-tag
	setTimeout( "refresh()", 20*1000 );
}

function refresh()
{
	//	This version of the refresh function will cause a new
	//	entry in the visitor's history.  It is provided for
	//	those browsers that only support JavaScript 1.0.
	//
	window.location.href = sURL;
}
//-->
</script>

<script language="JavaScript1.1">
<!--
function refresh()
{
	//	This version does NOT cause an entry in the browser's
	//	page view history.  Most browsers will always retrieve
	//	the document from the web-server whether it is already
	//	in the browsers page-cache or not.
	//	
	window.location.replace( sURL );
}
//-->
</script>

<script language="JavaScript1.2">
<!--
function refresh()
{
	//	This version of the refresh function will be invoked
	//	for browsers that support JavaScript version 1.2
	//
	
	//	The argument to the location.reload function determines
	//	if the browser should retrieve the document from the
	//	web-server.  In our example all we need to do is cause
	//	the JavaScript block in the document body to be
	//	re-evaluated.  If we needed to pull the document from
	//	the web-server again (such as where the document contents
	//	change dynamically) we would pass the argument as 'true'.
	//	
	window.location.reload( true );
}
//-->
</script>

<style type="text/css">
<!--
table {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	background-color: #CCCCCC;
	margin-top: 1px;
	width: 100%;
	padding-left: 8px;
}

h1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	color: #0066FF;
	font-style: italic;
	font-weight: normal;
	margin-top: 1px;
	
	
}

h2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
	color: #CCCCCC;
	background-color: #3333aa;
	text-align: center;
	padding: 0px;
	margin: 0px;
}
a:link {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
	color: #ffCCCC;
	background-color: #ff6666;
	text-align: center;
	width: 100%;
	background-position: center;
	text-decoration: none;
}
a:visited {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
	color: #ffCCCC;
	background-color: #666666;
	text-align: center;
	width: 100%;
	background-position: center;
	text-decoration: none;
}
a:active {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
	color: #ffCCCC;
	background-color: #66ff66;
	text-align: center;
	width: 100%;
	background-position: center;
	text-decoration: none;
}
a:hover {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
	color: #00FF00;
	background-color: #66ff66;
	background-position: center;
	text-align: center;
	width: 100%;
	text-decoration: none;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="336666" onload="doLoad()">

<?php
include("comments.inc.php");
// Connect to the database server
if (!$dbcnx)  {
die( '<p>Unable to connect to the database server at this time.</p>' );
}
// Select the comments database
if (! @mysql_select_db($dbname) ) {
die( '<p>Unable to locate the comments database at this time.</p>' );
}
// Request the text of all the comments
$result = @mysql_query('SELECT name, comment, date, ip FROM comments  order by date desc limit 50'); 
if (!$result) {
die('<p>Error performing query: ' . mysql_error() . '</p>');
}
// Display the text of each comment in a table
while ( $row = mysql_fetch_array($result) ) {
  	$name = htmlspecialchars($row['name']);
  	$comment = htmlspecialchars($row['comment']);
 // If the comment is from the site owner
  	if ($name == "$admin_name") {
	$name = "$display_name";
  	echo('<table><tr><td title = "' . $row['date']  . ' ' . $row['ip'] . '"><font color = "#cc0000">' . $display_name . ':: </font>' . $comment . '</td></tr></table>') ;
	}
	else {
//If the comment is froma  visitor  	
    echo('<table><tr><td title = "' . $row['date']  . ' ' . $row['ip'] . '"><font color = "#0066FF">' . '<IMG SRC="http://www.hostip.info/api/flag.GIF?ip=' . $row['ip'] . ' " width=18 height =10>' . ' ' .$name . ':: </font>' . $comment . '</td></tr></table>') ;
}
}
?>
</body>
</html>

Return current item: All in one guestbook-shoutbox-chatroom