403Webshell
Server IP : 104.21.17.213  /  Your IP : 216.73.217.141
Web Server : Apache
System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64
User : corbizre ( 1013)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/corbizre/freerealestateresources.com/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/corbizre/freerealestateresources.com/lib/dbpgsql.class.php
<?php

/**
 * Database layer
 * Requirements
 * 1. Next constant must be defined:
 *          DB_HOST
 *          DB_NAME
 *           DB_PASS
 *           DB_LOGIN
 */

class DbPgSQL{
    var $db_host;
    var $db_port;
    var $db_login;
    var $db_pass;
    var $db_name;
    var $db_link = null;
    var $error_report = false;
    var $last_err = 0;

    function __construct($tHost, $tPort, $tName, $tLogin, $tPass){
        $this->db_host = $tHost;
        $this->db_port = $tPort;
        $this->db_name = $tName;
        $this->db_login = $tLogin;
        $this->db_pass = $tPass;
    }

    function getLink() {
        return $this->db_link;
    }

    function connect(){
        $connect_data = "host=".$this->db_host." port=".$this->db_port." dbname=".$this->db_name." user=".$this->db_login." password=".$this->db_pass."";
        $this->db_link = pg_connect($connect_data) or die('connection failed');
        $stat = pg_connection_status($this->db_link);
        return $stat === PGSQL_CONNECTION_OK;
    }

    function escapeSting($sql) {
        return pg_escape_string($this->db_link, $sql);
    }

    function select($tSql){
        $query_res = pg_query($this->db_link, $tSql);

        if(!$query_res) {
            $this->last_err = pg_last_error($this->db_link);
            if ($this->error_report)
                echo "<br>\nPgSQL error: " . $this->last_err."\nQuery was [$tSql]";
            return false;
        }

        $return_res = array();
        while ($row = pg_fetch_assoc($query_res))
            $return_res[] = $row;

        return $return_res;
    }

    function select_row($tSql){
        $result = array();
        $res = $this->query($tSql, $this->db_link);
        if ($res){
            $tmp = pg_fetch_assoc($res);
            if (is_array($tmp)){
                $result = $tmp;
            }
        }else{
            return false;
        }
        return $result;
    }

    function query($tSql){
        $query_res = pg_query($this->db_link, $tSql);
        if(!$query_res) {
            $this->last_err = pg_last_error($this->db_link);

            if ($this->last_err){
                echo "<br>\nMySQL error: ". $tSql . $this->last_err;
            }
        }
        return $query_res;
    }

    function insert($tSql){
        $result = $this->query($tSql, $this->db_link);
        $last_insert_id = 0;
        $rs = pg_fetch_assoc($result);
        if (pg_connection_status($this->db_link) === PGSQL_CONNECTION_OK) {
            $last_insert_id = $result['ID'];
        }
        return $last_insert_id;
    }

    function close(){
        return pg_close($this->db_link);
    }
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit