<?php session_start();
include ("stop.php");
include ("config.php");
?>
<link href='style_c.css' rel='stylesheet' type='text/css' />
<?php
include ("file.html");
?>
<table width='950' cellspacing='0' cellpadding='0' align='center'>
<?php
include ("right.html");
$getid=$_GET['id'];
?>
<td width='760' valign='top' class='continut'>

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

<!-- CONTINUTUL !!!! -->
<?
include('config.php');


$getid=$_GET['id'];
$act=$_GET['act'];

$sql = mysql_query("SELECT * FROM fisiere WHERE id = '$getid' ");
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);


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.";
?>
<!--
	1 ) Reference to the files containing the JavaScript and CSS.
	These files must be located on your server.
-->

<script type="text/javascript" src="/highslide/highslide.js"></script>
<link rel="stylesheet" type="text/css" href="/highslide/highslide.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="/highslide/highslide-ie6.css" />
<![endif]-->



<!--
    2) Optionally override the settings defined at the top
    of the highslide.js file. The parameter hs.graphicsDir is important!
-->

<script type="text/javascript">
//<![CDATA[
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
	position: 'top right',
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});


hs.graphicsDir = '/highslide/graphics/';
hs.wrapperClassName = 'borderless';
//]]>
</script>

<?
if(isset($_SESSION['nume'])) {
      	$username = ''.$_SESSION['nume'].'';
 $getuser = mysql_query("SELECT * from utilizatori WHERE nume='$username'");
  $getuser3=mysql_fetch_array($getuser);
  if(strlen($getuser3[nume])>1)
{      
print " ";
}}else{
echo "<div class='txt'><div class='Emessage'><b>Alert: 
</b>For downloading without speed limit , please <b><a href='register.php'>Register</a></b> or <b><a href='index.php'>Login</a></b>.</div>";
}

if(in_array($ftype,array("gif","jpg","jpeg","png"))){   

echo "<table width='100%'  cellspacing='0' cellpadding='0'>
<tr><td width='100%' valign='top'>
<div class='hl'><center>Preview File</center></div>
</td></tr></table>
<table width='100%'  cellspacing='0' cellpadding='4'  class='border'>
<tr><td>";

echo "<center><a href=\"/uploads/$ftype/$filename\" class=\"highslide\" onclick=\"return hs.expand(this)\">
	<img src=\"/preview.php?id=$id\" alt=\"Highslide JS\"
		title=\"Click to enlarge\" height=\"120\" width=\"107\" /></a></center><br/>";

echo "</td></tr></table><br/><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;
}

if($ftype=="mp3"){
echo "<table width='100%'  cellspacing='0' cellpadding='0'>
<tr><td width='100%' valign='top'>
<div class='hl'><center>Preview File</center></div>
</td></tr></table>
<table width='100%'  cellspacing='0' cellpadding='4'  class='border'>
<tr><td>";   

$id = $_GET["id"];

$numefisier = $filename;
$numefisier=str_replace("by_wWw.ExtremShare.Net","",$numefisier);
$numefisier=str_replace("_"," ",$numefisier);
$numefisier=str_replace("."," ",$numefisier);

echo "<center><table width='380' height='80'  border='0' cellpadding='0' cellspacing='0' background=\"player/bg_player.gif\">
<tr><td><table width='100%' height='80'  border='0' cellpadding='0' cellspacing='0'>
<tr><td height='20' align='center' valign='bottom'><span style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #ffffff; text-decoration: none;'>
<a style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight:bold; color: #ffffff; text-decoration: none;' href=\"http://extremshare.net/file.php?id=$id\">$numefisier</a></span></td></tr>
<tr><td height='5'><img src=\"player/5x5_tr.gif\" width='5' height='5'></td></tr>
<tr><td><table width='100%' height='30'  border='0' cellpadding='0' cellspacing='0'><tr><td width='18'> </td><td align='left' valign='middle'>
<span style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #ffffff; text-decoration: none;'><embed class='beeplayer' wmode='transparent' style='height:24px;width:260px;' src='player/player.swf' quality='high' bgcolor='#ffffff' width='260' height='24' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage=\"http://www.macromedia.com/go/getflashplayer\" flashvars='playerID=1&bg=0xCDDFF3&leftbg=0x357DCE&lefticon=0xF2F2F2&rightbg=0x64F051&rightbghover=0x1BAD07&righticon=0xF2F2F2&righticonhover=0xFFFFFF&text=0x357DCE&slider=0x357DCE&track=0xFFFFFF&border=0xFFFFFF&loader=0xAF2910&soundFile=/uploads/mp3/$filename''>
 </embed></span></td>
<td width='70' align='center' valign='middle'><img src=\"interfata/logo_small.gif\" width='95' height='24'></td><td width='8'></td></tr></table></td></tr><tr><td height='5'>
<img src=\"player/5x5_tr.gif\" width='5' height='5'></td></tr><tr>
<td height='20' align='center' valign='top'>
<span style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #ffffff; text-decoration: none;'>Powered By <a style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #ffffff; text-decoration: underline;' href=\"http://extremshare.net\">wWw.ExtremShare.Net</a>
</span></td></tr></table></td></tr></table>";
echo "</td></tr></table><br/><br/>";
}
if($ftype=="flv"){
echo "<table width='100%'  cellspacing='0' cellpadding='0'>
<tr><td width='100%' valign='top'>
<div class='hl'><center>Preview File</center></div>
</td></tr></table>
<table width='100%'  cellspacing='0' cellpadding='4'  class='border'>
<tr><td><center>";   
?>
	<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
	<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="528" height="400"> 
		<param name="movie" value="player/video/player.swf" /> 
		<param name="allowfullscreen" value="true" /> 
		<param name="allowscriptaccess" value="always" /> 
		<param name="flashvars" value="file=http://extremshare.net/flv/<?php echo "$filename"; ?>&image=player/video/preview.jpg" /> 
		<embed 
			type="application/x-shockwave-flash"
			id="player2"
			name="player2"
			src="player/video/player.swf" 
			width="520" 
			height="400"
			allowscriptaccess="always" 
			allowfullscreen="true"
			flashvars="file=http://extremshare.net/uploads/flv/<?php echo "$filename"; ?>&image=player/video/preview.jpg" 
		/> 
	</object> 
	<!-- END OF THE PLAYER EMBEDDING -->
<?php
echo "</td></tr></table><br/><br/>";
}
echo "</center>";

//////////////////////toolbox///////////////

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'> 

<a href='download.php?id=$id'><img src='interfata/tools/dl.gif' align='absmiddle' title='Download file' /></a> &nbsp;";

      if(isset($_SESSION['nume'])) {
       	$userb = ''.$_SESSION['nume'].'';
  $getusers=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
  $getusers3=mysql_fetch_array($getusers);
  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;";
 
echo "<a href='ymsgr:im?+&msg=Download $filename .Ms :D ;). http://www.extremshare.net".$_SERVER['REQUEST_URI']."'><img src='interfata/tools/yahoo.gif' align='absmiddle' title='Send file to yahoo messenger!'></a>&nbsp;";

echo "<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>";

////////////////////end ///////////////////

echo "<b><font>Filename:</font></b><b><a href=\"download.php?id=$id\">$numefisier</a></b></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>Encoding Type:</font></b> ".$id3->getTag('encoding_type')." <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=='35'){echo 'Scripts';}
 if($cat=='34'){echo 'Subtitle';}
 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=mysql_query("SELECT * FROM utilizatori WHERE nume='$user'");
while($getinfo3=mysql_fetch_array($getinfo))
{
$ustat = $getinfo3["nume"];

if($user == "$ustat"){
	$getinfo=mysql_query("SELECT * from utilizatori where nume='$user'");
while($getinfo3=mysql_fetch_array($getinfo))
{
$avat = $getinfo3["setavatar"];
$avatar = $getinfo3["avatar"];


echo "<b><font>Uploaded:</font></b> $uploaded by <b>";
 if($avat[0]=="1")
	  {
		echo "<img src='avatar/$avatar'/>";
	   }else{
		 echo "";
		}  
echo "<a href='profile.php?id=$getinfo3[id]'class='$getinfo3[color]'> $user</b></a>.<br />";
}}
else{
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<br/>";
if($lastaccess) echo "<b><font>Last downloaded:</font></b> $lastaccess<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($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 "<br />";
echo "<center><a href='download.php?id=$getid'><img src='interfata/downfile.png' alt='Download $numefisier'  /></a></center>";

//////////////////fisiere similare ///////////////////

$similar = substr($filename,0,15);

$sql = mysql_query("SELECT * FROM fisiere WHERE file LIKE '%".$similar."%' LIMIT 10");
$rezultate= mysql_num_rows($sql);
$ns="1";

echo "<table width='100%'  cellspacing='0' cellpadding='0'>
<tr><td width='100%' valign='top'>
<div class='hl'><center>Similar Files";
 if($rezultate>"1")
{
echo "($rezultate)";
}else{
echo "(0)";
}
echo "</center></div>
</td></tr></table>
<table width='100%'  cellspacing='0' cellpadding='4'  class='border'>
<tr><td>";

while($row = mysql_fetch_array($sql))
{
$numefile = $row['file'];
$idtavi = $row['id'];
$numefile=str_replace("by_wWw.ExtremShare.Net","",$numefile);
$numefile=str_replace("_"," ",$numefile);
$numefile=str_replace("."," ",$numefile);

if($rezultate>"1")
{
      
echo "<b>$ns.</b><a href='file.php?id=$idtavi' class='administrator'>$numefile</a></br >";
$ns++;
}else{
print "No files!";
}
}
echo "</td></tr></table><br/><br/>";

///////////////////end/////////////


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 "<a href=\"http://extremshare.net/file.php?id=$id\">http://extremshare.net/file.php?id=$id</a><br/>";
echo "<input value=\"http://extremshare.net/file.php?id=$id\" size='100' name='link' onclick='javascript:this.select();'/></div>";

if(isset($_SESSION['nume'])) {
      	$userb = ''.$_SESSION['nume'].'';
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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(isset($_SESSION['nume'])) {
      	$userb = ''.$_SESSION['nume'].'';
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
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=".$_GET['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=mysql_query("SELECT * from utilizatori where nume='$uname1'"); //grab from sql users on in last 15 minutes
while($getusersonline3=mysql_fetch_array($getusersonline))
{
$avat = $getusersonline3["setavatar"];
$ids = $getusersonline3["id"];
$avatar = $getusersonline3["avatar"];

// 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);
$message = $comment;
$message=str_replace(":O","<img src='/interfata/smilies/o.gif'>",$message);
$message=str_replace("B-)","<img src='/interfata/smilies/cool.gif'>",$message);
$message=str_replace(":P","<img src='/interfata/smilies/p.gif'>",$message);
$message=str_replace(":X","<img src='/interfata/smilies/love.gif'>",$message);
$message=str_replace(":D","<img src='/interfata/smilies/d.gif'>",$message);
$message=str_replace("=D&gt;","<img src='/interfata/smilies/bv.gif'>",$message);

$message=str_replace(":o","<img src='/interfata/smilies/o.gif'>",$message);
$message=str_replace("b-)","<img src='/interfata/smilies/cool.gif'>",$message);
$message=str_replace(":p","<img src='/interfata/smilies/p.gif'>",$message);
$message=str_replace(":x","<img src='/interfata/smilies/love.gif'>",$message);
$message=str_replace(":d","<img src='/interfata/smilies/d.gif'>",$message);
$message=str_replace("=d&gt;","<img src='/interfata/smilies/bv.gif'>",$message);

$message=str_replace(":*","<img src='/interfata/smilies/kiss.gif'>",$message);
$message=str_replace(":))","<img src='/interfata/smilies/ras.gif'>",$message);
$message=str_replace("=))","<img src='/interfata/smilies/ras2.gif'>",$message);
$message=str_replace(":)","<img src='/interfata/smilies/smilie.gif'>",$message);
$message=str_replace(":(","<img src='/interfata/smilies/supi.gif'>",$message);
$message=str_replace(";)","<img src='/interfata/smilies/yes.gif'>",$message);
$message=str_replace("|-)","<img src='/interfata/smilies/dorm.gif'>",$message);
$message=str_replace("[-)","<img src='/interfata/smilies/nu.gif'>",$message);
$message=str_replace("=((","<img src='/interfata/smilies/dez.gif'>",$message);
$message=str_replace(":>","<img src='/interfata/smilies/yep.gif'>",$message);
$message=str_replace("X-(","<img src='/interfata/smilies/nervi.gif'>",$message);
$message=str_replace(">:)","<img src='/interfata/smilies/rad.gif'>",$message);
$message=str_replace("8-|","<img src='/interfata/smilies/eh.gif'>",$message);
$message=str_replace("L-)","<img src='/interfata/smilies/stai.gif'>",$message);
$message=str_replace(":-&","<img src='/interfata/smilies/bleach.gif'>",$message);
$message=str_replace(":&gt;","<img src='/interfata/smilies/yep.gif'>",$message);

$comment = $message;


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/$avatar'/>";
	   }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=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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")
{
echo "<a href='report.php?id=$getid' title='Report File'>Report file</a>";
}else{
echo "Fisier raportat!</br>";
echo "Raportat de: $userbad</br>";
echo "Motiv: $motivbad</br>";

 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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 -->
<?
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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 -->
<?
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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=ban\">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 -->
<?
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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 -->
<?
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  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");
?>