View file new_fo/edit/myfiles.php

File size: 3.11Kb
<?php
if (!defined('SECURED'))
{
	die("Unknown Error!");
}

if(!$sid)
{
	title('Error!');
	echo'Section only for registered users!<br/>';
	echo $goback;
	footer();
	exit;
}

title('My Files');
div('My Files','b');

$id=intval($_GET['id']);

if(empty($id))
{
	include'includes/func_formatsize.php';
	echo'<img src="images/up.gif" alt="[UP]"/><a href="'.$_SERVER['PHP_SELF'].'?'.SID.'">Up</a><br/>';
	echo $separator;
	echo'<b>Select a category:</b><br/>';
	$q=mysql_query("select * from categorys where parent='0' order by position;");
	while($category=mysql_fetch_array($q))
	{
		$files=mysql_result(mysql_query("select count(id) from files where refcat='".$category['id']."' and author='".$user['id']."|".$user['login']."';"),0);
		$text='<img src="images/dir.gif" alt="[DIR]"/> ';
		$text.='<b><a href="'.$_SERVER['PHP_SELF'].'?mode=myfiles&amp;id='.$category['id'].'&amp;'.SID.'">'.$category['name'].'</a></b>('.$files.')<br/>';
		echo $text;
	}
	echo $separator;
	echo'<u>My Stats:</u><br/>
		<b>Upload files:</b> '.$user['upl_files'].' ('.formatsize($user['upl_files_size']).')<br/>
		<b>Download file:</b> '.$user['dwl_files'].' ('.formatsize($user['dwl_files_size']).')<br/>
		<b>Comments:</b> '.$user['comments'].'<br/>
		<b>Registered:</b> '.date("d-m-Y, H:i",$user['reg_date']).'<br/>';
	echo $separator;
	echo'<u>My Info:</u><br/>
		<b>IP:</b> '.$ip.'<br/>
		<b>Mobile:</b> '.$agent.'<br/>';
}
else
{
	include'includes/func_pages.php';

	$base_url=$_SERVER['PHP_SELF']."?mode=myfiles&amp;id=$id";
	$num_items=mysql_result(mysql_query("select count(id) from files where refcat='$id' and author='".$user['id']."|".$user['login']."';"),0);
	$pages = ceil($num_items/$config['files_on_page']);
	if(!empty($_REQUEST['page']))
	{
		$page = intval($_REQUEST['page']);
		if($page<=0) $page=1;
		if($page>=$pages) $page=$pages;
	}
	else
	{
		$page = 1;
	}
	$start = $page * $config['files_on_page'] - $config['files_on_page'];

	echo'<img src="images/up.gif" alt="[UP]"/><a href="'.$_SERVER['PHP_SELF'].'?mode=myfiles&amp;'.SID.'">Back</a><br/>';
	echo $separator;

	$max=$start+$config['files_on_page'];
	if($max>$num_items) $max=$num_items;
	$total_files = $start + 1;
	if($num_items==0) $total_files=0;
	echo '<b>????? '.$total_files.'-'.$max.' ?? '.$num_items.'</b><br/>';
	echo $separator;

	list($cat_name)=mysql_fetch_array(mysql_query("select name from categorys where id='".$id."';"));
	echo'Your files are in this category <b>'.$cat_name.'</b>:<br/>';
	if($num_items==0) echo'You have no files in this category<br/>';
	$q=mysql_query("select * from files where refcat='$id' and author='".$user['id']."|".$user['login']."' order by uploaded desc limit $start,".$config['files_on_page'].";");
	while($file=mysql_fetch_array($q))
	{
		echo '&#8226; <a href="'.$_SERVER['PHP_SELF'].'?mode=file&amp;id='.$file['id'].'&amp;'.SID.'">'.basename($file['filename']).'</a> ('.$file['downloads'].' downloads)<br/>';
		echo '&#187; '.$file['desc'].'<br/>';
	}
	$page_links=pages($base_url, $pages, $page);
	if(!empty($page_links)) echo $separator.$page_links;
}

echo $separator;
echo $goback;
?>