1
I’m developing a system in Joomla! and I need to provide specific files for each user (holerite). I have already managed through the session to know which user is logged in. In the Joomla! , I added an extra field in the database to enter a user registration number, this number is what differentiates the names of the holerite files, would like to make in php a page that lists the files within a directory that contains the user-specific registration number.
Ex.: One of the files has this format
holerith 000956 Dezembro de 2016.pdf
holerith 000957 Dezembro de 2016.pdf
When logging in user 1, his code is 000956 which I have already managed to get through the session. Then I would like to display only its corresponding file, for each user only to see its holerite. Does anyone have any idea how I can do this in PHP?
Incidentally this is the code I used in PHP to pick up 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
?>
https://regex101.com/r/bpyV2O/1
– Rafael Nery