function user_get_data($id) { global $_CONF, $DBc_char; $DBc_align = new mySQL($_CONF['mysql_error']); $DBc_align->connect($_CONF['char_mysql_server'], $_CONF['char_mysql_user'], $_CONF['char_mysql_pass'], $_CONF['char_mysql_database']); $res = $DBc_char->sqlQuery("SELECT cid FROM players WHERE id='" . $DBc_char->sqlEscape($id) . "'"); $res = $DBc_align->sendSQL("SELECT race,civilisation,cult FROM characters WHERE char_id='" . $res[0]['cid'] . "'", "ARRAY"); return $res[0]; }
/** * @return mySQL|null */ public static function getInstance() { if (self::$instance == null) { self::$instance = new mySQL(); } return self::$instance; }
eval('$tmp = new ' . $elem . '();'); $_DATASOURCE->addSource($tmp); } #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'] . ") ... ");
<?php include 'connection_class.php'; $connect = new mySQL(); $connect2 = new mySQL(); $connect->connect('localhost', 'root', 'root', 'user_registration'); //testing the connection class to see if it works I should be able to initiate two or more connections //$connect2->connect('localhost','roots','root','guestbook');
public function updateData($insert = false) { $queryData = new mySQLQueryData(); foreach ($this->mySQLRowDataChanges as $column => $value) { if ($value != null) { $queryData->addSetter($this->mySQLTable->fetchColumn($column), $value); } } if ($this->isNewRow) { $mySQLQuery = new mySQLQueryInsert(); $mySQLQuery->setTable($this->mySQLTable)->setData($queryData); } else { $primaryKey = $this->mySQLTable->getPrimaryKey(); $mySQLQuery = new mySQLQueryUpdate(); $mySQLQuery->setTable($this->mySQLTable)->setData($queryData)->setWhere(new mySQLClause($primaryKey, new mySQLOperatorIsEqualTo(), $this->mySQLRowData[$primaryKey->Field])); } $mySQL = new mySQL($mySQLQuery, $this->mySQLConnection); $return = $mySQL->executeQuery(); if ($return) { $this->mySQLRowDataChanges = array(); return true; } else { return $return; } }
public function configure($dbServer, $userName, $password, $db) { $this->db = $db; $this->dbServer = $dbServer; $this->dbPassword = $password; $this->dbUsername = $userName; self::$instance = $this; }
public function __construct() { $sql = mySQL::getInstance(); $sql->connect(); $this->connection = $sql->getConnection(); }
function getCult() { return "%"; } function getCiv() { return "%"; } function getRace() { return "%"; } } $_USER = new RUser(); //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_achievements>'; function print_cat(&$iter3) { while ($iter3->hasNext()) { $curr3 = $iter3->getNext(); echo "<achievement id='" . $curr3->getID() . "' parent='" . $curr3->getParentID() . "' image='" . $_CONF['image_url'] . "pic/icon/" . $curr3->getImage() . "'><name><![CDATA[" . $curr3->getName() . "]]></name><ties>"; if ($curr3->getTieRace() != null) { echo "<tie type='race'>" . $curr3->getTieRace() . "</tie>"; } if ($curr3->getTieCult() != null) { echo "<tie type='cult'>" . $curr3->getTieCult() . "</tie>"; } if ($curr3->getTieCiv() != null) { echo "<tie type='civilization'>" . $curr3->getTieCiv() . "</tie>";
<?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>";