} #REPLACE WITH REGEX!!! $tmp = explode("/", $_REQUEST['file']); $tmp2 = explode("_", $tmp[sizeof($tmp) - 1]); $DBc->database($CONF['webig_mysql_database']); $res = $DBc->sendSQL("SELECT id FROM players WHERE cid='" . $DBc->mre($tmp2[1] * 16 + $tmp2[2]) . "' AND deleted='0'", "ARRAY"); #$res[0]['id'] = 1; if ($res[0]['id'] > 0 == false) { $log->logf("ERROR: no character found!"); $log->close(); die; } $cdata = array("cid" => $res[0]['id'], "aid" => $tmp2[1], "sid" => $tmp2[2]); $DBc_char = new mySQL($CONF['mysql_error']); $DBc_char->connect($CONF['char_mysql_server'], $CONF['char_mysql_user'], $CONF['char_mysql_pass'], $CONF['char_mysql_database']); $res = $DBc_char->sendSQL("SELECT race,civilisation,cult FROM characters WHERE char_id='" . $DBc_char->mre($tmp2[1] * 16 + $tmp2[2]) . "'", "ARRAY"); $cdata['race'] = $res[0]['race']; $cdata['civ'] = $res[0]['civilisation']; $cdata['cult'] = $res[0]['cult']; #$cdata = array("cid"=>1,"aid"=>1,"sid"=>1); $DBc->database($CONF['mysql_database']); #echo var_export($cdata); #$log->logf(" done!"); $microstop = explode(' ', microtime()); $stop_time = $microstop[0] + $microstop[1]; #$log->logf("Expired time: ".($stop_time - $start_time)); #foreach($chars as $cid) { #STEP 1: load and register atoms $log->logf("Processing char '" . $cdata['cid'] . "' (" . $cdata['race'] . "," . $cdata['cult'] . "," . $cdata['civ'] . ") ... "); #$log->logi("Loading and registering Atoms... ",false); $atom_list = array();
<?php header('Content-type: text/xml'); error_reporting(E_ALL ^ E_NOTICE); ini_set("display_errors", "1"); require_once "class/mySQL_class.php"; require_once "conf.php"; //create database connection $DBc = new mySQL($_CONF['mysql_error']); $DBc->connect($_CONF['mysql_server'], $_CONF['mysql_user'], $_CONF['mysql_pass'], $_CONF['mysql_database']); echo '<?xml version="1.0" ?><ryzom_progress>'; echo "<character id='" . $_REQUEST['cid'] . "' />"; echo "<tasks>"; $res = $DBc->sendSQL("SELECT * FROM ach_player_task WHERE apt_player='" . $DBc->mre($_REQUEST['cid']) . "'", "ARRAY"); foreach ($res as $elem) { echo "<task id='" . $elem['apt_task'] . "' date='" . $elem['apt_date'] . "' />"; } echo "</tasks>"; echo "<objectives>"; echo "<done>"; $res = $DBc->sendSQL("SELECT * FROM ach_player_objective WHERE apo_player='" . $DBc->mre($_REQUEST['cid']) . "'", "ARRAY"); foreach ($res as $elem) { echo "<objective id='" . $elem['apo_objective'] . "' date='" . $elem['apo_date'] . "' />"; } echo "</done><open>"; $res = $DBc->sendSQL("SELECT ao_id,(SELECT count(*) FROM ach_player_atom,ach_atom WHERE apa_player='" . $DBc->mre($_REQUEST['cid']) . "' AND atom_id=apa_atom AND atom_objective=ao_id) as anz FROM ach_objective WHERE ao_display='value' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='" . $DBc->mre($_REQUEST['cid']) . "' AND apo_objective='ao_id') AND EXISTS (SELECT * FROM ach_player_atom,ach_atom WHERE apa_player='" . $DBc->mre($_REQUEST['cid']) . "' AND atom_id=apa_atom AND atom_objective=ao_id)", "ARRAY"); foreach ($res as $elem) { echo "<objective id='" . $elem['ao_id'] . "' value='" . $elem['anz'] . "' />"; } echo "</open>"; echo "</objectives>";