PHPIndex

This page lists files in the current directory. You can view content, get download/execute commands for Wget, Curl, or PowerShell, or filter the list using wildcards (e.g., `*.sh`).

PDOExtended
db_connector.inc.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/db/db_connector.inc.php'
View Content
<?php
$db_ok = array('mysql','pgsql','mssql','oracle');
if(isset($db_type)&&(in_array($db_type,$db_ok))){
    require_once 'PDOExtended/PDOExtended.php';  
    switch($db_type){
        case 'mysql':
            if(!defined( "_DB_MYSQL_LAYER" )){
                define("_DB_MYSQL_LAYER", 1);
            }
            define("PDO_DSN","mysql:host=$hostname;dbname=$database");
            define("PDO_USERNAME",$login);
            define("PDO_PASSWORD",$pass);
            $cnx = new PDOExtended(PDO_DSN,PDO_USERNAME,PDO_PASSWORD);
            $cnx->query("SET NAMES UTF8");
        break;
        case 'mssql':
            if(!defined( "_DB_MSSQL_LAYER" )){
                define("_DB_MSSQL_LAYER", 1);
            }
            define("PDO_DSN","mssql:host=$hostname;dbname=$database");
            define("PDO_USERNAME",$login);
            define("PDO_PASSWORD",$pass);
            $cnx = new PDOExtended(PDO_DSN,PDO_USERNAME,PDO_PASSWORD);
        break;
        case 'pgsql':
            if(!defined( "_DB_MYSQL_LAYER" )){
                define("_DB_MYSQL_LAYER", 1);
            }
            define("PDO_DSN","pgsql:host=$hostname;dbname=$database,port=5432");
            define("PDO_USERNAME",$login);
            define("PDO_PASSWORD",$pass);
            $cnx = new PDOExtended(PDO_DSN,PDO_USERNAME,PDO_PASSWORD);
        break;
        case 'oracle':
        if(!defined( "_DB_ORACLE_LAYER" )){
                define("_DB_ORACLE_LAYER", 1);
            }
            define("PDO_DSN","oci://$hostname:1521/$database;charset=UTF-8");
            define("PDO_USERNAME",$login);
            define("PDO_PASSWORD",$pass);
            $cnx = new PDOExtended(PDO_DSN,PDO,USERNAME,PDO_PASSWORD);
        break;
    }
} else {
    die('une erreur a probablement eu lieu lors de l\'installation...');
}
db_mssql.inc.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/db/db_mssql.inc.php'
View Content
<?php
if (!defined( "_DB_MYSQL_LAYER" )){
    define("_DB_MYSQL_LAYER", 1);
    class Db{
        var $ConnectionID;
        var $DatabaseName;
        var $Result;
        var $Row;

        function DbConnect($host, $user, $passwd, $database){
            $this->ConnectionID = @mssql_connect($host, $user, $passwd);

            if (!$this->ConnectionID)
                return (false);

            if ($database)
                return ($this->DbSelectDatabase($database));

            return (true);
        }
        function DbSelectDatabase($database){
            $this->DatabaseName = $database;

            if ($this->ConnectionID)
                return @mssql_select_db($database, $this->ConnectionID);
            else
                return false;
        }
        function DbQuery($query, $start = '', $limit = ''){
            if ($start != '' || $limit != ''){
                $query .= ' LIMIT '.$start.','.$limit;
            }
            $this->Result = @mssql_query ($query, $this->ConnectionID);
            return ($this->Result);
        }
        function DbNumRows(){
            $count = @mssql_num_rows ($this->Result);
            return ($count);
        }
        function DbNextRow(){
            $this->Row = @mssql_fetch_array ($this->Result);
            return ($this->Row);
        }
	function DbAffectedRows(){
	  return @mssql_rows_affected($this->ConnectionID);
	}
    }
}

?>
db_mysql.inc.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/db/db_mysql.inc.php'
View Content
<?php
if (!defined( "_DB_MYSQL_LAYER" )){
    define("_DB_MYSQL_LAYER", 1);
    class Db{   
        var $ConnectionID;
        var $DatabaseName;
        var $Result;
        var $Row;
        function DbConnect($host, $user, $passwd, $database=''){
            $this->ConnectionID = @mysqli_connect($host, $user, $passwd,$database);
            if (!$this->ConnectionID){
                return false ;
            } else {
                return true;
            }
        }
        function DbQuery($query, $start = '', $limit = ''){
            if ($start != '' || $limit != ''){
                $query .= ' LIMIT '.$start.','.$limit;
            }
            $this->Result = @mysqli_query($query, $this->ConnectionID);
            return( $this->Result );
        }
        function DbNumRows(){
            $count = @mysqli_num_rows($this->Result);
            return( $count );
        }
        function DbNextRow(){
            $this->Row = @mysqli_fetch_array($this->Result);
            return( $this->Row );
        }
        function DbError(){
            return mysqli_error();
        }
        function DbCreate($db_name){
            if(mysqli_query("CREATE DATABASE $db_name")) 
                return 1;
            else 
                return 0;
        }
        function DbAffectedRows(){
            return @mysqli_affected_rows($this->ConnectionID);
        }
    }
    function DbError(){
        return mysqli_error();
    }
}
?>
db_pgsql.inc.php
wget 'https://sme10.lists2.roe3.org/pmnl3/include/db/db_pgsql.inc.php'
View Content
<?php

if (!defined( "_DB_PGSQL_LAYER" ))
{
  define("_DB_PGSQL_LAYER", 1);
  
  class Db
    {   
      var $ConnectionID;
      var $DatabaseName;
      var $Result;
      var $Row;
      
      function DbConnect($host, $user, $passwd, $database='')
	{
	  $this->ConnectionID = @pg_connect("host=".$host." port=5432 dbname=".$database." user=".$user." password=".$passwd);
	  if(!$this->ConnectionID)
	  	return false;
	  if (pg_connection_status($this->ConnectionID) != "0")
	    return( false );

	  /*if ($database)
	    return( $this->DbSelectDatabase($database) );*/
	  
	  return( true );	
	}
      /*
      function DbSelectDatabase($database) 
	{
	  $this->DatabaseName = $database;
	  
	  if ($this->ConnectionID)
	    return @pg_select_db($database, $this->ConnectionID);		
	  else
	    return false;	
	}
      */
      function DbQuery($query, $start = '', $limit = '')
	{
	  if ($start != '' || $limit != '')
	    {
	      $query .= ' LIMIT '.$start.','.$limit;
	    }
	  
	  $this->Result = @pg_query($this->ConnectionID , $query);
	  return( $this->Result );
        }
      
      function DbNumRows()
	{
	  $count = @pg_num_rows($this->Result);
	  return( $count );
        }
      
      function DbNextRow()
	{
	  $this->Row = @pg_fetch_array($this->Result);
	  return( $this->Row );
        }

      function DbError()
	{
	  if( pg_connection_status($this->ConnectionID) != 0){
	  return tr("ERROR_DBCONNECT_3");
	  }
	  return pg_last_error($this->ConnectionID);
	}

      
      function DbCreate($db_name)
	{
	  if(pg_query("CREATE DATABASE $db_name")) return 1;
	  else return 0;
	}
      

      function DbAffectedRows()
	{
	  return @pg_affected_rows($this->Result);
	}

    }

}

?>