<html>
<head>
<meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
<title>
EZ Shopper - Enlarged Product Image
</title>
<body bgcolor = #FFFFFF>
<?php
$pic = getenv("QUERY_STRING");
$lgt = strlen($pic);
$stp = $lgt - 4;
$pics = substr($pic,0,$stp);
$ext = substr($pic,$stp,$lgt);
$npic = $pics;
$npic.= "-big";
$npic.= $ext;

if (@fopen($npic,"r") != NULL)
{
echo "<center><img src=images/searchs1.gif border=0><font face=verdana size=3 color=navy> PRODUCT INFORMATION</font></center>";
	echo "<center><b>Enlarged Image:</b><br><hr><img src = $npic></center>";
}
else
{
echo "<center><img src=images/searchs1.gif border=0><font face=verdana size=3 color=navy> PRODUCT INFORMATION</font></center><br>";
	echo "<center><b>Enlarged Image:-</b><br><img src= ./images/nopic.jpg><br><font color = #000077>There is no enlarged image for this product...</font><img src=images/line.gif border=0 width=450 height=1></center>";

}
echo "<br><center><a href = javascript:window.close('acePopup')>Close Window</a></center><br>";
include ("./config.php");
include ("./tests.php");

############## display a random product ################

$table = "products";
$conn = @mysql_connect($server,$user,$password)
	or die("Unable to connect to SQL database...");
$rs = @mysql_select_db($database,$conn) 
	or die("Unable to select the database 'mydata'...Please press 'Create Database' to create new database.");

$sql = "SELECT * from $table";
$products = mysql_query($sql,$conn);
$prods = mysql_num_rows($products);

$items = array();
$count = 1;

while ($row = mysql_fetch_array($products))
{
	$items[$count] = $row["pid"];
	$count += 1;
}
srand(microtime() * 1000000);
$num = rand(1,$prods);
if ($num == 0) $num = 1;
$sqls = "SELECT * from $table where pid = $items[$num]";
$details = mysql_query($sqls,$conn);

while ($rows = mysql_fetch_array($details))
{
	$pid = $rows["pid"];
	$pitem = $rows["pitem"];
	$pdes = $rows["pdes"];
}
######## display box ########
echo "<center><table width=450 border=1 cellspacing=0 cellpadding=0 height=150>
<tr><td width=450 bgcolor=#CCCCCC height=10>$header</td></tr>
<tr><td width=450 bgcolor=#FFFFFF height=140>";
echo "<br><center>We recommend the following product item:-</center>";
echo "<br>Product Item ID:	$pid";
echo "<br>Product Item   :    $pitem";
echo "<br>Product Description: $pdes";
echo "</tr></table></center>";

?>
</body>
</html>