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

if($id=="$uid")
{   
    
$profil="SELECT * from utilizatori where id='$uid'"; //grab from sql users on in last 15 minutes
$profil2=mysql_query($profil) or die("Could not get users");
while($profil3=mysql_fetch_array($profil2))
{    
$date = $profil3['data'];
$date_formated = date('H:i:s d/m/Y', $date);

$last = $profil3['lasttime'];
$last_formated = date('H:i:s d/m/Y', $last);
    
$rank =  $profil3['status'];
$avatar = $profil3["avatar"];
$nume =$profil3["nume"];
$views = $profil3['views']+1;
$show = $profil3['views'];
$action = $profil3['stare'];
$email = $profil3['email'];
$ip = $profil3['ip'];

echo "<div class='txt'>
<img src='avatar/$avatar'/><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)
    {
print "<a href=\"ban.php?avt=$uid\">Delete Avatar</a></br></br>";       
        
}}}
        
echo "<b>Name: </b> $nume<br/>
<b>Registered: </b> " . $date_formated. "<br/>
<b>Last visit: </b>  " . $last_formated. "<br/>
</div>

<div class='hl'>Statistics<br/>
";
$num = mysql_query("SELECT * FROM fisiere WHERE user='$nume'");
$num_rows = mysql_num_rows($num);

echo "</div>
<div class='txt'>
<b>Public files:</b>  $num_rows ( <a href='userup.php?rid=$nume'><img src='interfata/search.gif' align='absmiddle' title='More from this user' /> find</a> )<br/>
";
$que=mysql_query("SELECT * FROM fisiere where user='$nume'");
while($row=mysql_fetch_array($que)){$array[]=$row['size'];
$sz=array_sum($array);
if ($sz<1024) {$sz="$sz bytes";}
elseif (($sz>=1024)&&($sz<1048576)) {$sz=strtr(round($sz/1024,2),".",",")." KB";}
elseif (($sz>=1048576)&&($sz<134217728)) {$sz=strtr(round($sz/1024/1024,2),".",",")." MB";}
elseif ($sz>=134217728) {$sz=strtr(round($sz/1024/1024/1024,2),".",",")." GB";}
}

echo "<b>Public files space:</b>".$sz."<br/>";

$quedown=mysql_query("SELECT * FROM utilizatori WHERE nume='$nume'");
while($row=mysql_fetch_array($quedown)){$arraydown[]=$row['download'];
$szdown=array_sum($arraydown);
if ($szdown<1024) {$szdown="$szdown bytes";}
elseif (($szdown>=1024)&&($szdown<1048576)) {$szdown=strtr(round($szdown/1024,2),".",",")." KB";}
elseif (($szdown>=1048576)&&($szdown<134217728)) {$szdown=strtr(round($szdown/1024/1024,2),".",",")." MB";}
elseif ($szdown>=134217728) {$szdown=strtr(round($szdown/1024/1024/1024,2),".",",")." GB";}
}

echo "<b>File Download:</b> ".$szdown."<br/>";

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

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

echo "<b>Profile Views :</b> $show</br>";
echo "<b>Status : </b> ";
$recent=date("U")-900;
 if($last>"$recent")
	  {
		echo "<b>O</b>nline";
	   }else{
		 echo "<b>O</b>ffline";
		}  
echo "</br><b>Last Action:</b>$action<br/>";

echo "</b><font class='modr'>Rank:</b><b>";
if ($rank=="") {} else {
 if($rank =="5"){echo 'Author';} 
 if($rank =="4"){echo 'Owner';} 
 if($rank =="3"){echo 'Administrator';} 
 if($rank =="2"){echo 'Moderator';}
 if($rank =="1"){echo 'Avansat';} 
 if($rank =="0"){echo 'User';} }
echo "</a></font></b></a><br />";
  
echo "</div>";
}
if($nume==""){echo "<b>The user does not exist!</b>";
echo "</html>";
die();}
echo "<div class='hl'>Send Pm<br/>
</div></br>";

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)
  {
$myid = $getuser3["id"];
   
if($getuser3[usepm]==1)
       {
            print "<form action='profile.php?id=$id&act=sendpm' method='post'>";
            print "<input type='hidden' name='nameID' value='$id'>";              
            print "Subject:<br>";
            print "<input name='subject' type='text' size='30'><br>";
            print "Message:<br>";
            print "<textarea name='message' rows='5' cols='40'></textarea><br><br>";
            print "<input type='submit' name='submit' value='send'></form>";
          }
      }           
echo "<div class='hl'>End of page!<br/>
</div></br>";




?>
<!-- Doar Echpa -->
<?php
 $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 "<div class='hl'>More Detalies<br/>
</div></br>";
echo "<b>Email:</b> $email</br>";
echo "<b>Ip:</b> $ip</br>";
$ustat="SELECT * from utilizatori where id='$uid'"; 
$ustat2=mysql_query($ustat) or die("Could not get users");
while($ustat3=mysql_fetch_array($ustat2))
{ 
print "<b>Warns:</b> $ustat3[warn] </br>";
echo "<b>Baned:</b> $ustat3[banned]</br>";
echo "<b>Site:</b> $ustat3[link]</br>";
}}}}
?>
<!-- Panou Moderator -->
<?php
 $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)
    {
$ustat="SELECT * from utilizatori where id='$uid'"; //grab from sql users on in last 15 minutes
$ustat2=mysql_query($ustat) or die("Could not get users");
while($ustat3=mysql_fetch_array($ustat2))
{       
        
print "<div class='hl'>Panou Moderator<br/></div>";
$stare = $ustat3["banned"];
if($stare=="Yes")
{
$motivbad = $ustat3["motiv"];
$userbad = $ustat3["reclamant"];
echo "Banat de: $userbad</br>";
echo "Motiv: $motivbad</br>";

print "<i>Daca consideri ca userul este banat pe nedrept anunta un proprietar!!!</i>";
}else{

print "<form action=\"ban.php?ban=$ustat3[id]\" 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=\"Baneaza\">";
}
print "</br>";
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==0)
    {
print "<a href=\"ban.php?warn=$ustat3[id]\">1 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==1)
    {
print "<a href=\"ban.php?warn2=$ustat3[id]\">2 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==2)
    {
print "<a href=\"ban.php?warn3=$ustat3[id]\">3 Warn User $ustat3[nume]</a></br>";
}
}}}}
?>
<!-- Panou Administratorr -->
<?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]==3)
    {
        
$ustat="SELECT * from utilizatori where id='$uid'"; //grab from sql users on in last 15 minutes
$ustat2=mysql_query($ustat) or die("Could not get users");
while($ustat3=mysql_fetch_array($ustat2))
{        
print "<div class='hl'>Panou Admin<br/></div>";
$stare = $ustat3["banned"];
if($stare=="Yes")
{
$motivbad = $ustat3["motiv"];
$userbad = $ustat3["reclamant"];
echo "Banat de: $userbad</br>";
echo "Motiv: $motivbad</br>";

print "</br><a href=\"ban.php?unban=$ustat3[id]\">Unbann User $ustat3[nume]</a></br>";
}else{

print "<form action=\"ban.php?ban=$ustat3[id]\" 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=\"Baneaza\">";
}
print "</br>";
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==0)
    {
print "<a href=\"ban.php?warn=$ustat3[id]\">1 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==1)
    {
print "<a href=\"ban.php?warn2=$ustat3[id]\">2 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==2)
    {
print "<a href=\"ban.php?warn3=$ustat3[id]\">3 Warn User $ustat3[nume]</a></br>";
}
}}}}
?>
<!-- Panou Author -->
<?php
 $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)
    {
$ustat="SELECT * from utilizatori where id='$uid'"; //grab from sql users on in last 15 minutes
$ustat2=mysql_query($ustat) or die("Could not get users");
while($ustat3=mysql_fetch_array($ustat2))
{        
print "<div class='hl'>Panou Author<br/></div>";
//// ban normal
$stare = $ustat3["banned"];
if($stare=="Yes")
{
$motivbad = $ustat3["motiv"];
$userbad = $ustat3["reclamant"];
echo "Banat de: $userbad</br>";
echo "Motiv: $motivbad</br>";

print "</br><a href=\"ban.php?unban=$ustat3[id]\">Unbann User $ustat3[nume]</a></br>";
}else{

print "<form action=\"ban.php?ban=$ustat3[id]\" 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=\"Baneaza\">";
print "</form>";
}
///ban ip

print "<form action=\"ban.php?banip=$ip\" method=\"POST\">";
print "<input type=\"hidden\" name=\"userok\" value='$userb'><br>";
print "<input type=\"hidden\" name=\"ip\" value='$ip'><br>";
echo "<b>Motiv:</b><br/><textarea name=\"motiv\" cols='20' rows='6'  maxlength='240'></textarea>";
print "<input type=\"submit\" name=\"submit\" value=\"Ban Ip $ip\"></from>";
print "</form>";

print "</br>";
print "</br><a href=\"ban.php?delete=$ustat3[id]\">Delete User $ustat3[nume]</a></br>";

   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==0)
    {
print "<a href=\"ban.php?warn=$ustat3[id]\">1 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==1)
    {
print "<a href=\"ban.php?warn2=$ustat3[id]\">2 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==2)
    {
print "<a href=\"ban.php?warn3=$ustat3[id]\">3 Warn User $ustat3[nume]</a></br>";
}
}}}
?>
<!-- Panou Proprietar -->
<?php
 $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)
    {
$ustat="SELECT * from utilizatori where id='$uid'"; //grab from sql users on in last 15 minutes
$ustat2=mysql_query($ustat) or die("Could not get users");
while($ustat3=mysql_fetch_array($ustat2))
{
print "<div class='hl'>Panou Proprietar<br/></div>";
$stare = $ustat3["banned"];
if($stare=="Yes")
{
$motivbad = $ustat3["motiv"];
$userbad = $ustat3["reclamant"];
echo "Banat de: $userbad</br>";
echo "Motiv: $motivbad</br>";

print "</br><a href=\"ban.php?unban=$ustat3[id]\">Unbann User $ustat3[nume]</a></br>";
}else{

print "<form action=\"ban.php?ban=$ustat3[id]\" 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=\"Baneaza\">";
}
print "</br>";

   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==0)
    {
print "<a href=\"ban.php?warn=$ustat3[id]\">1 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==1)
    {
print "<a href=\"ban.php?warn2=$ustat3[id]\">2 Warn User $ustat3[nume]</a></br></br>";
}
   $_SESSION['user']=$getuser3[nume];        
if($getuser3[warn]==2)
    {
print "<a href=\"ban.php?warn3=$ustat3[id]\">3 Warn User $ustat3[nume]</a></br>";
}
}}}

$id = $_GET["id"];
$act = $_GET["act"];
if($act=="sendpm")
{
 $getuser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $getuser3=mysql_fetch_array($getuser);
  if(strlen($getuser3[nume])>1)
  {
$myid = $getuser3["id"];   
    
$nameID=$_POST['nameID'];
 $suser=mysql_query("SELECT * from utilizatori WHERE nume='$userb'");
 $suser3=mysql_fetch_array($suser);
       if(strlen($_POST['subject'])<1)
       {
         print "You did not enter a subject. Please go back to <A href='pm.php'>PM Main</a>";
       }
       else if(strlen($_POST['message'])<1)
       {
         print "You did not enter a message. Please go back to <A href='pm.php'>PM Main</a>";
       }
       else
       {
          $subject=$_POST['subject'];
          $message=$_POST['message'];
          $date=date("U");
          $vartime=date("D M d, Y H:i:s");
          $sendmessage="INSERT into b_pms (sender, receiver,subject,message,therealtime,vartime) values('$myid','$nameID','$subject','$message','$date','$vartime')";
          mysql_query($sendmessage) or die("Could not send message");
          print "PM Sent, please go back to <A href='pm.php'>PM Main</a>.";
       }
}}
?>
</select>
<!-- SFARSIT CONTINUT!!! -->
</form>
</td></tr></table>
</tr>

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

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