PHP Code:
<?php
include_once ("Script/Connect.php");
include_once (
"Script/check_log.php");


$id "";
if(!isset(
$_SESSION['ID'])){
    
header("location: index.php");
    exit();
}

else 
{
    
$id preg_replace('#[^0-9]#i'''$_GET['id']);
}


$price="";
$V=""//Global variable of view.
$sql1mysql_query("select * from TABLE where COLUMN ='$id'") OR die (mysql_error());

$count2=mysql_num_rows($sql1);

if(
$count2>0)
{
while (
$row=mysql_fetch_array($sql1))
    {
        
$id $row['ID'];
        
$name $row['Name'];
        
$price=$row['Price'];    
        
$spec$row['Description'];
        
$source "Folder/$id.jpg"//Where your images are stored in the folder.
        
$img '<a href="' $source.'" target="_blank"><img src="' $source '" width="260" border="1"/></a>';
         
$V '
        <table width="580" border="0" cellpadding="4" cellspacing="4">
            <tr>
                <td valign="top" width="250">' 
$img '</td>
                <td valign="top" width="330">
                <h2>' 
$name ' </h2>
                <br/>
                '
$spec '
                <br/>
                '
."<b>".  "Price: " "</b>"$price .  " . '
                    <br/>
                <br/>
        </tr>
        </table>';
    }

                }
else{
    header("
locationindex.php");
    exit();
    
}
To check if the user is logging or not
check_log.php
PHP Code:
<?php

$status 
0;
$msg_error "";
if(isset(
$_SESSION['ID'])){
    if(isset(
$_SESSION['Email'])){
        if(isset(
$_SESSION['Password'])){
            
$status 1;
        }
    }
}

?>