$plateNo = $_POST['txtPlateNo']; $engineNo = $_POST['txtEngineNo']; $chassisNo = $_POST['txtChassisNo']; $serialNo = $_POST['txtSerialNo']; $acquisitionCost = str_replace(",","",$_POST['txtAcquisitionCost']); $insuranceCost = str_replace(",","",$_POST['txtInsuranceCost']); $registrationCost = str_replace(",","",$_POST['txtRegistrationCost']); $depresitionValue = str_replace(",","",$_POST['txtDepresitionValue']); $status = $_POST['txtStatus']; $dir = EQUIPMENTPICS . $id; // NEW NO FOR ASSIGNEE EQUIPMENT $newNum = getnewCtrlNo("assignee_equipment"); // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET EQUIPMENT $equipment = new Table; $equipment->setSQLType($fms_db->getSQLType()); $equipment->setInstance($fms_db->getInstance()); $equipment->setTable("equipmentmaster"); $equipment->setValues("$ePhoto assigneeID = '$assignee',companyID = '$company',categoryID = '$category',makeID = '$make' ,locationID = '$location',modelID = '$model',color = '$color' ,mileageStart = '$mileageStart',mileageEnd = '$mileageEnd' ,gasolineAllocationInLiters = '$gasolineAllocationInLiters',gasolineAllocationInCash = '$gasolineAllocationInCash' ,insuranceAppliedDate = '$insuranceAppliedDate',insuranceExpirationDate = '$insuranceExpirationDate' ,insuranceReminderInDays = '$insuranceReminderInDays',purchaseDate = '$purchaseDate' ,conductionSticker = '$conductionSticker',year = '$year',plateNo = '$plateNo',engineNo = '$engineNo' ,chassisNo = '$chassisNo',serialNo = '$serialNo',acquisitionCost = '$acquisitionCost'
public function __construct() { self::$DB_CONNSTRING = "mysql:host=127.0.0.1;dbname=storenmore"; self::$DB_USERNAME = "******"; self::$DB_PASSWORD = "******"; }
/** * 初始化连接对象的数据(准备连接数据) * * @throws \ErrorException */ protected static function initConnection() { $readConfig = new DBConfig(); self::$conn_list = $readConfig->getAllConnection(); self::$conn_list['db'] = $readConfig->getDefaultConnection(); self::$conn_name_list = array_keys(self::$conn_list); }
protected function loadConfig($database, $type) { is_null($this->configs[$type]) && ($this->configs[$type] = DBConfig::instance()->loadConfig($database, $type)); $conf = $this->configs[$type]->current(); $this->configs[$type]->next(); !$this->configs[$type]->valid() && $this->configs[$type]->rewind(); return $conf; }
private function __construct() { // Get db configuration and then connect $dsn = DBConfig::dbVars(); $this->dbconn =& DB::Connect($dsn, array()); if (PEAR::isError($this->dbconn)) { throw new Exception('Unable to connect to the database'); } }
/** * @param $db_id * @return null|\OLOG\DB\DB */ public static function getDB($db_id) { static $pdo_arr = array(); // check static cache if (isset($pdo_arr[$db_id])) { return $pdo_arr[$db_id]; } $db_settings_obj = DBConfig::getDBSettingsObj($db_id); $pdo_arr[$db_id] = new \OLOG\DB\DB($db_settings_obj); return $pdo_arr[$db_id]; }
/** * makeConfig Wrap the associative configuration array inside a DBConfig class * * @access public * @return void * @note the Database configuration should be of the following format: * mixed[] $configuration { * @type string "type" Database type as used in PDO DSN * @type string "host" Database host * @type string "host" Database port * @type integer "name" Database name * @type boolean "username" Database username * @type string "password" Database password * } */ protected function makeConfig() { $this->_checkConfig(); // Construct the DBConfig object $dbConfig = new DBConfig(); $dbConfig->setName($this->_config['name']); $dbConfig->setType($this->_config['type']); $dbConfig->setHost($this->_config['host']); if (isset($this->_config['port'])) { $dbConfig->setPort($this->_config['port']); } $dbConfig->setUser($this->_config['user']); $dbConfig->setPassword($this->_config['password']); return $dbConfig; }
/** * Constructor. */ public function __construct() { if (RunLevel::get() == RunLevel::PRODUCTION) { self::$dsn = 'mysql:host=PRODUCTION-DB-NODE-NAME;dbname=DBNAME'; self::$username = '******'; self::$password = '******'; } elseif (RunLevel::get() == RunLevel::STAGING) { self::$dsn = 'mysql:host=STAGING-DB-NODE-NAME;dbname=DBNAME'; self::$username = '******'; self::$password = '******'; } else { self::$dsn = 'mysql:host=localhost;dbname=DBNAME'; self::$username = '******'; self::$password = ''; } }
private function configdata() { $data = array('admin_name' => '', 'admin_pass' => '', 'licensekey' => '', 'mysql_host' => '', 'mysql_database' => '', 'mysql_username' => '', 'mysql_password' => '', 'next' => false, 'errors' => array()); if ($_POST) { $data = $_POST; $data['next'] = false; $val = Validation::forge('users'); $val->add_field('admin_name', 'Admin name', 'required|min_length[4]|max_length[250]'); $val->add_field('admin_pass', 'Admin password', 'required|min_length[4]|max_length[250]'); $val->add_field('licensekey', 'License key', 'required|min_length[4]|max_length[250]'); $val->add_field('mysql_host', 'Mysql host', 'required|min_length[4]|max_length[250]'); $val->add_field('mysql_database', 'Mysql database', 'required|min_length[4]|max_length[250]'); $val->add_field('mysql_username', 'Mysql username', 'required|min_length[4]|max_length[250]'); $val->add_field('mysql_password', 'Mysql password', 'required|min_length[4]|max_length[250]'); $conn = false; if ($val->run()) { $data['next'] = false; $DB = new DBConfig(); $conn = $DB->test($val->validated('mysql_host'), $val->validated('mysql_username'), $val->validated('mysql_password'), $val->validated('mysql_database')); $data['errors'] = array($conn); if (!$conn) { $data['next'] = true; } } else { $data['errors'] = $val->error(); } } return $data; }
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET USER ACCESS $usermenu = new Table; $usermenu->setSQLType($fms_db->getSQLType()); $usermenu->setInstance($fms_db->getInstance()); $usermenu->setView("v_usermenu"); $usermenu->setParam("WHERE userID = '$sys_UserID'"); $usermenu->doQuery("query"); $row_usermenu = $usermenu->getLists(); // SET USER ACCESS $menumst = new Table; $menumst->setSQLType($fms_db->getSQLType()); $menumst->setInstance($fms_db->getInstance()); $menumst->setView("v_menumaster"); $menumst->setParam("WHERE menuID NOT IN(SELECT menuID FROM v_usermenu)"); $menumst->doQuery("query"); $row_menumst = $menumst->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>
} // -- END EDIT SUPPLIER -- // -- START UPDATE SUPPLIER -- if(isset($_POST['update']) && !empty($_POST['update']) && $_POST['update'] == 1){ $id = $_GET['id']; $suppName = $_POST['txtSupplierName']; $suppAddress = $_POST['txtSupplierAddress']; $suppEmailAddress = $_POST['txtSupplierEmailAddress']; $suppContactNo = $_POST['txtSupplierContactNo']; $suppContactPerson = $_POST['txtSupplierContactPerson']; $suppTIN = $_POST['txtSupplierTIN']; $status = $_POST['txtStatus']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET SUPPLIER $supplier = new Table; $supplier->setSQLType($fms_db->getSQLType()); $supplier->setInstance($fms_db->getInstance()); $supplier->setTable("suppliermaster"); $supplier->setValues("supplierName = '$suppName',supplierAddress = '$suppAddress',supplierEmailAddress = '$suppEmailAddress' ,supplierContactNo = '$suppContactNo',contactPerson = '$suppContactPerson',TIN = '$suppTIN' ,modifiedBy = '$sys_UserID', modifiedDate = '$today', status = '$status'"); $supplier->setParam("WHERE supplierID = '$id'"); $supplier->doQuery("update"); // CLOSING FMS DB $fms_db->DBClose();
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET WORK ORDER $workordermst = new Table; $workordermst->setSQLType($fms_db->getSQLType()); $workordermst->setInstance($fms_db->getInstance()); $workordermst->setView("v_workordermaster"); $workordermst->setParam("WHERE status NOT IN('6','7','8') ORDER BY status ASC, woReferenceNo DESC, woTransactionDate DESC"); $workordermst->doQuery("query"); $row_workordermst = $workordermst->getLists(); // SET SERVICE TYPE $servicetypemst = new Table; $servicetypemst->setSQLType($fms_db->getSQLType()); $servicetypemst->setInstance($fms_db->getInstance()); $servicetypemst->setView("v_servicetypemaster"); $servicetypemst->setParam("WHERE status = '1'"); $servicetypemst->doQuery("query"); $row_servicetypemst = $servicetypemst->getLists(); // SET EQUIPMENT $equipmentmst = new Table; $equipmentmst->setSQLType($fms_db->getSQLType()); $equipmentmst->setInstance($fms_db->getInstance()); $equipmentmst->setView("v_equipmentmaster"); $equipmentmst->setParam("WHERE status = '1'"); $equipmentmst->doQuery("query"); $row_equipmentmst = $equipmentmst->getLists();
// CLOSING FMS DB $fms_db->DBClose(); $status = $row_servicetype[0]['status']; } // -- END EDIT SERVICE TYPE -- // -- START UPDATE SERVICE TYPE -- if(isset($_POST['update']) && !empty($_POST['update']) && $_POST['update'] == 1){ $id = $_GET['id']; $desc = $_POST['txtDescription']; $status = $_POST['txtStatus']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET SERVICE TYPE $servicetype = new Table; $servicetype->setSQLType($fms_db->getSQLType()); $servicetype->setInstance($fms_db->getInstance()); $servicetype->setTable("servicetypemaster"); $servicetype->setValues("description = '$desc', modifiedBy = '$sys_UserID', modifiedDate = '$today', status = '$status'"); $servicetype->setParam("WHERE serviceTypeID = '$id'"); $servicetype->doQuery("update"); // CLOSING FMS DB $fms_db->DBClose(); $url = BASE_URL . V_SERVICETYPE;
} } public function error($type = '') { //Choose error type if (empty($type)) { return false; } else { if ($type == 1) { echo "<strong>Database could not connect</strong> "; } else { if ($type == 2) { echo "<strong>mysql error</strong> " . mysql_error(); } else { if ($type == 3) { echo "<strong>error </strong>, Proses has been stopped"; } else { echo "<strong>error </strong>, no connection !!!"; } } } } } } // example to use $DB = new DBConfig(); $DB->config(); $DB->conn(); // mysql command // mysql_query and others.. $DB->close();
public static function set($config) { self::$config = $config; }
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET MAKE $invoicing = new Table; $invoicing->setSQLType($fms_db->getSQLType()); $invoicing->setInstance($fms_db->getInstance()); $invoicing->setView("v_equipmentrepairedmaster"); $invoicing->setParam("WHERE noOfTransactions > 0 ORDER BY companyName "); $invoicing->doQuery("query"); $row_invoicing = $invoicing->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); if(isset($_GET['type']) && !empty($_GET['type'])){ $type = $_GET['type']; $id = $_GET['id']; switch($type){ case "e": $where = "equipmentID = '$id'"; // SET ASSIGNEE $assigneemst = new Table; $assigneemst->setSQLType($fms_db->getSQLType()); $assigneemst->setInstance($fms_db->getInstance()); $assigneemst->setView("v_assigneemaster"); $assigneemst->setParam("ORDER BY assigneeID"); $assigneemst->doQuery("query"); $row_assigneemst = $assigneemst->getLists(); break; case "a": $where = "assigneeID = '$id'"; // SET EQUIPMENT $equipmentmst = new Table; $equipmentmst->setSQLType($fms_db->getSQLType()); $equipmentmst->setInstance($fms_db->getInstance()); $equipmentmst->setView("v_equipmentmaster"); $equipmentmst->setParam("ORDER BY equipmentID"); $equipmentmst->doQuery("query");
UpdateCtrlNo("user_assignee"); $url = BASE_URL . V_USERASSIGNEE . "?id=" . $userid; $msg = "User Assignee was successfully tagged."; $alert = new MessageAlert(); $alert->setURL($url); $alert->setMessage($msg); $alert->Alert(); } if(isset($_GET['user_assignee_remove']) && !empty($_GET['user_assignee_remove']) && $_GET['user_assignee_remove'] == '1'){ $assigneeid = $_GET['assigneeid']; $userid = $_GET['userid']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SAVE NEW USER MENU $ins_assignee = new Table; $ins_assignee->setSQLType($fms_db->getSQLType()); $ins_assignee->setInstance($fms_db->getInstance()); $ins_assignee->setTable("assigneemapper"); $ins_assignee->setParam("WHERE userID = '$userid' AND assigneeID = '$assigneeid' AND type = 'user_assignee'"); $ins_assignee->doQuery("delete"); // CLOSING FMS DB $fms_db->DBClose(); $url = BASE_URL . V_USERASSIGNEE . "?id=" . $userid; $msg = "User Assignee was successfully untagged.";
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET CONTROL NO $usermenu_access = new Table; $usermenu_access->setSQLType($fms_db->getSQLType()); $usermenu_access->setInstance($fms_db->getInstance()); $usermenu_access->setView("v_usermenu"); $usermenu_access->setParam("WHERE userID = '$sys_UserID'"); $usermenu_access->doQuery("query"); $row_usermenu_access = $usermenu_access->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>
<? $id = $_GET['id']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET USER ACCESS $userassignee = new Table; $userassignee->setSQLType($fms_db->getSQLType()); $userassignee->setInstance($fms_db->getInstance()); $userassignee->setView("v_userassigneemapper"); $userassignee->setParam("WHERE userID = '$id'"); $userassignee->doQuery("query"); $row_userassignee = $userassignee->getLists(); $num_userassignee = $userassignee->getNumRows(); // SET USER ACCESS $assigneemst = new Table; $assigneemst->setSQLType($fms_db->getSQLType()); $assigneemst->setInstance($fms_db->getInstance()); $assigneemst->setView("v_assigneemaster"); $assigneemst->setParam("WHERE assigneeID NOT IN(SELECT assigneeID FROM v_userassigneemapper)"); $assigneemst->doQuery("query"); $row_assigneemst = $assigneemst->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>
UpdateCtrlNo("assignee_company"); $url = BASE_URL . V_ASSIGNEECOMPANY . "?id=" . $assigneeid; $msg = "Company was successfully tagged to Assignee."; $alert = new MessageAlert(); $alert->setURL($url); $alert->setMessage($msg); $alert->Alert(); } if(isset($_GET['assignee_company_remove']) && !empty($_GET['assignee_company_remove']) && $_GET['assignee_company_remove'] == '1'){ $assigneeid = $_GET['id']; $companyid = $_GET['companyid']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SAVE NEW USER MENU $upd_assigneecompany = new Table; $upd_assigneecompany->setSQLType($fms_db->getSQLType()); $upd_assigneecompany->setInstance($fms_db->getInstance()); $upd_assigneecompany->setTable("assigneemapper"); $upd_assigneecompany->setParam("WHERE companyID = '$companyid' AND assigneeID = '$assigneeid' AND type = 'assignee_company'"); $upd_assigneecompany->doQuery("delete"); // CLOSING FMS DB $fms_db->DBClose(); $url = BASE_URL . V_ASSIGNEECOMPANY . "?id=" . $assigneeid; $msg = "Company was successfully untagged to Assignee.";
// CLOSING FMS DB $fms_db->DBClose(); $status = $row_location[0]['status']; } // -- END EDIT LOCATION -- // -- START UPDATE LOCATION -- if(isset($_POST['update']) && !empty($_POST['update']) && $_POST['update'] == 1){ $id = $_GET['id']; $locName = $_POST['txtLocationName']; $status = $_POST['txtStatus']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET LOCATION $location = new Table; $location->setSQLType($fms_db->getSQLType()); $location->setInstance($fms_db->getInstance()); $location->setTable("locationmaster"); $location->setValues("locationName = '$locName', modifiedBy = '$sys_UserID', modifiedDate = '$today', status = '$status'"); $location->setParam("WHERE locationID = '$id'"); $location->doQuery("update"); // CLOSING FMS DB $fms_db->DBClose(); $url = BASE_URL . V_LOCATION;
// CLOSING FMS DB $fms_db->DBClose(); $status = $row_make[0]['status']; } // -- END EDIT CATEGORY -- // -- START UPDATE MAKE -- if(isset($_POST['update']) && !empty($_POST['update']) && $_POST['update'] == 1){ $id = $_GET['id']; $makeName = $_POST['txtMakeName']; $status = $_POST['txtStatus']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET MAKE $make = new Table; $make->setSQLType($fms_db->getSQLType()); $make->setInstance($fms_db->getInstance()); $make->setTable("makemaster"); $make->setValues("makeName = '$makeName', modifiedBy = '$sys_UserID', modifiedDate = '$today', status = '$status'"); $make->setParam("WHERE makeID = '$id'"); $make->doQuery("update"); // CLOSING FMS DB $fms_db->DBClose(); $url = BASE_URL . V_MAKE;
$alert = new MessageAlert(); $alert->setURL($url); $alert->setMessage($msg); $alert->Alert(); } } // -- END WORK ORDER FOR APPROVAL // APPROVED WORK ORDER if(isset($_POST['approved']) && !empty($_POST['approved']) && $_POST['approved'] == 1){ $apprRemarks = $_POST['txtApproverRemarks']; $status = $_POST['txtStatus']; $id = $worefno; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET WORK ORDER $workorder = new Table; $workorder->setSQLType($fms_db->getSQLType()); $workorder->setInstance($fms_db->getInstance()); $workorder->setTable("workordermaster"); $workorder->setValues("approverRemarks = '$apprRemarks', status = '$status', approvedDate = '$today'"); $workorder->setParam("WHERE woReferenceNo = '$id'"); $workorder->doQuery("update"); // CLOSING FMS DB $fms_db->DBClose(); switch($status){
$status = $row_ctrlno[0]['status']; } // -- END EDIT CONTROL NO -- // -- START UPDATE CONTROL NO -- if(isset($_POST['update']) && !empty($_POST['update']) && $_POST['update'] == 1){ $id = $_GET['id']; $desc = $_POST['txtDescription']; $type = $_POST['txtControlType']; $code = $_POST['txtControlCode']; $noofdigit = $_POST['txtNoOfDigit']; $lastdigit = $_POST['txtLastDigit']; $status = $_POST['txtStatus']; // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET CONTROL NO $ctrlno = new Table; $ctrlno->setSQLType($fms_db->getSQLType()); $ctrlno->setInstance($fms_db->getInstance()); $ctrlno->setTable("controlnomaster"); $ctrlno->setValues("description = '$desc', type = '$type', code = '$code', noOfDigit = '$noofdigit' , lastDigit = '$lastdigit', modifiedBy = '$sys_UserID', modifiedDate = '$today', status = '$status'"); $ctrlno->setParam("WHERE id = '$id'"); $ctrlno->doQuery("update"); $row_ctrlno = $ctrlno->getLists(); $res_ctrlno = $ctrlno->getError(); // CLOSING FMS DB
public function __construct() { self::$DB_CONNSTRING = "mysql:host=127.0.0.1;dbname=atms"; self::$DB_USERNAME = "******"; self::$DB_PASSWORD = "******"; }
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET CATEGORY $categorymst = new Table; $categorymst->setSQLType($fms_db->getSQLType()); $categorymst->setInstance($fms_db->getInstance()); $categorymst->setView("v_categorymaster"); $categorymst->setParam("ORDER BY categoryID"); $categorymst->doQuery("query"); $row_categorymst = $categorymst->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET PARTS $partsmst = new Table; $partsmst->setSQLType($fms_db->getSQLType()); $partsmst->setInstance($fms_db->getInstance()); $partsmst->setView("v_partsmaster"); $partsmst->setParam("ORDER BY partsID"); $partsmst->doQuery("query"); $row_partsmst = $partsmst->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>
public function __construct() { self::$DB_CONNSTRING = "mysql:host=localhost;dbname=bulletin"; self::$DB_USERNAME = "******"; self::$DB_PASSWORD = "******"; }
<? // SET FMS DB $fms_db = new DBConfig; $fms_db->setFleetDB(); // SET PURCHASE ORDER $poreceivingmst = new Table; $poreceivingmst->setSQLType($fms_db->getSQLType()); $poreceivingmst->setInstance($fms_db->getInstance()); $poreceivingmst->setView("v_poreceiving"); $poreceivingmst->setParam("WHERE status = '0' ORDER BY status ASC, poReferenceNo DESC, poTransactionDate DESC"); $poreceivingmst->doQuery("query"); $row_poreceivingmst = $poreceivingmst->getLists(); // SET WORK ORDER $workordermst = new Table; $workordermst->setSQLType($fms_db->getSQLType()); $workordermst->setInstance($fms_db->getInstance()); $workordermst->setView("v_workordermaster"); $workordermst->setParam("WHERE status NOT IN('5','6','7','8') ORDER BY status ASC, woReferenceNo DESC, woTransactionDate DESC"); $workordermst->doQuery("query"); $row_workordermst = $workordermst->getLists(); // CLOSING FMS DB $fms_db->DBClose(); ?>