Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.5.0
- * @ Author : DeZender
- * @ Release on : 09.06.2012
- * @ Official site : http://DeZender.Net
- *
- */
- class DbClass {
- var $type = null;
- var $link = null;
- var $res = null;
- function DbClass($type) {
- $this->type = $type;
- }
- function connect($host, $user, $pass, $dbname) {
- switch ($this->type) {
- case 'mysql': {
- if ($this->link = @mysql_connect( $host, $user, $pass, true )) {
- return true;
- }
- break;
- }
- case 'pgsql': {
- $host = explode( ':', $host );
- if (!$host[1]) {
- $host[1] = 5432;
- }
- if ($this->link = @pg_connect( '' . 'host=' . $host[0] . ' port=' . $host[1] . ' user=' . $user . ' password=' . $pass . ' dbname=' . $dbname )) {
- return true;
- }
- }
- }
- return false;
- }
- function selectdb($db) {
- switch ($this->type) {
- case 'mysql': {
- if (@mysql_select_db( $db )) {
- return true;
- }
- }
- }
- return false;
- }
- function query($str) {
- switch ($this->type) {
- case 'mysql': {
- return $this->res = @mysql_query( $str );
- }
- case 'pgsql': {
- return $this->res = @pg_query( $this->link, $str );
- }
- }
- return false;
- }
- function fetch() {
- $res = (func_num_args( ) ? func_get_arg( 0 ) : $this->res);
- switch ($this->type) {
- case 'mysql': {
- return @mysql_fetch_assoc( $res );
- }
- case 'pgsql': {
- return @pg_fetch_assoc( $res );
- }
- }
- return false;
- }
- function listDbs() {
- switch ($this->type) {
- case 'mysql': {
- return $this->query( 'SHOW databases' );
- }
- case 'pgsql': {
- return $this->res = $this->query( 'SELECT datname FROM pg_database WHERE datistemplate!=\'t\'' );
- }
- }
- return false;
- }
- function listTables() {
- switch ($this->type) {
- case 'mysql': {
- return $this->res = $this->query( 'SHOW TABLES' );
- }
- case 'pgsql': {
- return $this->res = $this->query( 'select table_name from information_schema.tables where table_schema != \'information_schema\' AND table_schema != \'pg_catalog\'' );
- }
- }
- return false;
- }
- .....................................................
- ...........................
- ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement