<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com  2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";

if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if(isset( $_SESSION["sess_userid"]) && $_SESSION["sess_userid"]!="")
{
	$userid = $_SESSION["sess_userid"];
}

if($begin == "")
{
        $begin=0;
        $num=1;
        $numBegin=1;
}

$pid=($_GET['pid']!='')?$_GET['pid']:$_POST['pid'];

$sql=" SELECT r.*,u.user_name,u.first_name,u.last_name,p.product_name FROM ".$tableprefix."Review r LEFT JOIN ".$tableprefix."users u ON r.nUserId=u.user_id 
					LEFT JOIN ".$tableprefix."products p ON r.nProdId=p.product_id WHERE r.nProdId='".$pid."' AND r.vActive='1'";
					
$sess_back= $_SERVER["PHP_SELF"] . "?begin=" . $begin . "&num=" . $num . "&numBegin=" . $numBegin . "&cmbSearchType=" . $cmbSearchType . "&txtSearch=" . $txtSearch;
$_SESSION["gbackurl"] = $sess_back;

$totalrows = mysql_num_rows(mysql_query($sql));

$navigate = pageBrowser($totalrows,10,10,"&pid=".addslashes($pid)."&cmbSearchType=$cmbSearchType&txtSearch=$txtSearch",$_GET[numBegin],$_GET[start],$_GET[begin],$_GET[num]);
$sql = $sql.$navigate[0];
$rs = mysql_query($sql);

/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

?>
<!--mainbody area start -->
<div class="main_body">
	<div class="container">
		<div class="row">
		<!--center content area start-->		
		
		<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" name="frmReview">
			<input type="hidden" name="pid" value="<?php echo $pid;?>" >
			
			
		<div class="col-sm-12 col-lg-12 col-md-12 " id="item_details">
	
		<!--items display area start -->
	
		<div align="left" id="items_top_area">
				<div align="left" id="items_top_area_ttl"><?php echo REVIEW_ABOUT_TEXT;?> <?php echo stripslashes($_GET['pname']);?></div>
		</div>
		
		<div class="text_information" align="center"><?php echo $message?></div>
		
		<div class="prodetails_topsection">	
			
																										
			<table width="100%"  border="0" cellpadding="0" cellspacing="0"  align="center">
				<tr>
					<td >
						<table width="100%" class="prodetails_topsection" cellpadding="2" cellspacing="2" border=0>
							<tr><td>&nbsp;</td><td colspan="2" align="center"></td></tr>
							<?php
							$i=1;
							while($row  = mysql_fetch_array($rs))
							{
							?>
							<tr>
								<td width='5%' valign='top' class='message'>#<?php echo $i;?></td>
								<td colspan=2 align='left' valign="top"><div align='left' class='innertext' style='word-break:break-all;'>			
								<?php echo nl2br(stripslashes($row["vDes"]));?></div></td>
							</tr>
							<tr  class="prdetails_productprice">
								<td width='5%' valign='top'>&nbsp;</td>
								<td align='left' colspan=2> <?php echo POSTED_BY_TEXT;?> <span class='sellername'><?php echo ($row["first_name"]);?> &nbsp;<?php echo ($row["last_name"]);?></span></td>
							</tr>
							<tr>
								<td width='100%' colspan=3>&nbsp;</td>
							</tr>
							<?php
								$i++;
							}
							?>
							<tr><td colspan=3 align='center'>&nbsp;</td></tr>
							<tr><td colspan=3 align='center'><?php echo($navigate[2]); ?></td></tr>
						</table>
					</td>
				</tr>
				
				<tr>
					<td align="center"><input type="button" class="button" value="<?php echo BACK_TO_PRODUCT_DETAILS_BUTTON;?>" onClick="window.location.href='productdetails.php?productid=<?php echo $pid;?>';" ></td>
				</tr>
			</table>
						
			
			<div class="clear"></div>
		</div>	
	
	
		<div align="left" class="float_clear1"></div>
					
					
		 <!--items display area end -->
		  </div>
		
		</form>
		<!--center content area end-->	
	</div>
	</div>
</div>
<!--mainbody area end -->



<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>