| Server IP : 195.130.67.5 / Your IP : 216.73.216.231 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/icd/plugins/system/ |
Upload File : |
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component jLogonAlert, version 1.3, 2010-05-11
* @copyright Copyright (C) Carlo Di Giuseppe - www.applejuice.it
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined ('_JEXEC') or die ('Restricted Access');
jimport( 'joomla.plugin.plugin' );
class plgSystemJlogonalert extends JPlugin
{
function plgSystemLogonalert(& $subject, $config) {
parent::__construct($subject, $config);
}
function onLoginFailure( $response )
{
global $option;
$given_user = JRequest::getVar('username');
$given_password = JRequest::getVar('passwd');
$ip = $_SERVER['REMOTE_ADDR'] ;
$site = '';
$query = '';
if ($option == 'com_user')
{
$site = 'FrontEnd';
$query = 'SELECT a.email,a.username,b.testo_personalizzato,b.messaggio FROM #__users a, #__ajlaemails b WHERE a.id = b.id_utente AND b.published = 1 AND b.avviso_frontend = 1';
}
else
{
$site = "BackEnd";
$query = 'SELECT a.email,a.username,b.testo_personalizzato,b.messaggio FROM #__users a, #__ajlaemails b WHERE a.id = b.id_utente AND b.published = 1 AND b.avviso_backend = 1';
}
// Get a database object
$db =& JFactory::getDBO();
$db->setQuery( $query );
$result = $db->loadObjectList();
$plugin = JPluginHelper::getPlugin('system','jlogonalert');
$pluginparams = new JParameter($plugin->params);
$sender = $pluginparams->get('default_sender');
foreach ($result as $row)
{
if ($row->testo_personalizzato == 0)
{
$messaggio = $pluginparams->get('default_message');
}
else
{
$messaggio = $row->messaggio;
}
if ($given_user != '')
$this->inviaEmail($row->email,$messaggio,$given_user,$given_password,$ip,$site,$sender,'Failed Login');
}
}
function onLoginUser( $response )
{
global $option;
$given_user = JRequest::getVar('username');
$given_password = JRequest::getVar('passwd');
$ip = $_SERVER['REMOTE_ADDR'] ;
$site = '';
$query = '';
if ($option == 'com_user')
{
$site = 'FrontEnd';
$query = 'SELECT a.email,a.username,b.testo_personalizzato,b.messaggio FROM #__users a, #__ajlaemails b WHERE a.id = b.id_utente AND b.published = 1 AND b.avviso_frontend = 1 AND b.alert_success = 1';
}
else
{
$site = "BackEnd";
$query = 'SELECT a.email,a.username,b.testo_personalizzato,b.messaggio FROM #__users a, #__ajlaemails b WHERE a.id = b.id_utente AND b.published = 1 AND b.avviso_backend = 1 AND b.alert_successb = 1';
}
// Get a database object
$db =& JFactory::getDBO();
$db->setQuery( $query );
$result = $db->loadObjectList();
$plugin = JPluginHelper::getPlugin('system','jlogonalert');
$pluginparams = new JParameter($plugin->params);
$sender = $pluginparams->get('default_sender');
foreach ($result as $row)
{
if ($row->testo_personalizzato == 0)
{
$messaggio = $pluginparams->get('default_message');
}
else
{
$messaggio = $row->messaggio;
}
if ($given_user != '')
$this->inviaEmail($row->email,$messaggio,$given_user,$given_password,$ip,$site,$sender,'Correct Login');
}
return true;
}
function inviaEmail($email,$messaggio,$given_user,$given_password,$ip,$site,$sender, $oggetto)
{
jimport ('joomla.mail.helper');
$subject = JMailHelper::cleanSubject($oggetto);
$tmp = str_replace("{client_ip}", $ip, $messaggio);
$tmp = str_replace("{given_user}",$given_user,$tmp);
$tmp = str_replace("{given_password}",$given_password,$tmp);
$tmp = str_replace("{site}",$site,$tmp);
$body = JMailHelper::cleanBody($tmp);
$config =& JFactory::getConfig();
$siteName = $config->getValue( 'config.sitename' );
if (!JUtility::sendMail($sender, $siteName." - Logon Alert - ".$site ,$email,$subject,$body))
JError::raiseError(500,'Failed to send email !');
}
}
?>