<?php
global $_CB_framework, $mainframe, $_CB_database, $theScore;
define( '_JEXEC', 1 );
define('JPATH_BASE', 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');
jimport('joomla.base.observable');
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
} else {
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
}
cbimport( 'cb.database' );
cbimport( 'cb.html' );
cbimport( 'cb.plugins' );
$myId = $_CB_framework->myId();
$cbUser =& CBuser::getInstance( $myId );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$user =& $cbUser->getUserData();
$gameField=$_POST['gameField'];
$lastScore = $cbUser->getField( $gameField, null, 'html', 'none', 'list' );
// $_CB_database->setQuery("UPDATE jos_comprofiler SET cb_instruments = 'Flute' WHERE user_id = $myId");
$thisScore=$_POST['theScore'];
if ($thisScore > $lastScore) {
$_CB_database->setQuery("UPDATE jos_comprofiler SET $gameField = $thisScore WHERE user_id = $myId");
echo $_CB_database->loadResult();
writeVariable( "newHigh", "1" );
}
else {
writeVariable( "newHigh", "0" );
}
$numVariables = 0;
function writeVariable( $name, $value )
{
if( $numVariables > 0 )
{
echo '&';
}
echo $name . '=' . urlencode($value);
$numVariables ++;
}
echo $myId;
php?>
Please Log in to join the conversation.
Please Log in to join the conversation.