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

38 lines
1.0 KiB
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['couponcode']))
{
$couponcode = $_POST['couponcode'];
$db =& JFactory::getDBO();
$query = "SELECT id FROM #__alpha_userpoints_coupons WHERE `couponcode`='".trim($couponcode)."' LIMIT 1";
$db->setQuery( $query );
$couponcodeexist = $db->loadResult();
if( !$couponcodeexist )
{
echo '<font color="red">'.JText::_( 'ARG_THIS_COUPON_CODE_IS_NOT_AVAILABLE' ).'</font>';
}
else
{
echo 'OK';
}
}
?>