<?php session_start(); ?>
<?php
include("stop.php");
?>
<?php
include("config.php");
?>
<html>
<?php
include ("header.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 !!!! -->
<?php
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)
    {
$id = $_GET["id"];

$act=$_GET['act'];
if($act=="abuse")
{
$motiv = $_POST["motiv"];
$reclamant = $_POST["userok"];
$security = $_POST["security"];

if(!$act){
include("stop.php");
}
if(empty($_POST["motiv"]))
{
print "Please complete the motive!<br/>";
}
elseif($security<15)
{
print "Wrong result!<br/>";
}
else{
$insert = mysql_query("UPDATE fisiere SET abuse='1' , motiv='$motiv' , reclamant='$reclamant' WHERE id='$id' "); 

if($insert){ 
print "File was marched abuse. Go back to <a href=\"file.php?id=".$_GET["id"]."\">Info file</a>.";
}
else{
print "Sorry,error.";}
}
}

echo "<div class='hl'>Report</div>
 <div class='txt'>
</div>
<br/>";

$sql = mysql_query("SELECT * FROM fisiere WHERE id = '$id' ");

while($row = mysql_fetch_array($sql))
{
$stare = $row["abuse"];
$motivbad = $row["motiv"];
$userbad = $row["reclamant"];
}

if($stare=="0")
{
print "<form action=\"report.php?id=$id&amp;act=abuse\" method=\"POST\">";
print "<input type=\"hidden\" name=\"userok\" value='$userb'><br>";
echo "<b>Motive:</b><br/><textarea name=\"motiv\" cols='20' rows='6'  maxlength='240'></textarea><br/>";
print "<b>Calculate: 10+5=</b><input type=\"text\" name=\"security\"><br>";
print "<input type=\"submit\" name=\"submit\" value=\"Report\">";
print "</form>";
}else{
echo "File raported!</br>";
echo "Raportat by: $userbad</br>";
echo "Motive: $motivbad</br>";
}}}}
?>
<!-- SFARSIT CONTINUT!!! -->      <center>
</center>


</td></tr></table>
</tr>

<tr>
<td width='180'>&nbsp;
</td>

<?php
include ("flooter.html");
?>