-1
I made a small system where the administrator "sends" documents to a particular user, where it sends the info to a BD and generates a folder with the user ID. In the image below is the BD responsible for saving the information of the uploaded files, such as: URL, File Name, Description and the user ID to which the file was sent, which is in the table Identification.
When the client accesses your administrative part, I want to list the documents that have the same ID as him, in case compare the SESSION ID and List the documents that have the same ID.
Below the page where lists the documents, but not in the way I want, because I can not put the link to download and nor description.
require_once 'conexao.php';
include("includes/header.php");
$query = mysql_query("SELECT * FROM usuarios WHERE usuario = '$_SESSION[usuario]' AND senha = '$_SESSION[senha]'") or die(mysql_error());
$cliente = mysql_fetch_assoc($query);
$query = mysql_query("SELECT nome,url FROM arquivos") or die(mysql_error());
$arquivos = mysql_fetch_assoc($query);
$urlbd = $arquivos['url'];
$id = $cliente['id'];
$nome = $arquivos['nome'];
$dir = "../../restrito/adm/uploads/$id";
$url = "../../restrito/adm/uploads/$id/$nome";
$pasta = opendir($dir);
/* Loop para ler os arquivos do diretorio */
while ($arquivo = readdir($pasta)){
/* Verificacao para exibir apenas os arquivos e nao os caminhos para diretorios superiores */
if ($arquivo != '.' && $arquivo != '..'){
/* Escreve o nome do arquivo na tela */
echo "<a href='$urlbd' target='_blank'>$arquivo</a><br>";
}
}