All pastes #226525 Raw Edit

Unnamed

public text v1 · immutable
#226525 ·published 2006-10-28 16:14 UTC
rendered paste body
<? 
//This page displays the details for a particular product.
 
if (is_numeric ($_GET['pid'])) {//Make sure there's a product ID.
 
require_once ('mysql_connect.php'); //Connect to the database.
$query = "SELECT * FROM products WHERE products.pid = ".$_GET['pid'];
$result = mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_ASSOC);
mysql_close(); //Close the database connection.
 
//Set the page title and include the HTML header.
$page_title = $row['name'];
include_once ('includes/header.php');
 
//Display a header.
echo "<div align=\"center\">
<b>".$row['name']."</b>
<br />".$row['size']."
<br />\£".$row['price']."
<a href=\"add_cart.php?pid=".$row['pid']."\">Add to Cart</a>
</div><br />";
 
//Get the image information and display the image.
if ($image = @getimagesize ("images/".$row['image_name'])) {
echo "<div align=\"center\"><img src=\"images/".$row['image_name']."\" $image[3]
alt=\"".$row['name']."\" />";
 
} else {
echo "<div align=\"center\">No image available.";
}
echo '<br />' . 
stripslashes($row['description']) .
'</div>';
 
include_once ('includes/footer.php');
//Require the HTML footer.
 
} else {
header ("Location: http://" .
$_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) .
"/home2.php");
exit();
}
 ?>