<?php session_start();


//print_r($HTTP_SERVER_VARS['REQUEST_URI']);
$id_tot=explode("_",$_SERVER['REQUEST_URI']);
$id1=$id_tot['1'];
$id=substr($id1,0,strlen($id1)-5);

include('config.php');
include ("var.php");
include("stop.php");


$mobile = "xhtml/file.php?id=$id";
$text = $_SERVER['HTTP_USER_AGENT'];
$var[2] = "AvantGo";
$var[3] = "ProxiNet";
$var[4] = "Danger hiptop 1.0";
$var[5] = "DoCoMo/";
$var[6] = "Google CHTML Proxy/";
$var[7] = "UP.Browser/";
$var[8] = "SEMC-Browser/";
$var[9] = "J-PHONE/";
$var[10] = "PDXGW/";
$var[11] = "ASTEL/";
$var[13] = "Handspring";
$var[14] = "Windows CE";
$var[15] = "PPC";
$var[17] = "Blazer/";
$var[18] = "Palm";
$var[19] = "WebPro/";
$var[20] = "EPOC32-WTL/";
$var[21] = "Tungsten";
$var[22] = "Netfront/";
$var[23] = "Mobile Content Viewer/";
$var[24] = "PDA";
$var[25] = "MMP/2.0";
$var[26] = "Embedix/";
$var[27] = "Qtopia/";
$var[28] = "Xiino/";
$var[29] = "BlackBerry";
$var[30] = "Gecko/20031007";
$var[31] = "MOT-";
$var[32] = "UP.Link/";
$var[33] = "Smartphone";
$var[34] = "portalmmm/";
$var[35] = "Nokia";
$var[36] = "Symbian";
$var[37] = "AppleWebKit/413";
$var[38] = "UPG1 UP/";
$var[39] = "RegKing";
$var[40] = "STNC-WTL/";
$var[41] = "J2ME";
$var[42] = "Opera Mini/";
$var[43] = "SEC-";
$var[44] = "ReqwirelessWeb/";
$var[45] = "AU-MIC/";
$var[46] = "Sharp";
$var[47] = "SIE-";
$var[48] = "SonyEricsson";
$var[49] = "Elaine/";
$var[50] = "SAMSUNG-";
$var[51] = "Panasonic";
$var[52] = "Siemens";
$var[53] = "Sony";
$var[54] = "Verizon";
$var[55] = "Cingular";
$var[56] = "Sprint";
$var[57] = "AT&T";
$var[58] = "Nextel";
$var[59] = "Pocket PC";
$var[60] = "T-Mobile";
$var[61] = "Orange";
$var[62] = "Casio";
$var[63] = "HTC";
$var[64] = "Motorola";
$var[65] = "Samsung";
$var[66] = "NEC";
$var[67] = "LG";

$result = count($var);

for ($i=0;$i<$result;$i++)
{
$ausg = stristr($text, $var[$i]);
if(strlen($ausg)>0)
{
header("location: $mobile");
break;
}

}
?>
<?
include ("config.php");
session_start();

echo "<link href='style_c.css' rel='stylesheet' type='text/css' />";

include ("file.html");

echo "<table width='950' cellspacing='0' cellpadding='0' align='center'>";

include ("right.html");
$getid=$_GET['id'];
echo "<td width='760' valign='top' class='continut'>

<table cellspacing='0' cellpadding='10'  width='100%'>
<tr>
<td>";
?>
<!-- CONTINUTUL !!!! -->
<?
include('config.php');
echo "<head>\n";
$getid = $id;
$act=$_GET['act'];
echo "</head>\n";

$sql = mysql_query("SELECT * FROM fisiere WHERE id = '$id' ");
while($row = mysql_fetch_array($sql))
{
$filename = $row['file'];
$numefisier = $filename;
$user = $row['user'];
$pass = $row['pass'];
$desc = $row['description'];
$sz = $row['size'];
$id = $row['id'];
$ftype = $row['ftype'];
$banned = $row['banned'];
$dload = $row['download'];
$views = $row['view']+1;
$abuse = $row['abuse']+1;
$cat = $row['categorie'];
$cat = $row['categorie'];
$Browser = $row['browse'];
$ip = $row['ip'];
$uploaded = $row['uploaded'];
$lastaccess = $row['lastaccess'];


if(isset($_SESSION['nume'])) {
      	$usernames = ''.$_SESSION['nume'].'';
$stare = "View File $filename";
if(!$act){mysql_query("UPDATE utilizatori SET stare='$stare' WHERE nume='$usernames'");}
}

$numefisier=str_replace("_"," ",$numefisier);
$numefisier=str_replace("."," ",$numefisier);


echo "<table align='right' width='230' cellspacing='0' cellpadding='3'><tr>
<tr>
<td>
<table width='100%' class='border' cellspacing='0'>
<tr>
<td class='hl'>
<b>Toolbox</b>
</td>
</tr>
<tr>
<td valign='middle' align='center' bgcolor='white'> ";
if($ftype=="mp3"){
echo "<a href='javascript:playMedia()'><img src='interfata/tools/play.gif' align='absmiddle' title='Play media'/></a> &nbsp;";
}
echo "<a href='dlfile.php?id=$id'><img src='interfata/tools/dl.gif' align='absmiddle' title='Download file' /></a> &nbsp;";

       if(isset($_SESSION['nume'])) {
      	$userb = ''.$_SESSION['nume'].'';
 $getusers="SELECT * from utilizatori WHERE nume='$userb'";
  $getusers2=mysql_query($getusers) or die("COuld not draw cookies");
  $getusers3=mysql_fetch_array($getusers2);
  if(strlen($getusers3[nume])>1)
  {
$uidnew = $getusers3["id"];
}  
$sql = mysql_query("SELECT * FROM favorite WHERE id");
while($row = mysql_fetch_array($sql))
{
$fisierid = $row["fid"];
$userids = $row["uid"];
}
if($fisierid=="$getid" && $userids = $uidnew){ 
echo "<a href='file.php?id=$id&act=delfav'><img src='interfata/tools/star.gif' align='absmiddle' title='Delete from favorite (logged only)'  /></a> &nbsp;";    
}else{
echo "<a href='file.php?id=$id&act=fav'><img src='interfata/tools/star.gif' align='absmiddle' title='Add to favorite (logged only)'  class='transparency' /></a> &nbsp;";  
}}
echo "<a href='http://www.google.com/search?q=$numefisier'><img src='interfata/tools/google.gif' align='absmiddle' title='Google this file!' /></a> &nbsp;

<a href='report.php?id=$id'><img src='interfata/tools/report.gif' align='absmiddle' title='Report abuse/bad file' /></a><br/>
<blablahr width='76%' size='1' color='#7BA2DE' noshade />
<div class='rated_text'>Rated <span id='outOfFive_460020' class='out5Class'>0</span>/5 (<span id='percentage_460020' class='percentClass'>0%</span>) (<span id='showvotes_460020' class='votesClass'>0 Votes</span>)</div>
			<ul class='star-rating' id='rater_460020'>
				<li class='current-rating' style='width:0%;' id='ul_460020'></li>
				<li><a onclick=\"rate('1','460020',true,true,true); return false;\" href=\"#\" title=\"1 star out of 5\" class=\"one-star\" >1</a></li>
				<li><a onclick=\"rate('2','460020',true,true,true); return false;\" href=\"#\" title=\"2 stars out of 5\" class=\"two-stars\">2</a></li>
				<li><a onclick=\"rate('3','460020',true,true,true); return false;\" href=\"#\" title=\"3 stars out of 5\" class=\"three-stars\">3</a></li>
				<li><a onclick=\"rate('4','460020',true,true,true); return false;\" href=\"#\" title=\"4 stars out of 5\" class=\"four-stars\">4</a></li>
				<li><a onclick=\"rate('5','460020',true,true,true); return false;\" href=\"#\" title=\"5 stars out of 5\" class=\"five-stars\">5</a></li>
			</ul>
			<div id=\"loading_460020\"></div>";
echo "</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td></tr></table>";


if ($sz<1024) {$sz="$sz bytes";}
elseif (($sz>=1024)&&($sz<1048576)) {$sz=strtr(round($sz/1024,2),".",",")." KB";}
elseif ($sz>=1048576) {$sz=strtr(round($sz/1024/1024,2),".",",")." MB";}

if(strlen($lastaccess)<5) $lastaccess=false;
if($desc=="") $desc="No description.";

if(in_array($ftype,array("gif","jpg","jpeg","png"))){
echo "<a herf=\"uploads/$ftype/$filename\">";
echo "<img src=\"preview.php?id=$id\" /></a><br/>";
}

if($banned !=="no"){
echo "<b><font>Filename:</font></b><b>$numefisier </b></form></br><font color=\"red\">This file was banned due to breaking our <a href=\"terms.php\">terms</a></br> .</font>"; 

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]>=3)
    {
if($act=="delete"){
mysql_query("DELETE FROM fisiere WHERE id='$id' "); echo "Your request was successfully deleted.Thank you!";}

echo"<a href=\"file.php?id=$id&amp;act=delete\">Delete File</a></br>";
if($act=="unbadfile"){
mysql_query("UPDATE fisiere SET banned='no' , abuse='0' WHERE id='$id' "); echo "Your request was successfully unbaned.Thank you!";}
echo"<a href=\"file.php?id=$id&amp;act=unbadfile\">UnBad File</a></br>";
}}}
 die;
}

echo "<b><font>Filename:</font></b><a href='dlfile.php?id=$id'><i>(click to download)</i> <b>$numefisier </b></a></form>";
echo "<br/>";
if($act !=="more"){echo "<b><font>File size:</font></b> $sz<br />";
if(in_array($ftype,array("gif","jpg","jpeg","png","bmp","wbmp","exif","tiff"))){$jpg=htmlspecialchars("uploads/$ftype/$filename"); list($width,$height) = getimagesize($jpg); if($width > 1){echo "<b><font>Image width: </font></b>$width pixels<br/>";} if($height > 1){echo "<b><font>Image height: </font></b>$height pixels<br/>";}}
if($ftype=="mp3"){
require_once("id.php");
$mp3=htmlspecialchars("uploads/$ftype/$filename");
$id3 = new MP3_Id();
$result = $id3->read($mp3);
$result = $id3->study();
print "<b><font>Mode:</font></b> ".
$id3->getTag('mode')."<br/>
<b><font>Bitrate:</font></b> ".$id3->getTag('bitrate')." kbps<br/>
<b><font>Duration:</font></b> ".$id3->getTag('length')."<br/>
<b><font>Frequency:</font></b> ".$id3->getTag('frequency')." Hz<br/>";}
echo "<b><font>Description:</font></b> $desc<br />";

echo "<b><font>Category:</font></b><a href='cat.php?cat=$cat'>";
if ($cat=='') {} else { 
 if($cat=='33'){echo 'Symbian S60v4/v5 Games';}
 if($cat=='32'){echo 'Symbian S60v4/v5 App';}
 if($cat=='31'){echo 'Blackberry';}
 if($cat=='30'){echo 'iPhone';}
 if($cat=='29'){echo 'Avatare';}
 if($cat=='28'){echo 'Manele';}
 if($cat=='21'){echo 'Serials/Keygen';}
 if($cat=='27'){echo 'Android';}
 if($cat =='26'){echo 'Linux';}
 if($cat =='25'){echo 'Flash Video (FLV)';}
 if($cat =='24'){echo 'Firmware Base';}
 if($cat =='23'){echo 'Siemens Themes';}
 if($cat =='22'){echo 'Motorola Themes';}
 if($cat =='20'){echo 'Nokia Themes';}
 if($cat =='19'){echo 'Sony Themes';}
 if($cat =='18'){echo 'Symbian S60v2 Apps';}
 if($cat =='17'){echo 'PC Misc';}
 if($cat =='16'){echo 'PC Phone Tools';}
 if($cat =='15'){echo 'Tutorials';}
 if($cat =='14'){echo 'Funny pics';}
 if($cat =='13'){echo 'Photos/Images';}
 if($cat =='12'){echo 'Symbian S60v3 Apps';}
 if($cat =='11'){echo 'Symbian S60v3 Games';}
 if($cat =='10'){echo 'Symbian S60v2 Games';}
 if($cat =='9'){echo 'Symbian UIQ';}
 if($cat =='8'){echo 'PocketPC';}
 if($cat =='7'){echo 'Windows Smartphone';}
 if($cat =='6'){echo 'Java Games';}
 if($cat =='5'){echo 'Java Applications';} 
 if($cat =='4'){echo 'Mobile Video';}
 if($cat =='3'){echo 'VideoClips';} 
 if($cat =='2'){echo 'Ringtones';} 
 if($cat =='1'){echo 'Muzica';} 
 if($cat =='0'){echo 'none';} 
echo "</a></a><br />";
}
$getinfo="SELECT * FROM utilizatori WHERE nume='$user'";
$getinfo2=mysql_query($getinfo) or die("Could not get users");
while($getinfo3=mysql_fetch_array($getinfo2))
{
$ustat = $getinfo3["nume"];
}
if($user == "$ustat"){
	$getinfo="SELECT * from utilizatori where nume='$user'";
$getinfo2=mysql_query($getinfo) or die("Could not get users");
while($getinfo3=mysql_fetch_array($getinfo2))
{
$avat = $getinfo3["setavatar"];

echo "<b><font>Uploaded:</font></b> $uploaded by <b>";
 if($avat[0]=="1")
	  {
		echo "<img src='avatar.php?id=$getinfo3[id]'/>";
	   }else{
		 echo "";
		}  
echo "<a href='profile.php?id=$getinfo3[id]' class='$getinfo3[color]'> $user</b></a>.<br />";
}}
else{
$avat = $getinfo3["setavatar"];
echo "<b><font>Uploaded:</font></b> $uploaded by $user _ (Guest).<br />";
}
echo "<b><font>Downloads:</font></b> $dload<br />";
echo "<b><font>Views:</font></b> $views [<a href=\"file.php?act=more&amp;id=$id&amp;key=$key\">more</a>]<br/>";
if($lastaccess) echo "<b><font>Last downloaded:</font></b> $lastaccess<br/>";}
}
if($act=="more"){
echo "<b><font>File size:</font></b> $sz<br />";
echo "<b><font>Browser:</font></b> $Browser<br />";
$real=htmlspecialchars("uploads/$ftype/$filename");
$tc=filesize($real) * $dload;
if ($tc<1024) {$tc="$tc bytes";}
elseif (($tc>=1024)&&($tc<1048576)) {$tc=strtr(round($tc/1024,2),".",",")." KB";}
elseif ($tc>=1048576) {$tc=strtr(round($tc/1024/1024,2),".",",")." MB";}
echo "<b><font>Traffic:</font></b> $tc<br />";
echo "<a href=\"search.php?key=$user&amp;act=search&amp;type=user\">show all uploads from $user</a><br/>";
echo "<a href=\"search.php?key=$id&amp;act=search&amp;type=browser\">show all uploads from similar browser</a><br/>";}

if(!$act){mysql_query("UPDATE fisiere SET view='$views' WHERE id='$id'");}

if($banned !=="no"){echo "<b>The file was deleted for breaking our <a href=\"terms.php\" style=\"color:red\">terms of service</a></b>";
echo "<div class='hl2'>";
echo "</html>";
die();}

if($ftype=="mp3"){
echo "<iframe id='playmedia' src='http://extremshare.net/play.php?id=$getid' width='500' height='100' frameborder='0' ></iframe>";
}
$id = $row['id'];
if($ftype=="rar"){
echo "<div class='hl'>File Fracmented In Arhive</div>";
$filename = substr($filename,0,7);
$sql = mysql_query("SELECT * FROM fisiere WHERE `file` LIKE '%".$filename."%'");

while($row = mysql_fetch_array($sql))
{
$filenume = $row['file'];
$idtavi = $row['id'];
if($sql > 1){
echo "<a href='file.php?id=$idtavi'>$filenume</a></br >";
}}}

if($ftype=="zip"){
echo "<div class='hl'>File Fracmented In Arhive</div>";
$filename = substr($filename,0,7);
$sql = mysql_query("SELECT * FROM fisiere WHERE file LIKE '%".$filename."%'");

while($row = mysql_fetch_array($sql))
{
$filenume = $row['file'];
$idtavi = $row['id'];
if($sql > 1){
echo "<a href='file.php?id=$idtavi'>$filenume</a></br >";
}}}
if($filename==""){
echo "<b>Invalid file.Please check the URL carefully,or maybe the file was deleted for breaking our <a href=\"terms.php\" style=\"color:red\">terms of service</a></b>";
echo "</html>";
die();}

echo "<div class='hl'>Share link</div>";
echo " <div class='txt'><div class='Emessage'><b>Alert: </b>Please don't copy/paste direct download link of the file. Instead use the '<b>Share Link</b>'.</div>";
echo "<center><a href=\"ymsgr:im?+&msg=Descarca $filename .Ms :D ;). http://extremshare.net".$_SERVER['REQUEST_URI']."\">";
echo "<left><img src=\"interfata/trimite_pe_mess.png\"></left>";
echo "</center></br>";

$filename=str_replace("_","-",$filename);
$filename=str_replace(".","-",$filename);
$filename=str_replace(" ","-",$filename);

echo "<a href=\"http://extremshare.net/".$filename."_".$getid.".html\">http://extremshare.net/".$filename."_".$getid.".html</a><br/>";
echo "<input value=\"http://extremshare.net/".$filename."_".$getid.".html\" size='100' name='link' onclick='javascript:this.select();'/></div>";

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]>=2)
    {

if($act=="move"){
$newcat = $_POST["cat"];
mysql_query("UPDATE fisiere SET categorie='$newcat' WHERE id='$id' "); echo "Your request was successfully moved.Thank you!";}

if($act=="ban"){
mysql_query("UPDATE fisiere SET banned='nu' , abuse='$abuse' WHERE id='$id' "); echo "Your request was successfully banned.Thank you!";}

if($act=="unbad"){
mysql_query("UPDATE  fisiere SET abuse='0'  WHERE id='$id' "); echo "Your request was successfully unbad.Thank you!";}

if($act=="abuse"){
$motiv = $_POST["motiv"];
$reclamant = $_POST["userok"];
// The Regular Expression filter
$pattern = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";

// convert URLs into Links
$motiv= preg_replace($pattern, "<a href=\"\\0\"?phpMyAdmin=uMSzDU7o3aUDmXyBqXX6JVQaIO3 rel=\"nofollow\">\\0</a>", $comment);

mysql_query("UPDATE fisiere SET abuse='$abuse' , motiv='$motiv' , reclamant='$reclamant' WHERE id='$id' "); echo "Your request was successfully recorded.Thank you!";}

}}}

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]>=3)
    {
if($act=="delete"){

mysql_query("DELETE FROM fisiere WHERE id='$id' "); echo "Your request was successfully deleted.Thank you!";}
}}}

if($act=="fav"){

       if(isset($_SESSION['nume'])) {
      	$userb = ''.$_SESSION['nume'].'';
 $getusers="SELECT * from utilizatori WHERE nume='$userb'";
  $getusers2=mysql_query($getusers) or die("COuld not draw cookies");
  $getusers3=mysql_fetch_array($getusers2);
  if(strlen($getusers3[nume])>1)
  {
$uid = $getusers3["id"];

mysql_query("INSERT INTO `favorite` (uid, fid) VALUES ('$uid' , '$id')"); echo "File added to favorite.Thank you!";}
}}
if($act=="delfav"){

       if(isset($_SESSION['nume'])) {
      	$userb = ''.$_SESSION['nume'].'';
 $getusers="SELECT * from utilizatori WHERE nume='$userb'";
  $getusers2=mysql_query($getusers) or die("COuld not draw cookies");
  $getusers3=mysql_fetch_array($getusers2);
  if(strlen($getusers3[nume])>1)
  {
$uid = $getusers3["id"];

mysql_query("DELETE FROM `favorite` WHERE uid=$uid and fid=$id"); echo "File was delete from favorite.Thank you!";}
}}
?>
<?
 $cookie_name = 'file_'.$_GET['id'];
setcookie ($cookie_name, 1, time()+1150, '/ ', '', 0);
?>
<?php
$comentarii = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM comments WHERE file='".$id."'"));
echo "<div class='hl'> <b>Comments ($comentarii[0])</b></b></div>";
?>
<?php
$comentarii = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM comments WHERE file='".$id."'"));
if(isset($_SESSION['nume'])) {
      	$usersa = ''.$_SESSION['nume'].'';
        
print "<form action=\"comment.php?ac=added&amp;id=\"$id\"\" method=\"POST\">";
print "<input type=\"hidden\" name=\"uname\" value='$usersa'><br>";
//print "email:(Necesar dar ascuns)<br/>";
echo "<input type=\"hidden\" name=\"mail\" value=\"mail@domain.ro\">";
echo "<b>Message:</b><br/><textarea name=\"comment\" cols='20' rows='6'  maxlength='240'></textarea>";
print "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
print "</form>";}else{
echo "<div class='message'><b></b>Due to some users abuse, only registered and logged members <i>can</i> post comments.</div><br/>";
}

if($comentarii[0]==0)
{
print "<i> No comments</i>";
}else{
$pg=$_GET['pg'];
if(!$pg){
if(!isset($_GET['page'])){ 
    $page = 1; 
} else { 
    $page = $_GET['page']; 
} 
}
if($pg){$page =
 $pg;}
// Define the number of results per page 
$comentarii = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM comments WHERE file='".$id."'"));
$max_results = $comentarii[0]; 
// Figure out the limit for the query based 
// on the current page number. 
$from = (($page * $max_results) - $max_results); 
$sql = mysql_query("SELECT * FROM comments WHERE file='".$id."' ORDER BY id DESC LIMIT $from,$max_results "); 
while($row = mysql_fetch_array($sql)){ 
// Build your formatted results here.
$idu = $row['id'];
$uname1 = $row['uname'];
$file1 = $row['file'];
$date = $row['date'];
$comment = $row['comment'];
$date_formated = date('H:i d/m/y', $date);

$getusersonline="SELECT * from utilizatori where nume='$uname1'"; //grab from sql users on in last 15 minutes
$getusersonline2=mysql_query($getusersonline) or die("Could not get users");
while($getusersonline3=mysql_fetch_array($getusersonline2))
{
$avat = $getusersonline3["setavatar"];
$ids = $getusersonline3["id"];


// The Regular Expression filter
$pattern = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";

// convert URLs into Links
$comment= preg_replace($pattern, "<a href=\"\\0\"?phpMyAdmin=uMSzDU7o3aUDmXyBqXX6JVQaIO3 rel=\"nofollow\">\\0</a>", $comment);


echo "<table class='border' width='99%' cellpadding='3' cellspacing='0'><tr><td rowspan='2' class='message' width='80'><br/>
<small>";
 if($avat[0]=="1")
	  {
		echo "<img src='avatar.php?id=$ids'/>";
	   }else{
		 echo "";
		}  
echo "<a href='profile.php?id=$ids' class='$getusersonline3[color]'>$uname1 </font></a></small>
     </td>
      <td><small>  $comment  </small>";
       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]>=2)
    {


echo"</b><a href=\"file.php?id=$getid#\" class='modr'><b>&nbsp;X</b></a></br>";

}}}
echo "
      </td>
     </tr>
     <tr height='10'>
     <td  colspan='2' class='message'>
     <small><small>Posted $date_formated </small></small>
     </td>
     </tr>
	 </table></br>";
}
}
}

?>
<!-- Vizualizat de user -->
<?
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)
    {
echo "<div class='hl'>Report</div>
 <div class='txt'>
</div>
<br/>";
$sql = mysql_query("SELECT * FROM fisiere WHERE id = '$getid' ");

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

if($stare=="0")
{
print "<form action=\"file.php?id=$id&amp;act=abuse\" method=\"POST\">";
print "<input type=\"hidden\" name=\"userok\" value='$userb'><br>";
echo "<b>Motiv:</b><br/><textarea name=\"motiv\" cols='20' rows='6'  maxlength='240'></textarea>";
print "<input type=\"submit\" name=\"submit\" value=\"Report\">";
print "</form>";
}else{
echo "Fisier raportat!</br>";
echo "Raportat de: $userbad</br>";
echo "Motiv: $motivbad</br>";

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]>=2)
    {
echo "<a href=\"file.php?id=$id&amp;act=unbad\">Anulare fisier raportat</a></br>";
}}}
}
}}}
?>
<!-- Panou Moderator -->
<?
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]==2)
    {
print "</form>";
echo "<div class='hl'>Panou Moderator</div>
 <div class='txt'>
</div>
<br/>";
echo "<b>Ip Uploader:</b> $ip</br> ";
echo"<a href=\"file.php?id=$id&amp;act=ban\">Sterge fisierul</a></br>";
 
echo "<form method=\"post\" action=\"file.php?id=$id&act=move\">"; 
echo "<b>Move To Category</b> <select name='cat'>
<option value='0'>No category</option>";

$sql = mysql_query("SELECT * FROM categorii ORDER BY name");
while($row = mysql_fetch_array($sql)){
    
echo "<option value='$row[id]'>$row[name]</option>";}
echo "<input type=\"Submit\" value=\"Move File\">"; 
print "</form>";
}}}
?>
<!-- Panou Administrator -->
<?
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]==3)
    {
print "</form>";
echo "<div class='hl'>Panou Admin</div>
 <div class='txt'>
</div>
<br/>";
echo "<b>Ip Uploader:</b> $ip</br> ";        
echo "<a href=\"file.php?id=$id&amp;act=unbad\">Debaneaza fisier</a></br>";   
echo "<a href=\"file.php?id=$id&amp;act=delete\">Delete File</a></br>";   
  
echo "<form method=\"post\" action=\"file.php?id=$id&act=move\">"; 
echo "<b>Move To Category</b> <select name='cat'>
<option value='0'>No category</option>";

$sql = mysql_query("SELECT * FROM categorii ORDER BY name");
while($row = mysql_fetch_array($sql)){
    
echo "<option value='$row[id]'>$row[name]</option>";}
echo "<input type=\"Submit\" value=\"Move File\">"; 
print "</form>"; 
}}}
?>
<!-- Panoul Proprietarului -->
<?
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]==4)
    {
echo "<div class='hl'>Panou Proprietar</div></br>";
echo "<b>Ip Uploader:</b> $ip</br> ";
echo "<a href=\"file.php?id=$id&amp;act=ban\">Baneaza fisierul</a></br>";
echo "<a href=\"file.php?id=$id&amp;act=delete\">Delete File</a></br>";

echo "<form method=\"post\" action=\"file.php?id=$id&act=move\">"; 
echo "<b>Move To Category</b> <select name='cat'>
<option value='0'>No category</option>";

$sql = mysql_query("SELECT * FROM categorii ORDER BY name");
while($row = mysql_fetch_array($sql)){
    
echo "<option value='$row[id]'>$row[name]</option>";}
echo "</select>";
echo "<input type=\"Submit\" value=\"Move File\">"; 


}}}

?>
<!-- Panoul Author -->
<?
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]==5)
    {
echo "<div class='hl'>Panou Author</div></br>";
echo "<b>Ip Uploader:</b> $ip</br> ";
echo "<a href=\"file.php?id=$id&amp;act=ban\">Baneaza fisierul</a></br>";
echo "<a href=\"file.php?id=$id&amp;act=delete\">Delete File</a></br>";

echo "<form method=\"post\" action=\"file.php?id=$id&act=move\">"; 
echo "<b>Move To Category</b> <select name='cat'>
<option value='0'>No category</option>";

$sql = mysql_query("SELECT * FROM categorii ORDER BY name");
while($row = mysql_fetch_array($sql)){
    
echo "<option value='$row[id]'>$row[name]</option>";}
echo "</select>";
echo "<input type=\"Submit\" value=\"Move File\">"; 


}}}
?>
<!-- SFARSIT CONTINUT!!! -->      <center>
<?
echo "</center>


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

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

include ("flooter.html");
?>