<?php require_once('Connections/JCH_Sql.php'); ?>
<?php
$maxRows_rSGuestbook = 10;
$pageNum_rSGuestbook = 0;
if (isset($_GET['pageNum_rSGuestbook'])) {
  $pageNum_rSGuestbook = $_GET['pageNum_rSGuestbook'];
}
$startRow_rSGuestbook = $pageNum_rSGuestbook * $maxRows_rSGuestbook;

$colname_rSGuestbook = "-1";
if (isset($_GET['BandName'])) {
  $colname_rSGuestbook = (get_magic_quotes_gpc()) ? $_GET['BandName'] : addslashes($_GET['BandName']);
}
mysql_select_db($database_JCH_Sql, $JCH_Sql);
$query_rSGuestbook = sprintf("SELECT * FROM Guestbook WHERE band = '%s' AND YesNo = '1' ORDER BY Id DESC", $colname_rSGuestbook);
$query_limit_rSGuestbook = sprintf("%s LIMIT %d, %d", $query_rSGuestbook, $startRow_rSGuestbook, $maxRows_rSGuestbook);
$rSGuestbook = mysql_query($query_limit_rSGuestbook, $JCH_Sql) or die(mysql_error());
$row_rSGuestbook = mysql_fetch_assoc($rSGuestbook);

if (isset($_GET['totalRows_rSGuestbook'])) {
  $totalRows_rSGuestbook = $_GET['totalRows_rSGuestbook'];
} else {
  $all_rSGuestbook = mysql_query($query_rSGuestbook);
  $totalRows_rSGuestbook = mysql_num_rows($all_rSGuestbook);
}
$totalPages_rSGuestbook = ceil($totalRows_rSGuestbook/$maxRows_rSGuestbook)-1;

$colname_RSPhoto = "-1";
if (isset($_GET['BandName'])) {
  $colname_RSPhoto = (get_magic_quotes_gpc()) ? $_GET['BandName'] : addslashes($_GET['BandName']);
}
mysql_select_db($database_JCH_Sql, $JCH_Sql);
$query_RSPhoto = sprintf("SELECT * FROM Band_List WHERE URL_Safe_Name = '%s'", $colname_RSPhoto);
$RSPhoto = mysql_query($query_RSPhoto, $JCH_Sql) or die(mysql_error());
$row_RSPhoto = mysql_fetch_assoc($RSPhoto);
$totalRows_RSPhoto = mysql_num_rows($RSPhoto);

$maxRows_GuestBookReview = 1;
$pageNum_GuestBookReview = 0;
if (isset($_GET['pageNum_GuestBookReview'])) {
  $pageNum_GuestBookReview = $_GET['pageNum_GuestBookReview'];
}
$startRow_GuestBookReview = $pageNum_GuestBookReview * $maxRows_GuestBookReview;

$colname_GuestBookReview = "-1";
if (isset($_GET['BandName'])) {
  $colname_GuestBookReview = (get_magic_quotes_gpc()) ? $_GET['BandName'] : addslashes($_GET['BandName']);
}
mysql_select_db($database_JCH_Sql, $JCH_Sql);
$query_GuestBookReview = sprintf("SELECT * FROM Guestbook WHERE band = '%s' AND YesNo = '0' ORDER BY datetime DESC", $colname_GuestBookReview);
$query_limit_GuestBookReview = sprintf("%s LIMIT %d, %d", $query_GuestBookReview, $startRow_GuestBookReview, $maxRows_GuestBookReview);
$GuestBookReview = mysql_query($query_limit_GuestBookReview, $JCH_Sql) or die(mysql_error());
$row_GuestBookReview = mysql_fetch_assoc($GuestBookReview);

if (isset($_GET['totalRows_GuestBookReview'])) {
  $totalRows_GuestBookReview = $_GET['totalRows_GuestBookReview'];
} else {
  $all_GuestBookReview = mysql_query($query_GuestBookReview);
  $totalRows_GuestBookReview = mysql_num_rows($all_GuestBookReview);
}
$totalPages_GuestBookReview = ceil($totalRows_GuestBookReview/$maxRows_GuestBookReview)-1;
?>
<html>
<head>
<link href="Images/style.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
	background-image: url(Images/bg.gif);
}
.style1 {font-size: 14}
.style2 {font-size: 14px}
-->
</style><title>J C H O N L I N E | View Guestbook</title><BODY>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="800" height="150">
      <param name="movie" value="Images/extras/banner2.swf">
      <param name="quality" value="high">
      <embed src="Images/extras/banner2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="800" height="150"></embed>
    </object></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
      <tr>
        <td colspan="4" class="SmallTitle style1"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="center"><img src="<?php echo $row_RSPhoto['Photo_Thum']; ?>" align="absmiddle"></td>
          </tr>
          <tr>
            <td align="center" class="Header1">Guestbook for <?php echo $row_RSPhoto['Band_Name']; ?></td>
          </tr>
          <tr>
            <td align="center" class="default"><?php echo $totalRows_GuestBookReview ?> records pending, Showing 
  <?php echo $totalRows_rSGuestbook ?> records.</td>
          </tr>
          <tr>
            <td align="center" class="default">&nbsp;</td>
          </tr>
        </table>          </td>
        </tr>
      <?php do { ?>
      <tr>
        <td width="205" bgcolor="#CCCCCC"><span class="default"><strong>Name : </strong></span><span class="default"> <?php echo $row_rSGuestbook['name']; ?></span></td>
        <td width="224" bgcolor="#CCCCCC"><span class="default"><strong>E-mail : </strong></span><span class="default"> <?php echo $row_rSGuestbook['email']; ?></span></td>
        <td width="69" bgcolor="#CCCCCC">&nbsp;</td>
        <td width="286" bgcolor="#CCCCCC"><span class="default"><strong>Date &amp; time:</strong></span><span class="default"> <?php echo $row_rSGuestbook['datetime']; ?></span></td>
      </tr>
      <tr>
        <td colspan="4"><span class="default"><strong>Comments:</strong></span></td>
        </tr>
      <tr>
        <td colspan="4" class="default"><?php echo $row_rSGuestbook['comment']; ?></td>
      </tr>
      <tr>
        <td colspan="4" class="default">&nbsp;</td>
      </tr>
      <?php } while ($row_rSGuestbook = mysql_fetch_assoc($rSGuestbook)); ?>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center" bgcolor="#000000"><span class="footer">| &copy; Copyright   1998 - 2006 John Chacko Holdings Sdn. Bhd. | Last Updated on
        <!-- #BeginDate format:Am1m -->October 31, 2006  10:36<!-- #EndDate -->
|</span></td>
  </tr>
</table>
</BODY>
</head>
<?php
mysql_free_result($GuestBookReview);

mysql_free_result($rSGuestbook);
?>
