<?php
session_start();
include("stop.php");

include ("file.html");
?>
<table width='950' cellspacing='0' cellpadding='0' align='center'>
<?php
include ("right.html");
?>
<td width='760' valign='top' class='continut'>

<table cellspacing='0' cellpadding='10'  width='100%'>
<tr>
<td>
<!-- CONTINUTUL !!!! -->


<table align='right' width='230' cellspacing='0' cellpadding='3'><tr>
<tr>
<td>

<table width='100%' class='border' cellspacing='0'>

<?php
include('config.php');

if(isset($_SESSION['nume'])) {
      	$username = ''.$_SESSION['nume'].'';
$stare = "Post Message";
if(!$act){mysql_query("UPDATE utilizatori SET stare='$stare' WHERE nume='$username'");}
}
?>
<?

if(isset($_SESSION['nume'])) {
      	$userb = ''.$_SESSION['nume'].'';
 $getuser="SELECT * from utilizatori WHERE nume='$userb'";
  $getuser2=mysql_query($getuser) or die("COuld not draw cookies");
  $getuser3=mysql_fetch_array($getuser2);
  if(strlen($getuser3[nume])>1)
  {
    $_SESSION['user']=$getuser3[nume];        
if($getuser3[status]>=0)
    {
$file=$_GET['file'];
$ac=$_GET['ac'];
if($ac=="added")
{
if(!$act){
include("stop.php");
}
if(empty($_POST["uname"]))
{
print "Please complete the name!<br/>";
}
elseif($_POST["uname"] > $username && $_POST["uname"] < $username)
{
print "Please use your name!<br/>";
}
elseif(empty($_POST["mail"]))
{
print "Please complete the email!<br/>";
}
elseif(!isset($_COOKIE['file_'.$_GET['id']]))
{
print "Nu ai scris comentariu...<br/>";
}
elseif(empty($_POST["comment"]))
{
print "Please complete the comment!<br/>";
}
else{

$comment = htmlspecialchars($_POST["comment"], ENT_QUOTES);

 $insert = mysql_query("INSERT INTO comments SET uname='$userb', file='{$_GET['id']}', date='".time()."', comment='$comment', mail='".$_POST['mail']."'");
   if($insert){ 
print "Comentariu adaugat. Inapoi la <a href=\"file.php?id=".$_GET["id"]."\">Informatii fisier</a>.";
}
else{
print "Sorry,error.";}
}
}
echo "<br/><br/>";
?>
</td></tr></table></table></table>
</tr>

<tr>
<td width='180'>&nbsp;
</td>
<?
}}}
include ("flooter.html");
?>

</td>
</tr>
</table>
<body>
</html>