/** * Constructor opens a connection to the database * @param string $module Module text for End-to-End Application Tracing * @param string $cid Client Identifier for End-to-End Application Tracing */ function __construct($module, $cid) { $this->conn = @oci_pconnect(SCHEMA, PASSWORD, DATABASE, CHARSET); if (!$this->conn) { $m = oci_error(); throw new \Exception('No se puede conectar a la base de datos: ' . $m['message']); } // Record the "name" of the web user, the client info and the module. // These are used for end-to-end tracing in the DB. oci_set_client_info($this->conn, CLIENT_INFO); oci_set_module_name($this->conn, $module); oci_set_client_identifier($this->conn, $cid); }
/** * Constructor opens a connection to the database * @param string $module Module text for End-to-End Application Tracing * @param string $cid Client Identifier for End-to-End Application Tracing * @throws \Exception */ public function __construct($module, $cid) { $this->conn = @oci_new_connect(O_USERNAME, O_PASSWORD, O_DATABASE, O_CHARSET); if (!$this->conn) { $m = oci_error(); throw new \Exception("Cannot open connection to Oracle db " . $m["message"]); } // Record the "name" of the web user, the client info and the module. // These are used for end-to-end tracing in the DB. oci_set_client_info($this->conn, CLIENT_INFO); oci_set_module_name($this->conn, $module); oci_set_client_identifier($this->conn, $cid); }
<?php require_once '../../_config/dbinfo.inc.php'; require_once '../../_config/misc.func.php'; require_once '../../_config/hash.pwd.php'; session_start(); $conn = oci_connect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB) or die; $pass = $_POST['password']; $username = $_POST['username']; oci_set_client_identifier($conn, 'admin'); $sql = oci_parse($conn, "SELECT WMU.MART_PASS HASHPASS,\r\n WMU.MART_FULL_NAME FULLNAME,\r\n WMR.MART_ROLE_DESC COMP_ROLE_COMPLETE\r\n FROM MART_USER WMU\r\n INNER JOIN MART_ROLE WMR\r\n ON WMR.MART_ROLE_ID = WMU.MART_ROLE_ID\r\n WHERE WMU.MART_FULL_NAME = :finemail"); oci_bind_by_name($sql, ":finemail", $username); oci_define_by_name($sql, "COMP_ROLE_COMPLETE", $role); oci_define_by_name($sql, "HASHPASS", $hashpass); oci_execute($sql); $r = oci_fetch_array($sql, OCI_ASSOC); $passMatchInt = validate_password($pass, $hashpass); if ($passMatchInt == 1) { $_SESSION['userlogin'] = $username; $_SESSION['rolelogin'] = $role; echo '<script>location.href="../main.php"</script>'; } else { echo '<script>alert("LOGIN FAILED !!! \\nPLEASE ENTER APPROPRIATE USER NAME AND PASSWORD")</script>'; echo '<script>location.href="../../index.php"</script>'; } $globalName = SingleQryFld("SELECT WMS.SETTING_VALUE_STRING FROM MART_SETTINGS WMS WHERE WMS.SETTING_DESC = 'GLOBAL_NAME'", $conn); $_SESSION['globalname'] = $globalName;
session_start(); // CHECK IF THE USER IS LOGGED ON ACCORDING // TO THE APPLICATION AUTHENTICATION if (!isset($_SESSION['username'])) { echo <<<EOD <h1>You are UNAUTHORIZED !</h1> <p>INVALID usernames/passwords<p> <p><a href="/WeltesinformationCenter/index.html">LOGIN PAGE</a><p> EOD; exit; } // GENERATE THE APPLICATION PAGE $conn = oci_pconnect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB); // 1. SET THE CLIENT IDENTIFIER AFTER EVERY CALL // 2. USING UNIQUE VALUE FOR BACK END USER oci_set_client_identifier($conn, $_SESSION['username']); $username = htmlentities($_SESSION['username'], ENT_QUOTES); function hitungProsentase($onsite, $preparation, $erection, $qc) { $presentaseOnsite = $onsite / 100 * 5; $prsentasePreparation = $preparation / 100 * 5; $prsentaseErection = $erection / 100 * 85; $presentaseQc = $qc / 100 * 5; $result = $presentaseOnsite + $prsentasePreparation + $prsentaseErection + $presentaseQc; return $result; } function totalWeightErection($onsite, $prep, $erec, $qc) { $w_onsite = $onsite * 5 / 100; $w_prep = $prep * 5 / 100; $w_erect = $erec * 85 / 100;
public function SetClientID(string $client_id) { return @oci_set_client_identifier($this->conn_handle, $client_id); }
/** * Utiliza o recurso do Oracle que permite vincular informações do usuário da aplicação à sua sessão no banco de dados. * @param type $userId * @param type $userIP * @param type $module * @param type $action */ public function setUserInformation($userId, $userIP = null, $module = null, $action = null) { oci_set_client_identifier($this->dbh, $userId); if ($userIP) { oci_set_client_info($this->dbh, $userIP); } if ($module) { oci_set_module_name($this->dbh, $module); } if ($action) { oci_set_action($this->dbh, $action); } }
define("ORA_CON_DB2", "192.168.100.68/WENLOGINV"); $conn_wenloginv = oci_connect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB2) or die; // koneksi ke wenmart define("ORA_CON_DB", "192.168.100.71/WENMART"); $conn = oci_connect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB) or die; /* $con = oci_connect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB); if($con) echo 'success'; else echo 'fail'; $sql = "select count(inv_desc) from MASTER_INV where inv_desc = 'MIKO H'"; $r = oci_parse($con, $sql); oci_execute($r); $row = oci_fetch_array($r); echo $row[0]; */ session_start(); if (!isset($_SESSION['userlogin'])) { echo <<<EOD <h1>You are UNAUTHORIZED !</h1> <p>INVALID usernames/passwords<p> <p><a href="/WeltesMart/_includes/login/login_view.php">LOGIN PAGE</a></p> EOD; exit; } // 1. SET THE CLIENT IDENTIFIER AFTER EVERY CALL // 2. USING UNIQUE VALUE FOR BACK END USER oci_set_client_identifier($conn, $_SESSION['userlogin']); $username = htmlentities($_SESSION['userlogin'], ENT_QUOTES); $user_role = $_SESSION['rolelogin'];
public function actionLogon() { if ($_GET != '') { Yii::app()->oracle->sessStart(); $_SESSION['session'] = session_id(); $conn = Yii::app()->oracle_auth->getOracleAuthConnection(); $dataset = $_GET['dataset_id']; $complex = $_GET['complex_id']; $user_id = $_GET['user_id']; $s = oci_parse($conn, "begin :p1:=ini.BSFT_LOGON(:p_ds, :p_cmp, :p_user, :p_sid); end;"); oci_bind_by_name($s, ":p1", $client_sess_id, 16, SQLT_CHR); oci_bind_by_name($s, ":p_ds", $dataset, -1, SQLT_CHR); oci_bind_by_name($s, ":p_cmp", $complex, -1, SQLT_CHR); oci_bind_by_name($s, ":p_user", $user_id, -1, SQLT_CHR); oci_bind_by_name($s, ":p_sid", $_SESSION['session'], -1, SQLT_CHR); oci_execute($s); //ini_set('session.cookie_lifetime', 60*60*24); //setcookie('PHPSESSID', session_id(), time()+86400); //session_start(); //Yii::app()->oracle->sessStart(); //$conn = Yii::app()->oracle_auth->getOracleAuthConnection(); if ($client_sess_id != '') { $_SESSION['session'] = session_id(); $_SESSION['username'] = $_GET['username']; $_SESSION['user_id'] = $user_id; $_SESSION['dataset'] = $dataset; $_SESSION['complex'] = $complex; $_SESSION['client_session_id'] = $client_sess_id; $offset = 4; $time = time(); $time += $offset * 3600; $_SESSION['activity'] = $time; oci_set_client_identifier($conn, $_SESSION['user_id']); //$GLOBALS['session_id']; } } }
<?php require_once '../../../_config/dbinfo.inc.php'; require_once '../../../_config/hash.pwd.php'; session_start(); $email = $_POST['email']; $pass = $_POST['password']; oci_set_client_identifier($conn_finance, 'admin'); $sql = oci_parse($conn_finance, 'SELECT WFU.FINANCE_PASS HASHPASS, WFU.FINANCE_ROLE_ID COMP_ROLE, WFU.FINANCE_FULL_NAME FULLNAME FROM WEN_FINANCE_USER WFU WHERE WFU.FINANCE_EMAIL = :finemail'); oci_bind_by_name($sql, ":finemail", $email); oci_define_by_name($sql, "COMP_ROLE", $role); oci_define_by_name($sql, "HASHPASS", $hashpass); oci_define_by_name($sql, "FULLNAME", $username); oci_execute($sql); $r = oci_fetch_array($sql, OCI_ASSOC); $passMatchInt = validate_password($pass, $hashpass); if ($passMatchInt == 1) { $_SESSION['username'] = $username; $_SESSION['role'] = $role; echo '<script>location.href="../../main.php"</script>'; } else { echo '<script>alert("LOGIN FAILED !!! \\nPLEASE ENTER APPROPRIATE USER NAME AND PASSWORD")</script>'; echo '<script>location.href="../../login.php"</script>'; }
public function setClientIdentifier($clientIdentifier) { set_error_handler(static::getErrorHandler()); $isSuccess = oci_set_client_identifier($this->resource, $clientIdentifier); restore_error_handler(); return $isSuccess; }