Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php goto PwZJS; I_2T2: class C_Database { public $hostName; public $userName; public $..
Decoded Output download
<?php
goto PwZJS; I_2T2: class C_Database { public $hostName; public $userName; public $password; public $databaseName; public $tableName; public $link; public $dbType; public $charset; public $db; public $result; public function __construct($host, $user, $pass, $dbName, $db_type = "mysql", $charset = '') { $this->hostName = $host; $this->userName = $user; $this->password = $pass; $this->databaseName = $dbName; $this->dbType = $db_type; $this->charset = $charset; $this->_db_connect(); } public function _db_connect() { switch ($this->dbType) { case "access": $this->db = ADONewConnection($this->dbType); $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" . $this->databaseName . ";Uid=" . $this->userName . ";Pwd=" . $this->password . ";"; $this->db->Connect($dsn); break; case "odbc_mssql_native": $this->db = ADONewConnection("odbc_mssql"); $dsn = "Driver={SQL Server};Server=" . $this->hostName . ";Database=" . $this->databaseName . ";"; $this->db->Connect($dsn, $this->userName, $this->password); break; case "odbc_mssql": $this->db = ADONewConnection($this->dbType); $this->db->Connect($this->hostName, $this->userName, $this->password); break; case "postgres": $this->db = ADONewConnection($this->dbType); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("Error: Could not connect to the database"); if (!empty($this->charset)) { $this->db->Execute("SET NAMES '{$this->charset}'"); } break; case "db2": $this->db = ADONewConnection($this->dbType); $dsn = "driver={IBM db2 odbc DRIVER};Database=" . $this->databaseName . ";hostname=" . $this->hostName . ";port=50000;protocol=TCPIP;uid=" . $this->userName . "; pwd=" . $this->password; $this->db->Connect($dsn); break; case "db2-dsnless": $this->db = ADONewConnection("db2"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName); break; case "ibase": $this->db = ADONewConnection($this->dbType); $this->db->Connect($this->hostName . $this->databaseName, $this->userName, $this->password); break; case "oci805": $this->db = ADONewConnection($this->dbType); $ret = $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName); if (!$ret) { $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName); } break; case "sqlite": $this->db = ADONewConnection("sqlite"); $this->db->Connect($this->hostName); break; case "informix": $this->db = ADONewConnection("informix"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("Error: Could not connect to the database"); break; case "informix72": $this->db = ADONewConnection("informix72"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("Error: Could not connect to the database"); break; case "odbc": $this->db = ADONewConnection($this->dbType); $dsn = "DSN=" . $this->hostName . ";uid=" . $this->userName . "; pwd=" . $this->password; $this->db->Connect($dsn); break; default: $this->db = ADONewConnection("mysqli"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("Error: Could not connect to the database"); if (!empty($this->charset)) { $this->db->Execute("SET NAMES '{$this->charset}'"); } } } public function db_query($query_str) { $this->db->SetFetchMode(ADODB_FETCH_BOTH); $result = $this->db->Execute($query_str) or die(C_Utility::is_debug() ? "\xa" . "PHPGRID_DEBUG: C_Database->db_query() - " . $this->db->ErrorMsg() . "\xa" : "\xa" . "PHPGRID_ERROR: Could not execute query. Error 101." . "
"); $this->result = $result; return $result; } public function select_limit($query_str, $size, $starting_row) { $this->db->SetFetchMode(ADODB_FETCH_BOTH); $result = $this->db->SelectLimit($query_str, $size, $starting_row) or die(C_Utility::is_debug() ? "
" . "PHPGRID_DEBUG: C_Database->select_limit() - " . $this->db->ErrorMsg() . "
" : "
" . "PHPGRID_ERROR: Could not execute query. Error 102" . "
"); $this->result = $result; return $result; } public function select_limit_array($query_str, $size, $starting_row) { $result = $this->select_limit($query_str, $size, $starting_row); $resultArray = $result->GetArray(); $this->result = $resultArray; return $resultArray; } public function fetch_row(&$result) { $ADODB_FETCH_MODE = ADODB_FETCH_NUM; if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function fetch_array(&$result) { $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function fetch_array_assoc(&$result) { $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function num_rows($result) { return $result->RecordCount(); } public function query_then_fetch_array_first($query_str) { $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; $result = $this->db->Execute($query_str) or die("PHPGRID_ERROR: query_then_fetch_array_first() - " . $this->db->ErrorMsg()); if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function num_fields($result) { return $result->FieldCount(); } public function field_name($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); return isset($obj_field->name) ? $obj_field->name : ''; } public function field_nativetype($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); return isset($obj_field->type) ? $obj_field->type : ''; } public function field_metatype($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); $type = $result->MetaType($obj_field->type, $obj_field->max_length); return $type; } public function field_metacolumn($table, $col_name) { $arr = array(); $arr = $this->db->MetaColumns($table); $obj_field = new ADOFieldObject(); if (isset($arr[strtoupper($col_name)])) { $obj_field = $arr[strtoupper($col_name)]; return $obj_field; } else { return false; } } public function field_index($result, $field_name) { $field_count = $this->num_fields($result); $i = 0; for ($i = 0; $i < $field_count; $i++) { if ($field_name == $this->field_name($result, $i)) { return $i; } } return -1; } public function field_len($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); return isset($obj_field->max_length) ? $obj_field->max_length : ''; } function quote_field($sql, $fieldname, $fieldvalue) { $rs = $this->select_limit($sql, 1, 1); $fm_type = $this->field_metatype($rs, $this->field_index($rs, $fieldname)); switch ($fm_type) { case "I": case "N": case "R": case "L": $qstr = $fieldname . "=" . $fieldvalue; break; default: $qstr = $fieldname . "='" . $fieldvalue . "'"; break; } return $qstr; } function quote_fields(&$rs, $sql_key = array(), $key_value = array()) { $pk_val_new = array(); $fm_types = array(); for ($t = 0; $t < count($sql_key); $t++) { $fm_type = $this->field_metatype($rs, $this->field_index($rs, $sql_key[$t])); $fm_types[] = $fm_type; } for ($i = 0; $i < count($key_value); $i++) { $pk_val_fields = explode(PK_DELIMITER, $key_value[$i]); for ($j = 0; $j < count($sql_key); $j++) { $fm_type = $fm_types[$j]; if ($fm_type != "I" && $fm_type != "N" && $fm_type != "R") { $pk_val_fld = "'" . $pk_val_fields[$j] . "'"; } else { $pk_val_fld = $pk_val_fields[$j]; } $pk_val_fields[$j] = $pk_val_fld; } $pk_val_new[] = "(" . implode(",", $pk_val_fields) . ")"; } return $pk_val_new; } public function get_col_dbnames($result) { $col_dbnames = array(); $num_fields = $result->FieldCount(); for ($i = 0; $i < $num_fields; $i++) { $col_dbname = $this->field_name($result, $i); $col_dbnames[] = $col_dbname; } return $col_dbnames; } } goto xfUq9; PwZJS: if (!session_id()) { session_start(); } goto I_2T2; xfUq9: ?>
Did this file decode correctly?
Original Code
<?php
goto PwZJS; I_2T2: class C_Database { public $hostName; public $userName; public $password; public $databaseName; public $tableName; public $link; public $dbType; public $charset; public $db; public $result; public function __construct($host, $user, $pass, $dbName, $db_type = "\x6d\x79\163\x71\x6c", $charset = '') { $this->hostName = $host; $this->userName = $user; $this->password = $pass; $this->databaseName = $dbName; $this->dbType = $db_type; $this->charset = $charset; $this->_db_connect(); } public function _db_connect() { switch ($this->dbType) { case "\x61\x63\143\x65\163\x73": $this->db = ADONewConnection($this->dbType); $dsn = "\104\x72\x69\166\x65\x72\75\173\115\x69\x63\x72\x6f\x73\157\x66\164\40\x41\x63\143\x65\163\163\x20\x44\x72\151\x76\145\162\40\x28\52\x2e\x6d\144\142\51\175\x3b\104\x62\x71\x3d" . $this->databaseName . "\73\125\151\144\75" . $this->userName . "\x3b\x50\x77\144\75" . $this->password . "\x3b"; $this->db->Connect($dsn); break; case "\157\x64\x62\x63\137\x6d\163\163\161\x6c\x5f\156\x61\164\151\x76\145": $this->db = ADONewConnection("\x6f\x64\142\143\x5f\x6d\x73\163\161\154"); $dsn = "\x44\x72\151\166\x65\162\x3d\x7b\123\x51\114\x20\123\x65\x72\x76\145\x72\175\73\123\145\162\166\145\x72\75" . $this->hostName . "\73\x44\141\x74\141\x62\141\x73\x65\x3d" . $this->databaseName . "\73"; $this->db->Connect($dsn, $this->userName, $this->password); break; case "\157\x64\142\143\x5f\x6d\x73\x73\161\x6c": $this->db = ADONewConnection($this->dbType); $this->db->Connect($this->hostName, $this->userName, $this->password); break; case "\x70\x6f\x73\x74\x67\x72\145\163": $this->db = ADONewConnection($this->dbType); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("\105\162\162\157\x72\72\x20\103\x6f\165\154\x64\x20\x6e\157\x74\40\143\x6f\x6e\156\145\x63\164\40\x74\x6f\40\x74\150\145\x20\144\141\x74\x61\142\141\x73\x65"); if (!empty($this->charset)) { $this->db->Execute("\123\105\x54\40\x4e\x41\115\105\x53\40\47{$this->charset}\x27"); } break; case "\x64\142\x32": $this->db = ADONewConnection($this->dbType); $dsn = "\x64\x72\x69\166\145\x72\75\x7b\x49\102\115\x20\144\142\x32\40\x6f\x64\142\143\40\x44\x52\x49\126\x45\x52\175\x3b\x44\x61\x74\x61\142\x61\163\x65\x3d" . $this->databaseName . "\x3b\150\x6f\x73\164\x6e\141\155\x65\x3d" . $this->hostName . "\73\x70\x6f\162\164\75\65\60\60\x30\60\x3b\x70\162\157\164\157\x63\x6f\154\75\124\103\x50\x49\120\x3b\165\x69\144\75" . $this->userName . "\73\40\x70\x77\144\x3d" . $this->password; $this->db->Connect($dsn); break; case "\x64\142\x32\55\x64\x73\156\154\x65\x73\163": $this->db = ADONewConnection("\144\x62\x32"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName); break; case "\151\x62\x61\x73\x65": $this->db = ADONewConnection($this->dbType); $this->db->Connect($this->hostName . $this->databaseName, $this->userName, $this->password); break; case "\157\x63\151\x38\x30\65": $this->db = ADONewConnection($this->dbType); $ret = $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName); if (!$ret) { $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName); } break; case "\163\161\x6c\x69\x74\x65": $this->db = ADONewConnection("\163\x71\x6c\151\x74\x65"); $this->db->Connect($this->hostName); break; case "\151\156\x66\x6f\162\x6d\151\170": $this->db = ADONewConnection("\151\x6e\x66\x6f\x72\x6d\x69\x78"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("\105\162\162\x6f\x72\72\40\103\x6f\x75\154\x64\40\156\157\x74\x20\x63\x6f\156\x6e\145\x63\164\x20\x74\157\x20\164\150\145\x20\144\x61\x74\x61\142\141\x73\x65"); break; case "\151\156\146\x6f\162\x6d\151\170\67\x32": $this->db = ADONewConnection("\151\x6e\146\157\162\155\151\170\67\x32"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("\x45\x72\x72\157\x72\72\40\x43\x6f\165\154\x64\40\x6e\x6f\x74\40\143\157\x6e\x6e\145\143\164\x20\164\x6f\x20\x74\150\x65\40\144\141\164\141\142\141\x73\x65"); break; case "\x6f\x64\x62\x63": $this->db = ADONewConnection($this->dbType); $dsn = "\x44\x53\116\x3d" . $this->hostName . "\73\x75\151\144\x3d" . $this->userName . "\x3b\40\x70\x77\x64\x3d" . $this->password; $this->db->Connect($dsn); break; default: $this->db = ADONewConnection("\x6d\x79\163\x71\x6c\151"); $this->db->Connect($this->hostName, $this->userName, $this->password, $this->databaseName) or die("\105\162\162\x6f\162\x3a\40\103\157\165\154\144\x20\156\x6f\x74\40\143\x6f\x6e\156\x65\143\x74\40\x74\157\40\x74\x68\145\40\144\x61\164\x61\142\x61\163\145"); if (!empty($this->charset)) { $this->db->Execute("\123\105\124\x20\116\x41\x4d\x45\123\x20\x27{$this->charset}\x27"); } } } public function db_query($query_str) { $this->db->SetFetchMode(ADODB_FETCH_BOTH); $result = $this->db->Execute($query_str) or die(C_Utility::is_debug() ? "\xa" . "\x50\x48\120\107\122\111\104\x5f\x44\x45\x42\x55\x47\x3a\40\x43\137\x44\141\x74\x61\x62\x61\x73\145\55\x3e\144\x62\137\161\x75\x65\x72\171\x28\51\x20\55\40" . $this->db->ErrorMsg() . "\xa" : "\xa" . "\120\110\120\x47\x52\111\x44\137\105\122\x52\117\122\x3a\40\x43\157\x75\154\144\40\x6e\x6f\164\x20\x65\170\x65\143\x75\x74\x65\40\x71\x75\145\x72\x79\x2e\x20\105\x72\x72\157\162\x20\61\x30\x31\56" . "\12"); $this->result = $result; return $result; } public function select_limit($query_str, $size, $starting_row) { $this->db->SetFetchMode(ADODB_FETCH_BOTH); $result = $this->db->SelectLimit($query_str, $size, $starting_row) or die(C_Utility::is_debug() ? "\12" . "\120\x48\120\x47\122\x49\x44\x5f\x44\x45\102\125\107\72\x20\x43\137\104\141\164\x61\142\x61\163\x65\55\x3e\x73\145\154\145\143\x74\x5f\154\x69\x6d\x69\x74\x28\51\40\55\40" . $this->db->ErrorMsg() . "\12" : "\12" . "\x50\x48\120\107\122\x49\104\137\x45\x52\122\x4f\122\72\x20\x43\157\x75\x6c\144\40\156\x6f\x74\40\x65\x78\145\143\165\164\x65\x20\x71\165\x65\162\x79\56\40\x45\162\162\x6f\x72\x20\61\x30\x32" . "\12"); $this->result = $result; return $result; } public function select_limit_array($query_str, $size, $starting_row) { $result = $this->select_limit($query_str, $size, $starting_row); $resultArray = $result->GetArray(); $this->result = $resultArray; return $resultArray; } public function fetch_row(&$result) { $ADODB_FETCH_MODE = ADODB_FETCH_NUM; if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function fetch_array(&$result) { $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function fetch_array_assoc(&$result) { $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function num_rows($result) { return $result->RecordCount(); } public function query_then_fetch_array_first($query_str) { $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; $result = $this->db->Execute($query_str) or die("\120\110\x50\x47\122\111\104\x5f\x45\122\122\117\x52\72\40\x71\165\145\162\171\137\164\150\x65\x6e\x5f\146\145\x74\x63\x68\137\x61\162\x72\141\171\137\146\151\162\163\164\x28\51\40\x2d\40" . $this->db->ErrorMsg()); if (!$result->EOF) { $rs = $result->fields; $result->MoveNext(); return $rs; } } public function num_fields($result) { return $result->FieldCount(); } public function field_name($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); return isset($obj_field->name) ? $obj_field->name : ''; } public function field_nativetype($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); return isset($obj_field->type) ? $obj_field->type : ''; } public function field_metatype($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); $type = $result->MetaType($obj_field->type, $obj_field->max_length); return $type; } public function field_metacolumn($table, $col_name) { $arr = array(); $arr = $this->db->MetaColumns($table); $obj_field = new ADOFieldObject(); if (isset($arr[strtoupper($col_name)])) { $obj_field = $arr[strtoupper($col_name)]; return $obj_field; } else { return false; } } public function field_index($result, $field_name) { $field_count = $this->num_fields($result); $i = 0; for ($i = 0; $i < $field_count; $i++) { if ($field_name == $this->field_name($result, $i)) { return $i; } } return -1; } public function field_len($result, $index) { $obj_field = new ADOFieldObject(); $obj_field = $result->FetchField($index); return isset($obj_field->max_length) ? $obj_field->max_length : ''; } function quote_field($sql, $fieldname, $fieldvalue) { $rs = $this->select_limit($sql, 1, 1); $fm_type = $this->field_metatype($rs, $this->field_index($rs, $fieldname)); switch ($fm_type) { case "\x49": case "\x4e": case "\x52": case "\114": $qstr = $fieldname . "\x3d" . $fieldvalue; break; default: $qstr = $fieldname . "\75\x27" . $fieldvalue . "\47"; break; } return $qstr; } function quote_fields(&$rs, $sql_key = array(), $key_value = array()) { $pk_val_new = array(); $fm_types = array(); for ($t = 0; $t < count($sql_key); $t++) { $fm_type = $this->field_metatype($rs, $this->field_index($rs, $sql_key[$t])); $fm_types[] = $fm_type; } for ($i = 0; $i < count($key_value); $i++) { $pk_val_fields = explode(PK_DELIMITER, $key_value[$i]); for ($j = 0; $j < count($sql_key); $j++) { $fm_type = $fm_types[$j]; if ($fm_type != "\x49" && $fm_type != "\x4e" && $fm_type != "\x52") { $pk_val_fld = "\x27" . $pk_val_fields[$j] . "\47"; } else { $pk_val_fld = $pk_val_fields[$j]; } $pk_val_fields[$j] = $pk_val_fld; } $pk_val_new[] = "\50" . implode("\54", $pk_val_fields) . "\51"; } return $pk_val_new; } public function get_col_dbnames($result) { $col_dbnames = array(); $num_fields = $result->FieldCount(); for ($i = 0; $i < $num_fields; $i++) { $col_dbname = $this->field_name($result, $i); $col_dbnames[] = $col_dbname; } return $col_dbnames; } } goto xfUq9; PwZJS: if (!session_id()) { session_start(); } goto I_2T2; xfUq9: ?>
Function Calls
None |
Stats
MD5 | 61116627eaff006042386ff9d57011e6 |
Eval Count | 0 |
Decode Time | 44 ms |