questa è una parte del codice che ho per recuperare i dati dal terzo database (SLS), e qui dentro dovrei mettere il paragone con quello del secondo database (forum), ma purtoppo non so come fare
Codice: Seleziona tutto
//StartSessionSafe();
SetLanguageCookie();
DecideLanguage($prefs['DEF_LANG'], LANG_MAIN);
DecideLanguage($prefs['DEF_LANG'], LANG_BUTTONS);
DecideLanguage($prefs['DEF_LANG'], LANG_SYSTEM);
require_once 'lang/system_lang_english.php';
require_once 'lang/lang_english.php';
require_once 'lang/buttons_lang_english.php';
@include_once 'lang/system_lang_' . GetLanguage (LANG_SYSTEM) . '.php';
@include_once 'lang/lang_' . GetLanguage (LANG_MAIN) . '.php';
@include_once 'lang/buttons_lang_' . GetLanguage (LANG_BUTTONS) . '.php';
class InfoPage extends CTABgen
{
var $form;
var $dbGroups;
var $formstyle;
var $ID;
var $IDclient;
var $TableB;
var $dbCountry;
var $dbCars;
var $dbCarClass;
var $db;
function InfoPage (&$dataarray, $keyname)
{
$this->SetData($dataarray, $keyname);
$this->CTABgen();
$this->user_rights = CRights::GetUserRights($this->GetCurrentUserData('UID'));
$this->db = new CDriversCarClass();
$this->dbFiles = new CFiles();
$this->dbCons = new CStandings();
}
function Local_Header ()
{
global $lang;
if (empty($this->dataarray['dst'])) $this->dataarray['dst'] = '';
if ($this->dataarray['dst']=='res') PrintHeader('career');
else PrintHeader('gtr_drv_details');
global $SYSTEM_OK;
global $prefs;
$SYSTEM_OK = true;
$com_arr = array('tab_dd_common_up.gif', 'tab_dd_common_down.gif');
$res_arr = array('tab_dd_results_up.gif', 'tab_dd_results_down.gif');
$tabs = PrintMainMenuDrop($link_arr,0,'center');
}
function Local_Generate()
{
if (empty($this->dataarray['dst'])) $this->Local_Generate_General();
else $this->Local_Generate_General();
}
function Local_Generate_General()
{
global $prefs;
if (empty($this->dataarray['IDdriver'])) return false;
$persdata = '';
$this->db->GetSelectedData('IDdriver=' . $this->dataarray['IDdriver']);
$this->dbFiles->SetAddFields('IDfile');
$this->dbFiles->SetAllFields(false);
if (!$this->dbFiles->GetSelectedData('FileType=' . FTYPE_DRVPHOTO . ' AND IDdriver=' . $this->dataarray['IDdriver']))
{
$this->PrintError($this->dbFiles->GetErrorDescription());
return false;
}
$show_hidden = empty($this->user_rights['superadmin']) ? false : true;
$table = new CTable();
$table->SetPrintReturn(true);
$this->dbCons->SetPersistentFilter('IDdriver='. $this->ID);
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('QualPos=1');
$this->dbCons->GetAllRecords();
$PP = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('RacePos<=5');
$this->dbCons->GetAllRecords();
$TOP5 = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('RacePos<=8');
$this->dbCons->GetAllRecords();
$TOP8 = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('RacePos<=10');
$this->dbCons->GetAllRecords();
$TOP10 = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('RacePos=1');
$this->dbCons->GetAllRecords();
$WINS = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('RacePos=2');
$this->dbCons->GetAllRecords();
$WINS2 = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('RacePos=3');
$this->dbCons->GetAllRecords();
$WINS3 = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(*) AS RES');
$this->dbCons->SetFilter('');
$this->dbCons->GetAllRecords();
$EVENTS = $this->dbCons->Fields['RES'];
$this->dbCons->SetAllFields(false);
$this->dbCons->SetAddFields('Count(DISTINCT IDseason) AS RES');
$this->dbCons->GetAllRecords();
$SEASONS = $this->dbCons->Fields['RES'];
$table = new CTable();
$table->SetPrintReturn(true);
$stat = $table->OpenTable(0);
$stat .= $table->PrintData($this->lang['drvdet_nick'], '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($this->db->Fields['Nick'], '4', '', 'det_value','color:#828282');
$stat .= $table->NextRow();
$stat .= $table->PrintData($this->lang['drvdet_cseas'], '', '', 'det_name','width:25%;color:#000000');
$stat .= $table->PrintData($SEASONS, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->PrintData($this->lang['drvdet_cevents'], '', '', 'det_name','width:25%;color:#000000');
$stat .= $table->PrintData($EVENTS, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->PrintData($this->lang['drvdet_cppso'], '', '', 'det_name','width:25%;color:#000000');
$stat .= $table->PrintData($PP, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->NextRow();
$stat .= $table->PrintData($this->lang['drvdet_cwins'], '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($WINS, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->PrintData($this->lang['drvdet_cwins2'], '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($WINS2, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->PrintData($this->lang['drvdet_cwins3'], '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($WINS3, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->NextRow();
$stat .= $table->PrintData($this->lang['drvdet_ctop5'], '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($TOP5, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->PrintData($this->lang['drvdet_ctop8'], '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($TOP8, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->PrintData(str_replace('8','10',$this->lang['drvdet_ctop8']), '', '', 'det_name','color:#000000');
$stat .= $table->PrintData($TOP10, '', '', 'det_value','text-align: right;color:#828282');
$stat .= $table->CloseTable();
$this->tableA->OpenTable();
$this->tableA->PrintData($stat, '', '', '', 'width:245px;vertical-align:top;background-color: #e1ebf2;');
$this->tableA->CloseTable();
}
}
$a = new InfoPage(GetHTTPVAR('dataarray'), 'IDdriver');
$a->SetLanguage($lang);
$a->Generate(GEN_STATUS_ERRONLY);
PrintFooter ();