FundacionLQDVI_WebCongresos/www/components/com_alpharegistration/assets/scripts/checkreferrer.php

38 lines
999 B
PHP
Raw Normal View History

<?php
define( '_JEXEC', 1 );
if (stristr( $_SERVER['SERVER_SOFTWARE'], 'win32' )) {
define( 'JPATH_BASE', realpath(dirname(__FILE__).'\..\..\..\..' ));
} else define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../../../..' ));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE.DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE.DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
jimport( 'joomla.plugin.plugin' );
JPlugin::loadLanguage( 'com_alpharegistration' );
if(isset($_POST['referrer']))
{
$referrer = $_POST['referrer'];
$db =& JFactory::getDBO();
$query = "SELECT id FROM #__alpha_userpoints WHERE `referreid`='".$referrer."' LIMIT 1";
$db->setQuery( $query );
$refalreadyexist = $db->loadResult();
if( !$refalreadyexist )
{
echo '<font color="red">'.JText::_( 'ARG_THIS_REFERRAL_CODE_NOT_EXIST' ).'</font>';
}
else
{
echo 'OK';
}
}
?>