function saveBeaconData($uuid = null) { $conf = new Conf(); global $dbConnection; //db credentials $dbInfo['host'] = $conf->dbhost; $dbInfo['username'] = $conf->dbuser; $dbInfo['password'] = $conf->dbpass; $dbInfo['database'] = $conf->dbname; $dbInfo['port'] = $conf->dbport; $dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database'], $dbInfo['port']); executeSql("UPDATE `hs_hr_config` SET `value` = '{$uuid}' WHERE `key` = 'beacon.uuid'"); executeSql("UPDATE `hs_hr_config` SET `value` = 'on' WHERE `key` = 'beacon.activiation_status'"); mysqli_close($dbConnection); return true; }
function saveBeaconData() { include_once 'lib/confs/Conf.php'; $conf = new Conf(); global $dbConnection; //db credentials $dbInfo['host'] = $conf->dbhost; $dbInfo['username'] = $conf->dbuser; $dbInfo['password'] = $conf->dbpass; $dbInfo['database'] = $conf->dbname; $dbInfo['port'] = $conf->dbport; $dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database'], $dbInfo['port']); if ($_POST['hearbeatSelect'] == 'on') { executeSql("UPDATE `hs_hr_config` SET `value` = 'on' WHERE `key` = 'beacon.activation_acceptance_status'"); } $companyName = trim(addslashes($_POST['registerCompanyName'])); executeSql("INSERT INTO `ohrm_organization_gen_info`(`name`) VALUES ('" . $companyName . "') "); mysqli_close($dbConnection); return true; }
<?php //db credentials $dbInfo['host'] = 'localhost'; $dbInfo['username'] = '******'; $dbInfo['password'] = '******'; $dbInfo['database'] = 'orangehrm_3.1.3_upgrade'; global $dbConnection; $dbConnection = createDbConnection($dbInfo['host'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database']); //upgrade transferHrHSKpisToOhrmKpis(); transferReviewsToOhrm(); finalizeUpgrade(); //close connection mysqli_close($dbConnection); function createDbConnection($host, $username, $password, $dbname, $port = null) { if (!$port) { $dbConnection = mysqli_connect($host, $username, $password, $dbname); } else { $dbConnection = mysqli_connect($host, $username, $password, $dbname, $port); } if (!$dbConnection) { die('Could not connect: ' . mysqli_connect_error()); } $dbConnection->set_charset("utf8"); mysqli_autocommit($dbConnection, FALSE); return $dbConnection; } function executeSql($query) {
function createOldConfiguration() { //If we're migrating, we need to copy the old config first, then run updates against it $db = createDbConnection(); $db->query('SET NAMES utf8'); $db->query('SET FOREIGN_KEY_CHECKS=0'); $db->query("CREATE TABLE `xlsws_configuration` (\n\t `rowid` bigint(20) NOT NULL AUTO_INCREMENT,\n\t `title` varchar(64) NOT NULL,\n\t `key` varchar(64) NOT NULL,\n\t `value` mediumtext NULL,\n\t `helper_text` varchar(255) NOT NULL,\n\t `configuration_type_id` int(11) NOT NULL DEFAULT '0',\n\t `sort_order` int(5) DEFAULT NULL,\n\t `modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n\t `created` datetime DEFAULT NULL,\n\t `options` varchar(255) DEFAULT NULL,\n\t PRIMARY KEY (`rowid`),\n\t UNIQUE KEY `key` (`key`),\n\t KEY `configuration_type_id` (`configuration_type_id`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); }
require_once "lib/config.php"; require_once "HTML/FormPersister.php"; require_once "Mail/Simple.php"; require_once "PDO/Simple.php"; require_once "Tools/TimeSeriesAxis.php"; define("TAGS_SEP", "|"); // Initialize environment. if (isCgi() && defined("USE_GZIP")) { ob_start("ob_gzhandler", 9); } if (isCgi()) { ob_start(array('HTML_FormPersister', 'ob_formpersisterhandler')); header("Content-Type: text/html; charset=utf-8"); } session_start(); $DB = createDbConnection(); // Check credentials. if (isCgi() && !defined("NO_AUTH")) { if (isset($_POST['auth'])) { $cred = $_POST['auth']['login'] . ":" . $_POST['auth']['pass']; if (getSetting("loginpass") === $cred) { $_SESSION['credentials'] = $cred; $tag = getSetting('tagafterlogin', ""); if (preg_match('{(/|index.php)$}s', $_SERVER['REQUEST_URI']) && $tag) { redirect("index.php?tag=" . urlencode($tag)); } else { selfRedirect(); } } else { addMessage("Authentication failed."); }