/** * Created by PhpStorm. * User: Allan Wiz * Date: 3/25/15 * Time: 10:16 AM */ session_start(); //global $session, $database; require '../classes/aardb_conn.php'; require '../functions/sanitize.php'; foreach ($_POST as $key => $value) { ${$key} = $value; //echo $key = $value; } //$dobdate=ConvertSDate($dob); #### //$dob = substr($dob, 0, 10); //$dob = date("d/m/Y", strtotime($dob)); $stmt = OCIParse($conn, "insert into member_no values (MEMBERNUMBER_SEQ.nextval) returning MEMBERNO into :id"); OCIBindByName($stmt, ":ID", $id, 32); OCI_Execute($stmt); if (strlen($id) == 1) { $memberno = "0000000{$id}"; } else { if (strlen($id) == 2) { $memberno = "000000{$id}"; } else { if (strlen($id) == 3) { $memberno = "00000{$id}"; } else { if (strlen($id) == 4) {
$amount = $_POST["amount"]; $refrence = $_POST["refrence"]; $transtype = 'PURCHASE'; $desc = $_POST["desc"]; $bid = $_SESSION['Branchcode']; if ($amount <= 499) { echo "<SCRIPT LANGUAGE='JavaScript'>\r alert('Sorry, you can only make a purchase above KSh[500], thank you!')\r window.location.href='../indpurchase.php?id={$member}&acid={$account}'\t\r </SCRIPT>"; } else { if ($reference == '') { echo "<SCRIPT LANGUAGE='JavaScript'>\r window.alert('Please enter a valid Reference code, thank you!')\r window.location.href='../indpurchase.php?id={$member}&acid={$account}'\t\r </SCRIPT>"; } else { $mysql = "select AMOUNT, PORTFOLIO, BANKACCDETS, DOC_NO FROM TRANS_AMOUNT WHERE DOC_NO='" . $refrence . "'"; $resbank = oci_parse($conn, $mysql) or die(" "); oci_execute($resbank); $numrows = oci_fetch_all($resbank, $res); if ($numrows <= 0) { $sql = "INSERT INTO trans_amount(trans_type,member_no, full_name,account_no, amount,portfolio,mop, u_name, doc_no, bnkcode, BANKACCDETS ) VALUES('" . $transtype . "','" . $member . "','" . $name . "','" . $account . "','" . $amount . "','" . $desc . "','Funds Transfer','" . $_SESSION['username'] . "','" . $refrence . "','" . $_SESSION['Branchcode'] . "','" . $_SESSION['Branchname'] . "') returning TRANS_ID into :id "; $result = OCIParse($conn, $sql); OCIBindByName($result, ":ID", $id, 32); OCI_Execute($result); if (!oci_parse($conn, $sql)) { echo "<SCRIPT LANGUAGE='JavaScript'>\r\t\t\t\r\t\t\t\r\r\$('#content').notifyModal({\r\r\t\t\t\r\rduration : 2500,\r\r\t\t\t\r\rplacement : 'center',\r\r\t\t\t\r\roverlay : true,\r\r\t\t\t\r\rtype : 'notify',\r\r\t\t\t\r\ronClose : function(){ }\r});\r\r\t\t'\r\t\t\t</SCRIPT>"; } else { oci_close($conn); echo "<SCRIPT LANGUAGE='JavaScript'>\r\t\t\twindow.alert('Purchase Posted successfully, Transaction ID [{$id}].')\r\t\t\twindow.location.href='../indsearch.php'\r\t\t\t</SCRIPT>"; } } else { echo "<SCRIPT LANGUAGE='JavaScript'>\r window.alert('Sorry the Refference Number already been used. Please Enter the correct Refference ID from Finacle!')\r\t\twindow.location.href='../indpurchase.php?id={$member}&acid={$account}'\t\t\r </SCRIPT>"; } } }
/** +---------------------------------------------------------- * 执行语句 针对 INSERT, UPDATE 以及DELETE +---------------------------------------------------------- * @access protected +---------------------------------------------------------- * @param string $str sql指令 +---------------------------------------------------------- * @return integer +---------------------------------------------------------- * @throws ThinkExecption +---------------------------------------------------------- */ protected function _execute($str = '') { $this->initConnect(true); if (!$this->_linkID) { return false; } if ($str != '') { $this->queryStr = $str; } if ($this->autoCommit) { //释放前次的查询结果 if ($this->queryID) { $this->free(); } } $this->escape_string($this->queryStr); $this->writeTimes++; $this->W(1); $result = OCI_Parse($this->_linkID, $this->queryStr); $this->debug(); if (!$result) { //throw_exception($this->error()); return false; } else { if (!$this->autoCommit && $this->isMainIps($this->queryStr)) { $result = OCI_Execute($this->queryID, OCI_DEFAULT); $this->transTimes++; } else { $result = OCI_Execute($this->queryID, OCI_COMMIT_ON_SUCCESS); } if (false === $result) { //throw_exception($this->error()); return false; } $this->numRows = oci_num_rows($this->_linkID); return $this->numRows; } }
$to = strtotime($_POST['fecha_evento']); $fecha = date('d/m/y', strtotime($_POST['fecha_evento'])); $hora = $_POST['hora_evento']; $descripcion = $_POST['descripcion']; $result = $_POST['taskOption']; $result_explode = explode('|', $result); // Insertar Datos $query = OCI_Parse($c, "insert into EVENTO (EVENTO_ID,NOMBRE, LUGAR, DESCRIPCION, FECHA, HORA) values (incremento_evento.nextval, :para2, :para3, :para4, :para5, :para6)"); OCI_Bind_By_Name($query, ":para2", $titulo); //Ligar los parámetros oracle con variables de PHP OCI_Bind_By_Name($query, ":para3", $lugar); OCI_Bind_By_Name($query, ":para4", $descripcion); OCI_Bind_By_Name($query, ":para5", $fecha); OCI_Bind_By_Name($query, ":para6", $hora); //Ejecutar la sentencia para insertar $r = OCI_Execute($query); OCI_Free_Statement($query); //Liberar sentencia echo $selectOption; echo "<br>"; echo $to; echo gettype($to); echo gettype($titulo); echo "<br>"; echo gettype($lugar); echo "<br>"; echo $ciudad; echo gettype($ciudad); echo "<br>"; echo gettype($fecha); echo "<br>";
<?php //page should check if the object coming is null and redirect to index.php $connection = oci_connect("ADMINISTRATOR", "ADMINISTRATOR", "(DESCRIPTION =\n\t\t\t\t\t\t\t\t\t\t\t\t\t (ADDRESS_LIST =\n\t\t\t\t\t\t\t\t\t\t\t\t\t (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.50.20)(PORT = 1521))\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t (CONNECT_DATA =\n\t\t\t\t\t\t\t\t\t\t\t\t\t (SID = MATCHDB)\n\t\t\t\t\t\t\t\t\t\t\t\t\t (SERVER = DEDICATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t\t\t)"); //captures error if (!$connection) { echo "Invalid connection " . var_dump(ocierror()); die; } $query = oci_parse($connection, "select * from username"); OCI_Execute($query, OCI_NO_AUTO_COMMIT); echo "<table border=\"1\">\n"; echo "<tr>"; echo "<th>Username</th>"; echo "<th>Password</th>"; echo "</tr>\n"; while (oci_fetch($query)) { $username = oci_result($query, 'USERNAMEID'); $password = oci_result($query, 'USERNAMEPASSWORD'); echo "<tr>"; echo "<td>{$username}</td>"; echo "<td>{$password}</td>"; echo "</tr>\n"; } oci_commit($connection); oci_close($connection);