<?php
/*
* @author Istvan Franko
* @copyright 2014
*/

session_start();
if (isset($_SESSION['adminlogin'])){
	//user in logen in. Show a message on the screen
} else {
	//redirect the user to the login form.
	session_destroy();
	header('Location: index.php');
}
?>

<html>

<head>
<title>Natty Notebooks Inc.</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>

<body>

<div id="container">

<div id="header">
	<! header picture in css >
</div>
	
<div id="navigation">
	<?php include 'admin-nav-bar.php'; ?>
</div>
	
<div id="aside">
	<!--Links for navigation-->
	<a href="admin.php"><p style="text-align:center">Back to list</a></p>	
	
	<fieldset style="width:85%"><legend>HELP</legend>
	<p>The capabilities of this item can be found here.</p> 
	</fieldset><br>
</div>

<div id="content">

<br>
<fieldset style="width:95%"><legend>DETAILS</legend>
	
<?php

$con = mysql_connect("localhost","*****","*****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("university", $con);

//get the ID from the query string.
$id=$_GET['id']; 

if(!is_numeric($id))
{ //check is a number.
echo "Sorry, there appears to have been an error.";
exit;
}

$query=Mysql_query("SELECT * FROM natty WHERE ItemID=$id ");
$row=mysql_fetch_object($query);
echo mysql_error();

$ItemAvailableNum = $row->ItemAvailable;
$ItemSpecialOfferNum = $row->ItemSpecialOffer;

if ($ItemAvailableNum == 1)
{$ItemAvailable = "Yes";}
else
{$ItemAvailable = "No";}

if ($ItemSpecialOfferNum == 1)
{$ItemSpecialOffer = "Yes";}
else
{$ItemSpecialOffer = "No";}



//display the film record in a html table

echo"<table border='1'>";
echo "
<tr bgcolor='#e1e0e0'><td width='150'><b>ID:</b></td><td width='400'> $row->ItemID </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Item name:</b></td><td width='400'> $row->ItemName </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Item available:</b></td><td width='400'> ";
echo $ItemAvailable;
echo " </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Special Offer:</b></td><td width='400'> ";
echo $ItemSpecialOffer;
echo " </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Item in Mbro:</b></td><td width='400'> $row->ItemInMbro </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Item in Stoskton:</b></td><td width='400'> $row->ItemInStockton </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Price:</b></td><td width='400'> &#163;$row->ItemPrice </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Category:</b></td><td width='400'> $row->ItemCategory </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Brand:</b></td><td width='400'>$row->ItemBrand </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Model Number:</b></td><td width='400'>$row->ItemModelNum </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Operation System:</b></td><td width='400'> $row->ItemOpSys </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>CPU:</b></td><td width='400'>$row->ItemCpu </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Memory:</b></td><td width='400'> $row->ItemMem </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>HDD Size:</b></td><td width='400'>$row->ItemHdd </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Screen size:</b></td><td width='400'> $row->ItemScreenSize </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Short Description:</b></td><td width='400'>$row->ItemShortDesc </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Description:</b></td><td width='400'> $row->ItemDesc </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Picture1:</b></td><td width='400'>$row->ItemPicture1 </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Picture2:</b></td><td width='400'>$row->ItemPicture2 </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Picture3:</b></td><td width='400'>$row->ItemPicture3 </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Picture4:</b></td><td width='400'>$row->ItemPicture4 </td></tr>
<tr bgcolor='#f7f7f7'><td width='150'><b>Picture5:</b></td><td width='400'>$row->ItemPicture5 </td></tr>
<tr bgcolor='#e1e0e0'><td width='150'><b>Official URL:</b></td><td width='450'>
<a href='$row->ItemOfficialUrl'</a>$row->ItemOfficialUrl </td></tr>
";
echo "</table>";
?>

</fieldset>
</div>

<div id="footer">
<p align="center">Copyright &#169; Istvan Franko, 2014</p>
</div>


</div>

</body>
</html>
