Ejemplo n.º 1
0
 /**
  * Non-persistent database connection
  *
  * @access  private called by the base class
  * @return  resource
  */
 function db_connect()
 {
     // ====== Modificación por CRIE - UTP =======
     // Se agrega el parámetro utf8 a la función ocilogon para
     // forzar el uso de la codificación UTF-8 en Oracle
     return @ocilogon($this->username, $this->password, $this->hostname, 'utf8');
     // ========= Fin Modificación =========
 }
Ejemplo n.º 2
0
 function connect($h, $u, $p)
 {
     $this->DBHost = $h;
     $this->DBUser = $u;
     $this->DBPassword = $p;
     $this->connection = ocilogon($this->DBUser, $this->DBPassword, $this->DBHost);
     return $this->connection;
 }
Ejemplo n.º 3
0
 /**
  * Constructor.
  *
  * @access public
  */
 function phpOpenTracker_DB_oci8()
 {
     $this->phpOpenTracker_DB();
     $database = $this->config['db_database'] == 'default' ? '' : $this->config['db_database'];
     $this->connection = @ocilogon($this->config['db_user'], $this->config['db_password'], $database);
     if (!$this->connection) {
         return phpOpenTracker::handleError('Could not connect to database.', E_USER_ERROR);
     }
 }
Ejemplo n.º 4
0
 /**
  * Non-persistent database connection
  *
  * @access  private called by the base class
  * @return  resource
  */
 function db_connect()
 {
     //   print_r("hostname ".$this->hostname);
     //  print_r("pooled ".$this->pooled);
     //	return @ocilogon($this->username, $this->password, $this->hostname);
     $connection = ocilogon($this->username, $this->password, $this->pooled);
     if (!$connection) {
         $e = oci_error();
         print_r("<b>Error In Connection:</b>" . $e['message']);
     }
     return @ocilogon($this->username, $this->password, $this->pooled);
 }
Ejemplo n.º 5
0
function oracle_login($info, $serv_type)
{
    $conn_str = '( DESCRIPTION =
                    ( ADDRESS =
                        ( PROTOCOL = TCP )
                        ( HOST = ' . $info["HOST"] . ')
                        ( PORT = ' . $info["PORT"] . ') )
                    ( CONNECT_DATA =
                        ( SERVICE_NAME = ' . $info["BASE"] . ')
                        ( SERVER = ' . $serv_type . ') ) )';
    $c = @ocilogon($info["USER"], $info["PASS"], $conn_str);
    return $c;
}
function da_sql_connect($config)
{
    if ($config[sql_use_http_credentials] == 'yes') {
        global $HTTP_SERVER_VARS;
        $SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
        $SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
    } else {
        $SQL_user = $config[sql_username];
        $SQL_passwd = $config[sql_password];
    }
    $link = @ocilogon($SQL_user, $SQL_passwd, $config[sql_database]);
    $res = @da_sql_query($link, $config, "ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SS.FF TZH:TZM'");
    return $link;
}
 function Database($Server = 0)
 {
     global $DB;
     settype($Server, "integer");
     $this->DBName = $DB->Name($Server);
     $this->DBPass = $DB->Pass($Server);
     $this->DBUser = $DB->User($Server);
     if (!isset($GLOBALS[md5($this->DBUser . $this->DBPass . $this->DBName)]) || !$GLOBALS[md5($this->DBUser . $this->DBPass . $this->DBName)]) {
         $GLOBALS[md5($this->DBUser . $this->DBPass . $this->DBName)] = @ocilogon($this->DBUser, $this->DBPass, $this->DBName);
     }
     $this->conn = $GLOBALS[md5($this->DBUser . $this->DBPass . $this->DBName)];
     if (!$this->conn) {
         $this->error($this->conn);
     }
     $this->version = @OCIServerVersion($this->conn);
 }
Ejemplo n.º 8
0
 function Connect()
 {
     if ($this->TYPE == 'oracle') {
         if (!($this->LINK = @ocilogon($this->USER, $this->PASS, $this->SERVER))) {
             return false;
         }
     } elseif ($this->TYPE == 'mysql') {
         if (!($this->LINK = @mysql_connect($this->SERVER, $this->USER, $this->PASS))) {
             return false;
         }
         if (!@mysql_select_db($this->DB)) {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 9
0
 /**
  * Connect to server
  */
 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
 {
     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->server = $sqlserver . ($port ? ':' . $port : '');
     $this->dbname = $database;
     $connect = $database;
     // support for "easy connect naming"
     if ($sqlserver !== '' && $sqlserver !== '/') {
         if (substr($sqlserver, -1, 1) == '/') {
             $sqlserver == substr($sqlserver, 0, -1);
         }
         $connect = $sqlserver . ($port ? ':' . $port : '') . '/' . $database;
     }
     $this->db_connect_id = $new_link ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : ($this->persistency ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
     return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
 }
Ejemplo n.º 10
0
function db_start()
{
    global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;
    switch ($DatabaseType) {
        case 'oracle':
            $connection = @ocilogon($DatabaseUsername, $DatabasePassword, $DatabaseServer);
            break;
        case 'postgres':
            //if($DatabaseServer!='localhost') //use for windows
            if ($DatabaseServer != 'host') {
                //updated for linux
                $connectstring = "host={$DatabaseServer} ";
            }
            if ($DatabasePort != '5432') {
                $connectstring .= "port={$DatabasePort} ";
            }
            $connectstring .= "dbname={$DatabaseName} user={$DatabaseUsername}";
            if (!empty($DatabasePassword)) {
                $connectstring .= " password={$DatabasePassword}";
            }
            $connection = pg_connect($connectstring);
            break;
        case 'mysql':
            $connection = mysql_connect($DatabaseServer, $DatabaseUsername, $DatabasePassword);
            mysql_select_db($DatabaseName);
            break;
    }
    // Error code for both.
    if ($connection === false) {
        switch ($DatabaseType) {
            case 'oracle':
                $errors = OciError();
                $errormessage = $errors['message'];
                break;
            case 'postgres':
                $errormessage = pg_last_error($connection);
                break;
            case 'mysql':
                $errormessage = mysql_error($connection);
                break;
        }
        db_show_error("", "Could not Connect to Database: {$DatabaseServer}", $errstring);
    }
    return $connection;
}
Ejemplo n.º 11
0
function db_start()
{
    global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;
    switch ($DatabaseType) {
        case 'oracle':
            $connection = @ocilogon($DatabaseUsername, $DatabasePassword, $DatabaseServer);
            break;
        case 'postgres':
            if ($DatabaseServer != 'localhost') {
                $connectstring = "host={$DatabaseServer} ";
            }
            if ($DatabasePort != '5432') {
                $connectstring .= "port={$DatabasePort} ";
            }
            $connectstring .= "dbname={$DatabaseName} user={$DatabaseUsername}";
            if (!empty($DatabasePassword)) {
                $connectstring .= " password={$DatabasePassword}";
            }
            $connection = pg_connect($connectstring);
            break;
        case 'mysql':
            $connection = mysql_connect($DatabaseServer, $DatabaseUsername, $DatabasePassword);
            mysql_select_db($DatabaseName);
            break;
    }
    // Error code for both.
    if ($connection === false) {
        switch ($DatabaseType) {
            case 'oracle':
                $errors = OciError();
                $errormessage = $errors['message'];
                break;
            case 'postgres':
                $errormessage = pg_last_error($connection);
                break;
            case 'mysql':
                $errormessage = mysql_error($connection);
                break;
        }
        // TRANSLATION: do NOT translate these since error messages need to stay in English for technical support
        db_show_error("", sprintf('Could not Connect to Database Server \'%s\'', $DatabaseServer), $errstring);
    }
    return $connection;
}
Ejemplo n.º 12
0
 function connect()
 {
     if (strtoupper($this->dbType) != "OCI8") {
         return false;
     }
     if ($this->isConnect) {
         return true;
     }
     if ($this->_sid == "") {
         $this->connection = ocilogon(parent::getUser(), parent::getPassword());
     } else {
         $this->connection = ocilogon(parent::getUser(), parent::getPassword(), $this->getSID());
     }
     if (!$this->connection) {
         $this->isConnect = false;
     } else {
         $this->isConnect = true;
     }
     return $this->isConnect;
 }
Ejemplo n.º 13
0
 /**
  * {@inheritDoc}
  */
 function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
 {
     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->server = $sqlserver . ($port ? ':' . $port : '');
     $this->dbname = $database;
     $connect = $database;
     // support for "easy connect naming"
     if ($sqlserver !== '' && $sqlserver !== '/') {
         if (substr($sqlserver, -1, 1) == '/') {
             $sqlserver == substr($sqlserver, 0, -1);
         }
         $connect = $sqlserver . ($port ? ':' . $port : '') . '/' . $database;
     }
     if ($new_link) {
         if (!function_exists('ocinlogon')) {
             $this->connect_error = 'ocinlogon function does not exist, is oci extension installed?';
             return $this->sql_error('');
         }
         $this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8');
     } else {
         if ($this->persistency) {
             if (!function_exists('ociplogon')) {
                 $this->connect_error = 'ociplogon function does not exist, is oci extension installed?';
                 return $this->sql_error('');
             }
             $this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8');
         } else {
             if (!function_exists('ocilogon')) {
                 $this->connect_error = 'ocilogon function does not exist, is oci extension installed?';
                 return $this->sql_error('');
             }
             $this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8');
         }
     }
     return $this->db_connect_id ? $this->db_connect_id : $this->sql_error('');
 }
Ejemplo n.º 14
0
 function connect($dsn = false)
 {
     $this->lasterr = null;
     $this->lasterrcode = null;
     if ($this->conn && $dsn == false) {
         return true;
     }
     if (!$dsn) {
         $dsn = $this->dsn;
     } else {
         $this->dsn = $dsn;
     }
     if (isset($dsn['charset']) && $dsn['charset'] != '') {
         $charset = $dsn['charset'];
     } else {
         $charset = FLEA::getAppInf('databaseCharset');
     }
     if (strtoupper($charset) == 'GB2312') {
         $charset = 'GBK';
     }
     if (empty($dsn['database'])) {
         $dsn['database'] = null;
     }
     if ($charset != '') {
         $this->conn = ocilogon("{$dsn['login']}", $dsn['password'], $dsn['database'], $charset);
     } else {
         $this->conn = ocilogon($dsn['login'], $dsn['password'], $dsn['database']);
     }
     if (!$this->conn) {
         FLEA::loadClass('FLEA_Db_Exception_SqlQuery');
         $err = ocierror();
         __THROW(new FLEA_Db_Exception_SqlQuery("ocilogon('{$dsn['login']}') failed.", $err['message'], $err['code']));
         return false;
     }
     $this->execute("ALTER SESSION SET NLS_DATE_FORMAT = '{$this->NLS_DATE_FORMAT}'");
     return true;
 }
Ejemplo n.º 15
0
<?php
$Conn = ocilogon($dbuser, $dbpass, $hostname, $encode);

?>	
Ejemplo n.º 16
0
                     } else {
                         if (($rows = @pg_affected_rows($res)) >= 0) {
                             echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>" . $rows . "</b></font></td></tr></table><br>";
                         }
                     }
                 }
                 @pg_free_result($res);
             }
         }
         @pg_close($db);
     } else {
         echo "<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to PostgreSQL server</b></font></div>";
     }
     break;
 case 'Oracle':
     $db = @ocilogon($_POST['mysql_l'], $_POST['mysql_p'], $_POST['mysql_db']);
     if ($error = @ocierror()) {
         echo "<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to Oracle server.<br>" . $error['message'] . "</b></font></div>";
     } else {
         $querys = @explode(';', $_POST['db_query']);
         foreach ($querys as $num => $query) {
             if (strlen($query) > 5) {
                 echo "<font face=Verdana size=-2 color=green><b>Query#" . $num . " : " . htmlspecialchars($query) . "</b></font><br>";
                 $stat = @ociparse($db, $query);
                 @ociexecute($stat);
                 if ($error = @ocierror()) {
                     echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>" . $error['message'] . "</b></font></td></tr></table><br>";
                 } else {
                     $rowcount = @ocirowcount($stat);
                     if ($rowcount != 0) {
                         echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>" . $rowcount . "</b></font></td></tr></table><br>";
function querY($type, $host, $user, $pass, $db = '', $query)
{
    $res = '';
    switch ($type) {
        case 'MySQL':
            if (!function_exists('mysql_connect')) {
                return 0;
            }
            $link = mysql_connect($host, $user, $pass);
            if ($link) {
                if (!empty($db)) {
                    mysql_select_db($db, $link);
                }
                $result = mysql_query($query, $link);
                while ($data = mysql_fetch_row($result)) {
                    $res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
                }
                $res .= '[+][+][+]';
                for ($i = 0; $i < mysql_num_fields($result); $i++) {
                    $res .= mysql_field_name($result, $i) . '[-][-][-]';
                }
                mysql_close($link);
                return $res;
            }
            break;
        case 'MSSQL':
            if (!function_exists('mssql_connect')) {
                return 0;
            }
            $link = mssql_connect($host, $user, $pass);
            if ($link) {
                if (!empty($db)) {
                    mssql_select_db($db, $link);
                }
                $result = mssql_query($query, $link);
                while ($data = mssql_fetch_row($result)) {
                    $res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
                }
                $res .= '[+][+][+]';
                for ($i = 0; $i < mssql_num_fields($result); $i++) {
                    $res .= mssql_field_name($result, $i) . '[-][-][-]';
                }
                mssql_close($link);
                return $res;
            }
            break;
        case 'Oracle':
            if (!function_exists('ocilogon')) {
                return 0;
            }
            $link = ocilogon($user, $pass, $db);
            if ($link) {
                $stm = ociparse($link, $query);
                ociexecute($stm, OCI_DEFAULT);
                while ($data = ocifetchinto($stm, $data, OCI_ASSOC + OCI_RETURN_NULLS)) {
                    $res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
                }
                $res .= '[+][+][+]';
                for ($i = 0; $i < oci_num_fields($stm); $i++) {
                    $res .= oci_field_name($stm, $i) . '[-][-][-]';
                }
                return $res;
            }
            break;
        case 'PostgreSQL':
            if (!function_exists('pg_connect')) {
                return 0;
            }
            $link = pg_connect("host={$host} dbname={$db} user={$user} password={$pass}");
            if ($link) {
                $result = pg_query($link, $query);
                while ($data = pg_fetch_row($result)) {
                    $res .= implode('|-|-|-|-|-|', $data) . '|+|+|+|+|+|';
                }
                $res .= '[+][+][+]';
                for ($i = 0; $i < pg_num_fields($result); $i++) {
                    $res .= pg_field_name($result, $i) . '[-][-][-]';
                }
                pg_close($link);
                return $res;
            }
            break;
    }
    return 0;
}
 function connect()
 {
     switch ($this->db) {
         case 'MySQL':
             if (empty($this->port)) {
                 $this->port = '3306';
             }
             if (!function_exists('mysql_connect')) {
                 return 0;
             }
             $this->connection = @mysql_connect($this->host . ':' . $this->port, $this->user, $this->pass);
             if (is_resource($this->connection)) {
                 return 1;
             }
             break;
         case 'MSSQL':
             if (empty($this->port)) {
                 $this->port = '1433';
             }
             if (!function_exists('mssql_connect')) {
                 return 0;
             }
             $this->connection = @mssql_connect($this->host . ',' . $this->port, $this->user, $this->pass);
             if ($this->connection) {
                 return 1;
             }
             break;
         case 'PostgreSQL':
             if (empty($this->port)) {
                 $this->port = '5432';
             }
             $str = "host='" . $this->host . "' port='" . $this->port . "' user='******' password='******' dbname='" . $this->base . "'";
             if (!function_exists('pg_connect')) {
                 return 0;
             }
             $this->connection = @pg_connect($str);
             if (is_resource($this->connection)) {
                 return 1;
             }
             break;
         case 'Oracle':
             if (!function_exists('ocilogon')) {
                 return 0;
             }
             $this->connection = @ocilogon($this->user, $this->pass, $this->base);
             if (is_resource($this->connection)) {
                 return 1;
             }
             break;
     }
     return 0;
 }
Ejemplo n.º 19
0
<?php

/**
 * Created by PhpStorm.
 * User: Bobby
 * Date: 20/9/2015
 * Time: 8:42 PM
 */
$username = '******';
$password = '******';
putenv('ORACLE_HOME=/oraclient');
$connect = ocilogon($username, $password, ' (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = sid3.comp.nus.edu.sg)(PORT = 1521)))
    (CONNECT_DATA = (SERVICE_NAME = sid3.comp.nus.edu.sg)))');
?>

Ejemplo n.º 20
0
<?php

session_start();
$_SESSION["category"] = $_POST["category"];
$_SESSION["year"] = $_POST["year"];
$_SESSION["quarter"] = $_POST["quarter"];
$_SESSION["storeID"] = $_POST["storeID"];
?>
<body style="background-color:#E6E6FA">
	<div id="logout" align="right" onclick="{alert('You are going to logout');}">
		<a href="http://uisacad.uis.edu/~kmulpu2/DillardsReporting.html">Logout</a>
	</div>
	<?php 
$connection = ocilogon("tanis2", "oracle", "oracle.uis.edu");
if (!$connection) {
    echo "Service is currently unavailable. Please try later.";
    exit;
}
$criteria = $_POST["category"];
$Year = $_POST["year"];
$quarter = $_POST["quarter"];
$store = $_POST["storeID"];
if ($quarter == "Q1") {
    $month1 = "JAN";
    $month2 = "FEB";
    $month3 = "MAR";
} elseif ($quarter == "Q2") {
    $month1 = "APR";
    $month2 = "MAY";
    $month3 = "JUN";
} elseif ($quarter == "Q3") {
Ejemplo n.º 21
0
<?php

require '/Constantes.php';
session_start();
$llavePrimaria = session_id();
require 'basedatos.php';
$db_conn = ocilogon("system", "hospital", "//127.0.0.1/XE");
//*****************************BANNERS***********************************/
$sqlNombre110 = "SELECT * From anuncios order by keyAnuncio DESC\r\n";
$resultaNombre110 = mysql_db_query($basedatos, $sqlNombre110);
$rNombre110 = mysql_fetch_array($resultaNombre110);
$USER = $rNombre110['usuario'];
/* $cmdstr5 = "select * from PEDRO.USUARIO WHERE LOGIN = '******' AND STATUS='A'
";
$parsed5 = ociparse($db_conn, $cmdstr5);
ociexecute($parsed5);	 
$nrows5 = ocifetchstatement($parsed5,$resulta5);
for ($i = 0; $i < $nrows5; $i++ ){
$persona = $resulta5['NOMBRE'][$i]." ".$resulta5['AP_PATERNO'][$i]." ".$resulta5['AP_MATERNO'][$i];
} */
echo '<marquee>';
echo $rNombre110['anuncio'] . " Lo envia: " . $USER;
echo '</marquee>';
//***********************************************************************
$dia = date("l");
$hora1 = date("H:i a");
$fecha1 = date("Y-m-d");
$ip3 = "SELECT *\r\nFROM\r\n  `sesiones`\r\n WHERE\r\nllave = '" . $llavePrimaria . "'";
$resultIP3 = mysql_db_query($basedatos, $ip3);
$ipRes3 = mysql_fetch_array($resultIP3);
echo mysql_error();
<head>
<title>PHP und Oracle</title>
</head>
<body>
<h1>PHP und Oracle</h1>
<table border="1">
<tr>
    <th>Interpret</th>
    <th>Titel</th>
    <th>Jahr</th>
</tr>
<?php 
$db = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)\r\n       (HOST=localhost) (PORT=1521)))\r\n       (CONNECT_DATA=(SERVICE_NAME=xe)))";
// Oracle 10g
//$db="//localhost/xe";
$c = ocilogon("hr", "geheim", $db);
$s = ociparse($c, "SELECT * FROM cds");
if (ociexecute($s)) {
    while (ocifetch($s)) {
        echo "<tr>";
        echo "<td>" . ociresult($s, "INTERPRET") . "</td>";
        echo "<td>" . ociresult($s, "TITEL") . "</td>";
        echo "<td>" . ociresult($s, "JAHR") . "</td>";
        echo "</tr>";
    }
} else {
    $e = oci_error($s);
    echo htmlentities($e['message']);
}
?>
</table>
Ejemplo n.º 23
0
        print("  </tr>\n  <tr>\n");
        print("    <td class=\"p2k\">\n      <script language=\"JavaScript\">\n        <!--\n        document.write(convert(".$results['CRONTIME'][$i]."));\n        // -->\n      </script>\n    </td>\n");
        print("  </tr>\n  <tr>\n");
        print("    <td class=\"p2k\">\n      <div id=\"stail".str_pad($i + 1, 3, "0", STR_PAD_LEFT)."\"".($flag = ($_GET['mask']{$i} == "1")? " class=\"inv\"": "").">\n        <pre>".$results['SHORT_TAIL'][$i]."</pre>\n        <button onClick=\"expand(this.parentNode);\">\n          expand ".($i + 1)."\n        </button>\n      </div>\n");
        print("      <div id=\"ltail".str_pad($i + 1, 3, "0", STR_PAD_LEFT)."\"".(!$flag? " class=\"inv\"": "").">\n        <textarea readonly=\"readonly\" wrap=\"off\">".$results['LONG_TAIL'][$i]."</textarea>\n        <br>\n        <br>\n        <button onClick=\"shrink(this.parentNode);\">\n          shrink ".($i + 1)."\n        </button>\n      </div>\n    </td>\n");
        print("  </tr>\n");
      }
      print("</table>\n");
    }
    else print("<p class=\"bo\">\n  No PopCon cronjob tails recorded!\n</p>\n");
    ocifreestatement($stmt);
    ocilogoff($conn);
    $svr = $svrlog;
    $apl = "mon";
    require($path."auth.inc");
    $conn = ocilogon($usr, $pwd, $svr);
    require($path."geoip.inc");
    $gi = geoip_open("geoip.dat", GEOIP_STANDARD);  
      ociexecute(ociparse($conn, "insert into $usr.mon_log (domain, ip, country, browser, kind) values ('".strtolower(gethostbyaddr("$REMOTE_ADDR"))."', '$REMOTE_ADDR', '".geoip_country_name_by_addr($gi, $REMOTE_ADDR)."', '$HTTP_USER_AGENT', 'T')"));
      ocicommit($conn);
    geoip_close($gi);
    ocilogoff($conn);
  }
  else oraconnecterror();
</script>

<p class="bo">
  This page has been dynamically generated on
  <?php 
print newdate(time(), "eng") . " at " . date("G:i", time()) . ", Central European time.";
?>
Ejemplo n.º 24
0
 function OracleLogon($sim, $user, $pw)
 {
     $this->Dialect = "Oracle";
     $this->dbDefault = $user;
     $this->dbMain = ocilogon($user, $pw, $sim);
     $this->db =& new dbClass_oci($this->dbMain);
     if ($this->CheckForError("opening connection")) {
         return false;
     }
     $this->RunActionQuery("alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS'");
     return true;
 }
Ejemplo n.º 25
0
 /**
  * Non-persistent database connection
  *
  * @access  private called by the base class
  * @return  resource
  */
 function db_connect()
 {
     return @ocilogon($this->username, $this->password, $this->hostname);
 }
function sqlqu($sqlty, $host, $user, $pass, $db = '', $query)
{
    $res = '';
    switch ($sqlty) {
        case 'MySQL':
            if (!function_exists('mysql_connect')) {
                return 0;
            }
            $link = @mysql_connect($host, $user, $pass);
            if ($link) {
                if (!empty($db)) {
                    @mysql_select_db($db, $link);
                }
                $result = @mysql_query($query, $link);
                if ($result != 1) {
                    while ($data = @mysql_fetch_row($result)) {
                        $res .= implode('+', $data) . '-+';
                    }
                    $res .= '*';
                    for ($i = 0; $i < @mysql_num_fields($result); $i++) {
                        $res .= @mysql_field_name($result, $i) . '-';
                    }
                }
                @mysql_close($link);
                return $res;
            }
            break;
        case 'MSSQL':
            if (!function_exists('mssql_connect')) {
                return 0;
            }
            $link = @mssql_connect($host, $user, $pass);
            if ($link) {
                if (!empty($db)) {
                    @mssql_select_db($db, $link);
                }
                $result = @mssql_query($query, $link);
                while ($data = @mssql_fetch_row($result)) {
                    $res .= implode('+', $data) . '-+';
                }
                $res .= '*';
                for ($i = 0; $i < @mssql_num_fields($result); $i++) {
                    $res .= @mssql_field_name($result, $i) . '-';
                }
                @mssql_close($link);
                return $res;
            }
            break;
        case 'Oracle':
            if (!function_exists('ocilogon')) {
                return 0;
            }
            $link = @ocilogon($user, $pass, $db);
            if ($link) {
                $stm = @ociparse($link, $query);
                @ociexecute($stm, OCI_DEFAULT);
                while ($data = @ocifetchinto($stm, $data, OCI_ASSOC + OCI_RETURN_NULLS)) {
                    $res .= implode('+', $data) . '-+';
                }
                $res .= '*';
                for ($i = 0; $i < oci_num_fields($stm); $i++) {
                    $res .= @oci_field_name($stm, $i) . '-';
                }
                return $res;
            }
            break;
        case 'PostgreSQL':
            if (!function_exists('pg_connect')) {
                return 0;
            }
            $link = @pg_connect("host={$host} dbname={$db} user={$user} password={$pass}");
            if ($link) {
                $result = @pg_query($link, $query);
                while ($data = @pg_fetch_row($result)) {
                    $res .= implode('+', $data) . '-+';
                }
                $res .= '*';
                for ($i = 0; $i < @pg_num_fields($result); $i++) {
                    $res .= @pg_field_name($result, $i) . '-';
                }
                @pg_close($link);
                return $res;
            }
            break;
        case 'DB2':
            if (!function_exists('db2_connect')) {
                return 0;
            }
            $link = @db2_connect($db, $user, $pass);
            if ($link) {
                $result = @db2_exec($link, $query);
                while ($data = @db2_fetch_row($result)) {
                    $res .= implode('+', $data) . '-+';
                }
                $res .= '*';
                for ($i = 0; $i < @db2_num_fields($result); $i++) {
                    $res .= @db2_field_name($result, $i) . '-';
                }
                @db2_close($link);
                return $res;
            }
            break;
    }
    return 0;
}
Ejemplo n.º 27
0
<?php

// Standard login required preamble
// To use, place as the FIRST LINE of the page
session_start();
if (!isset($_SESSION["LoggedIn"]) or $_SESSION["LoggedIn"] == 0 or $_SESSION["Employer"] == 1) {
    header("Location: ApplicantsLogin.php");
}
putenv('ORACLE_HOME=/oraclient');
$dbh = ocilogon('a0110801', 'crse1510', '(DESCRIPTION =
	(ADDRESS_LIST =
	 (ADDRESS = (PROTOCOL = TCP)(HOST = sid3.comp.nus.edu.sg)(PORT = 1521))
	)
	(CONNECT_DATA =
	 (SERVICE_NAME = sid3.comp.nus.edu.sg)
	)
  )');
?>
{% extends "base_applicant.html" %}
{% block content%}
<h1> Job Description</h1>
<?php 
$job_title = $_GET['job_title'];
echo "Title: " . $job_title;
$company = $_GET['company'];
echo "<br> Company: " . $company . "";
$description = $_GET['description'];
echo "<br> Job Description: " . $description . "";
$city = $_GET['city'];
$country = $_GET['country'];
echo "<br> Location: " . $city . ", " . $country;
Ejemplo n.º 28
0
 /**
  * Connects to the database.
  * Connects to the database.
  * @access public
  * @return mixed The connection's link identifier, if successful; False, otherwise.
  */
 function connect()
 {
     // if connected, need to disconnect first
     if ($this->isConnected()) {
         return false;
     }
     $linkId = ocilogon($this->_dbUser, $this->_dbPass, $this->_dbName);
     // see if successful
     if ($linkId) {
         // reset the query counters
         $this->_successfulQueries = 0;
         $this->_failedQueries = 0;
         $this->_linkId = $linkId;
         return $linkId;
     } else {
         throw new ConnectionDatabaseException($this->getConnectionErrorInfo() . "Cannot connect to database.");
         $this->_linkId = false;
         return false;
     }
 }
Ejemplo n.º 29
0
 /**
  * Connects to the database using options in the given configuration array.
  *
  * @return boolean True if the database could be connected, else false
  * @access public
  */
 function connect()
 {
     $config = $this->config;
     $this->connected = false;
     $config['charset'] = !empty($config['charset']) ? $config['charset'] : null;
     if (!$config['persistent']) {
         $this->connection = @ocilogon($config['login'], $config['password'], $config['database'], $config['charset']);
     } else {
         $this->connection = @ociplogon($config['login'], $config['password'], $config['database'], $config['charset']);
     }
     if ($this->connection) {
         $this->connected = true;
         if (!empty($config['nls_sort'])) {
             $this->execute('ALTER SESSION SET NLS_SORT=' . $config['nls_sort']);
         }
         if (!empty($config['nls_comp'])) {
             $this->execute('ALTER SESSION SET NLS_COMP=' . $config['nls_comp']);
         }
         $this->execute("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
     } else {
         $this->connected = false;
         $this->_setError();
         return false;
     }
     return $this->connected;
 }
Ejemplo n.º 30
0
<?php

session_start();
$_SESSION["newCustomerLastName"] = $_POST["newCustomerLastName"];
$_SESSION["newCustomerFirstName"] = $_POST["newCustomerFirstName"];
$_SESSION["newCustomerEmail"] = $_POST["newCustomerEmail"];
?>
<body>
<?php 
$connection = ocilogon("kmulpu2", "oracle", "oracle.uis.edu");
if (!$connection) {
    echo "Couldn't make a connection!";
    exit;
} else {
    echo "You have connected to the UIS Oracle Database!! <p>";
}
$newCustomerLastName = $_POST["newCustomerLastName"];
$newCustomerFirstName = $_POST["newCustomerFirstName"];
$newCustomerAreaCode = $_POST["newCustomerAreaCode"];
$newCustomerPhoneNumber = $_POST["newCustomerPhoneNumber"];
$newCustomerEmail = $_POST["newCustomerEmail"];
$varArtistLastName = $_POST["varArtistLastName"];
$varWorkTitle = $_POST["varWorkTitle"];
$varWorkCopy = $_POST["varWorkCopy"];
$newTransSalesPrice = $_POST["newTransSalesPrice"];
$sqlquery = "call INSERTCUSTOMERWITHTRANSACTION('" . $newCustomerLastName . "','" . $newCustomerFirstName . "','" . $newCustomerAreaCode . "','" . $newCustomerPhoneNumber . "','" . $newCustomerEmail . "','" . $varArtistLastName . "','" . $varWorkTitle . "','" . $varWorkCopy . "','" . $newTransSalesPrice . "')";
$sql_id = ociparse($connection, $sqlquery);
if (!$sql_id) {
    $e = oci_error($connection);
    print htmlentities($e['message']);
    exit;