I am developing a system in Joomla! and need to make specific files available to each user (holerite). I already managed through the session to know which user is logged in. In Joomla !, I added an extra field in the database to insert a user's registration number, this number is what differentiates the names of the holerite files, I would like to make in php a page that lists the files inside of a directory that contains the user-specific registry number.
Eg one of the files has this format
holerith 000956 Dezembro de 2016.pdf
holerith 000957 Dezembro de 2016.pdf
When I log on to user 1, his code is 000956 that I have already been able to get through the session. I would then like to display only the corresponding file of it, for each user only to see your netbook. Does anyone have any idea how I can do this in PHP?
Incidentally this is the code I used in PHP to get the Joomla session which user is logged in.
<?php
// Recuperando Sessão do usuário Joomla
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
$path = "\xampp\htdocs\TESTES\Joomla_Teste"; //caminho da instalação do Joomla
define('JPATH_BASE', $path);
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
$mainframe =& JFactory::getApplication('site');
$db = &JFactory::getDBO();
$mainframe->initialise();
$user =& JFactory::getUser( );
echo $user->id; //imprime id do usuário
echo $user->name; //imprime nome do usuário
echo $user->password; // Imprime senha do usuário
echo $user->cod_func; // imprime o código do usuário
?>