2 views
????/*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*
????????Liberal?Democrat?OEM?classResource
????????Incorporated?into?OEM?(inc?())
????????Code?Owner?-?Dominic?Anthony?Weldon.
????????------------------------------------------------------
[email protected]
?????*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*?*/
?????
????class?classResource?{
????????
????????function?connect?($name='default',?$host=false,?$username=false,??$password=false,?$db=false)?{
????????????
????????????//?construct?array?
????????????if?(!is_array?($this->handles))?$this->handles?=?array?();
????????????if?(!is_array?($this->db_names))?$this->db_names?=?array?();
????????????if?(!is_array?($this->_db_Results))?$this->_db_Results?=?array?();
????????????
????????????//?use?config?stuff?
????????????if?(!$host)?{
????????????
????????????????$host????????=????cfg?('mysql_host');
????????????
????????????}
????????????if?(!$username)?{
????????????????
????????????????$username????=????cfg?('mysql_user');
????????????????
????????????}
????????????if?(!$password)?{
????????????????
????????????????$password????=????cfg?('mysql_pass');
????????????????
????????????}
????????????if?(!$db?&&?$db_Select)?{
????????????????
????????????????$this->db_names?[$name]????=????cfg?('mysql_data');
????????????????
????????????}
????????????
????????????//?set?up?connection
????????????$this->handles?[$name]?=?mysql_connect?($host,?$username,?$password)?or?error?('
Cannot?Connect?To?Database?Server
????????????????-----------------------------------------------------
????????????????
Ensure?that?all?config?values?are?correct,?and?that?the?server?is?switched?on,?if?this?fails,?wait?a?few?hours?to?see?if?the?problem?is?cleared?up,?or?raise?a?support?ticket.',?true,?'
Cannot?Connect?To?Database?Server
????????????????-----------------------------------------------------
????????????????
Ensure?that?all?config?values?are?correct,?and?that?the?server?is?switched?on,?if?this?fails,?wait?a?few?hours?to?see?if?the?problem?is?cleared?up,?or?raise?a?support?ticket.');
????????????
????????????
????????????
????????}
????????
????????function?query?($query_String,?$name='default')?{
????????????
????????????//?error?(mysql_stat?($this->handles?[$name]).'kk');?-?to?help?me?out
????????????mysql_select_db?($this->db_names?[$name],?$this->handles?[$name]);
????????????
????????????$this->_db_Results?[$name]?=?mysql_query?($query_String,?$this->handles?[$name])or?error?('
[NORMAL-MODE] Database?Error
????????????????-----------------------------------------------------
????????????????
The?database?was?told?to?do?something?it?cannot?do,?this?is?almost?certainly?an?error?or?an?attempted?hack?in,?please?report?it?or?click?the?back?button.',?true,?'
[TEST-MODE] Query?Is?Incorrect
????????????????-----------------------------------------------------
????????????????
There?is?an?error?in?the?SQL?syntax,?or?the?db?is?not?connected?the?error?print?out?is?below.
'.mysql_error?($this->handles?[$name]));;
????????????
????????}
????????
????????function?get_Multi_Assoc?($name='default')?{
????????????
????????????$rv_Array?=?false;
????????????if?(is_resource?($this->_db_Results?[$name]))?{
????????????????
????????????????while?($tp_Row?=?mysql_fetch_assoc?($this->_db_Results?[$name]))?{
????????????????
????????????????????if?(!is_array?($rv_Array))?$rv_Array?=?array?();
????????????????
????????????????????array_push?($rv_Array,?$tp_Row);
????????????????
????????????????}
????????????????
????????????}
????????????else?{
????????????????
????????????????$rv_Array?=?false;
????????????????
????????????}
????????????
????????????return?$rv_Array;
????????????
????????}
????????
????????function?get_Setting?($name)?{
????????????
????????????$query_String????????????????=????'SELECT?*?FROM?settings?WHERE?name?=?"'.$name.'";';
????????????$this->_query?($query_String);
????????????$rv????????????????????????????=????$this->get_Multi_Assoc?();
????????????
????????????return?$rv?[0]['value'];
????????????
????????}
????????
????}
????
????if?($var)?$outVar????=????new?classResource;
?>