function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("oci_real_escape_string") ? oci_real_escape_string($theValue) : oci_escape_string($theValue); switch ($theType) { case "text": $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = $theValue != "" ? intval($theValue) : "NULL"; break; case "double": $theValue = $theValue != "" ? doubleval($theValue) : "NULL"; break; case "date": $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; }
public function modifier() { $rq = "UPDATE " . SCHEMA . ".IMPACT SET "; $rq .= "APPLICATION_ID='" . $this->getApplicationId() . "',"; $rq .= "DATESTART=TO_TIMESTAMP('" . $this->getDateDebut() . "','DD/MM/YYYY HH24:MI'),"; $rq .= "DATEEND=TO_TIMESTAMP('" . $this->getDateFin() . "','DD/MM/YYYY HH24:MI'),"; $rq .= "DUREEREELLE='" . oci_escape_string(html_entity_decode($this->getDureeReelle())) . "',"; $rq .= "JOURHOMME='" . oci_escape_string(html_entity_decode($this->getJourHomme())) . "',"; $rq .= "IMPACTMETIER='" . $this->getImpactMetier() . "',"; $rq .= "IMPACT='" . $this->getImpact() . "',"; $rq .= "SLA='" . $this->getSla() . "',"; $rq .= "SEVERITE='" . $this->getSeverite() . "',"; $rq .= "DESCRIPTION='" . oci_escape_string(html_entity_decode($this->getDescription())) . "',"; $rq .= "UPDATED=sysdate"; $rq .= " WHERE ID=" . $this->getId(); $db = new db(); $db->db_connect(); $db->db_query($rq); $db->close(); }
public function Modifier() { $rq = "UPDATE " . SCHEMA . ".INCIDENT SET "; $rq .= "TITRE='" . oci_escape_string(html_entity_decode($this->getTitre())) . "',"; $rq .= "INCIDENT='" . oci_escape_string(html_entity_decode(trim($this->getIncident()))) . "',"; $rq .= "DEPARTEMENT='" . oci_escape_string(html_entity_decode($this->getDepartement())) . "',"; $rq .= "STATUT='" . $this->getStatut() . "',"; $rq .= "PRIORITE='" . $this->getPriorite() . "',"; $rq .= "AFFECTEDUSER='******',"; $rq .= "DATEDEBUT=TO_TIMESTAMP('" . $this->getDateDebut() . "','DD/MM/YYYY HH24:MI'),"; $rq .= "DATEFIN=TO_TIMESTAMP('" . $this->getDateFin() . "','DD/MM/YYYY HH24:MI'),"; $rq .= "DUREE='" . $this->getDuree() . "',"; $rq .= "DESCRIPTION='" . oci_escape_string(html_entity_decode($this->getDescripIncident())) . "',"; $rq .= "RISQUEAGGRAVATION='" . $this->getRisqueAggravation() . "',"; $rq .= "CAUSE='" . oci_escape_string(html_entity_decode($this->getCause())) . "',"; $rq .= "INCIDENTSCONNEXES='" . oci_escape_string(html_entity_decode($this->getConnexe())) . "',"; $rq .= "PROBLEME='" . oci_escape_string(html_entity_decode($this->getProbleme())) . "',"; $rq .= "RETABLISSEMENT='" . oci_escape_string(html_entity_decode($this->getRetablissement())) . "',"; $rq .= "RESPONSABILITE='" . $this->getResponsabilite() . "',"; $rq .= "SERVICEACTEUR='" . $this->getActeur() . "',"; $rq .= "LOCALISATION='" . oci_escape_string(html_entity_decode($this->getLocalisation())) . "',"; $rq .= "USERACTION='" . oci_escape_string(html_entity_decode($this->getActionUtlisateur())) . "',"; $rq .= "DATEPUBLICATION=TO_TIMESTAMP('" . $this->getDateCreci() . "','DD/MM/YYYY'),"; $rq .= "COMMENTAIRE='" . oci_escape_string(html_entity_decode($this->getCommentaire())) . "',"; $rq .= "DEJAAPPARU='" . $this->getDejaApparu() . "',"; $rq .= "PREVISIBLE='" . $this->getPrevisible() . "',"; $rq .= "SUIVI=" . $this->getSuivi() . ","; $rq .= "DATE_DECISION=TO_TIMESTAMP('" . $this->getDateDecision() . "','DD/MM/YYYY HH24:MI'),"; $rq .= "CHRONOGRAMME='" . oci_escape_string(html_entity_decode($this->getChronogramme())) . "',"; $rq .= "UPDATED=sysdate"; $rq .= " WHERE ID=" . $this->getNumero(); // debug($rq); $base = new db(); $base->db_connect(); $base->db_query($rq); $base->close(); }
$conn = oci_connect("pms_rnd","pms_rnd", "203.201.225.124"); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT first_name, last_name FROM pms_employee WHERE first_name LIKE '%$my_data%' or last_name LIKE '%$my_data%' ORDER BY first_name"); oci_execute($stid); while($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { echo $row['first_name']; }<?php */ $q = $_GET['q']; $my_data = oci_escape_string($q); $conn = oci_connect("pms_rnd", "pms_rnd", "203.201.225.124/ipcatest"); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT first_name, last_name FROM pms_employee WHERE first_name LIKE '%{$my_data}%' or last_name LIKE '%{$my_data}%' ORDER BY first_name"); oci_execute($stid); while ($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) { echo $row['title'] . " " . $row['first_name'] . " " . $row['last_name'] . "\n"; } function oci_escape_string($string) { return str_replace(array('"', "'", '\\'), array('\\"', '\\\'', '\\\\'), $string); }