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 if (!defined("\102\101\123\105\120\x41\x54\110")) { die("\x4e\157\40\144\151\x72\14..
Decoded Output download
<?php
if (!defined("BASEPATH")) { die("No direct script access allowed"); } class CI_DB_mysql_driver extends CI_DB { var $dbdriver = "mysql"; var $_escape_char = "`"; var $_like_escape_str = ''; var $_like_escape_chr = ''; var $delete_hack = TRUE; var $_count_string = "SELECT COUNT(*) AS "; var $_random_keyword = " RAND()"; function db_connect() { if ($this->port != '') { $this->hostname .= ":" . $this->port; } return @mysql_connect($this->hostname, $this->username, $this->password, TRUE); } function db_pconnect() { if ($this->port != '') { $this->hostname .= ":" . $this->port; } return @mysql_pconnect($this->hostname, $this->username, $this->password); } function reconnect() { if (mysql_ping($this->conn_id) === FALSE) { $this->conn_id = FALSE; } } function db_select() { return @mysql_select_db($this->database, $this->conn_id); } function db_set_charset($charset, $collation) { return @mysql_query("SET NAMES '" . $this->escape_str($charset) . "' COLLATE '" . $this->escape_str($collation) . "'", $this->conn_id); } function _version() { return "SELECT version() AS ver"; } function _execute($sql) { $sql = $this->_prep_query($sql); return @mysql_query($sql, $this->conn_id); } function _prep_query($sql) { if ($this->delete_hack === TRUE) { if (preg_match("/^\s*DELETE\s+FROM\s+(\S+)\s*$/i", $sql)) { $sql = preg_replace("/^\s*DELETE\s+FROM\s+(\S+)\s*$/", "DELETE FROM \1 WHERE 1=1", $sql); } } return $sql; } function trans_begin($test_mode = FALSE) { if (!$this->trans_enabled) { return TRUE; } if ($this->_trans_depth > 0) { return TRUE; } $this->_trans_failure = $test_mode === TRUE ? TRUE : FALSE; $this->simple_query("SET AUTOCOMMIT=0"); $this->simple_query("START TRANSACTION"); return TRUE; } function trans_commit() { if (!$this->trans_enabled) { return TRUE; } if ($this->_trans_depth > 0) { return TRUE; } $this->simple_query("COMMIT"); $this->simple_query("SET AUTOCOMMIT=1"); return TRUE; } function trans_rollback() { if (!$this->trans_enabled) { return TRUE; } if ($this->_trans_depth > 0) { return TRUE; } $this->simple_query("ROLLBACK"); $this->simple_query("SET AUTOCOMMIT=1"); return TRUE; } function escape_str($str, $like = FALSE) { if (is_array($str)) { foreach ($str as $key => $val) { $str[$key] = $this->escape_str($val, $like); } return $str; } if (function_exists("mysql_real_escape_string") and is_resource($this->conn_id)) { $str = mysql_real_escape_string($str, $this->conn_id); } elseif (function_exists("mysql_escape_string")) { $str = mysql_escape_string($str); } else { $str = addslashes($str); } if ($like === TRUE) { $str = str_replace(array("%", "_"), array("\%", "\_"), $str); } return $str; } function affected_rows() { return @mysql_affected_rows($this->conn_id); } function insert_id() { return @mysql_insert_id($this->conn_id); } function count_all($table = '') { if ($table == '') { return 0; } $query = $this->query($this->_count_string . $this->_protect_identifiers("numrows") . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); if ($query->num_rows() == 0) { return 0; } $row = $query->row(); return (int) $row->numrows; } function _list_tables($prefix_limit = FALSE) { $sql = "SHOW TABLES FROM " . $this->_escape_char . $this->database . $this->_escape_char; if ($prefix_limit !== FALSE and $this->dbprefix != '') { $sql .= " LIKE '" . $this->escape_like_str($this->dbprefix) . "%'"; } return $sql; } function _list_columns($table = '') { return "SHOW COLUMNS FROM " . $table; } function _field_data($table) { return "SELECT * FROM " . $table . " LIMIT 1"; } function _error_message() { return mysql_error($this->conn_id); } function _error_number() { return mysql_errno($this->conn_id); } function _escape_identifiers($item) { if ($this->_escape_char == '') { return $item; } foreach ($this->_reserved_identifiers as $id) { if (strpos($item, "." . $id) !== FALSE) { $str = $this->_escape_char . str_replace(".", $this->_escape_char . ".", $item); return preg_replace("/[" . $this->_escape_char . "]+/", $this->_escape_char, $str); } } if (strpos($item, ".") !== FALSE) { $str = $this->_escape_char . str_replace(".", $this->_escape_char . "." . $this->_escape_char, $item) . $this->_escape_char; } else { $str = $this->_escape_char . $item . $this->_escape_char; } return preg_replace("/[" . $this->_escape_char . "]+/", $this->_escape_char, $str); } function _from_tables($tables) { if (!is_array($tables)) { $tables = array($tables); } return "(" . implode(", ", $tables) . ")"; } function _insert($table, $keys, $values) { return "INSERT INTO " . $table . " (" . implode(", ", $keys) . ") VALUES (" . implode(", ", $values) . ")"; } function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { $valstr[] = $key . " = " . $val; } $limit = !$limit ? '' : " LIMIT " . $limit; $orderby = count($orderby) >= 1 ? " ORDER BY " . implode(", ", $orderby) : ''; $sql = "UPDATE " . $table . " SET " . implode(", ", $valstr); $sql .= ($where != '' and count($where) >= 1) ? " WHERE " . implode(" ", $where) : ''; $sql .= $orderby . $limit; return $sql; } function _truncate($table) { return "TRUNCATE " . $table; } function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; if (count($where) > 0 or count($like) > 0) { $conditions = "\xaWHERE "; $conditions .= implode("\xa", $this->ar_where); if (count($where) > 0 && count($like) > 0) { $conditions .= " AND "; } $conditions .= implode("
", $like); } $limit = !$limit ? '' : " LIMIT " . $limit; return "DELETE FROM " . $table . $conditions . $limit; } function _limit($sql, $limit, $offset) { if ($offset == 0) { $offset = ''; } else { $offset .= ", "; } return $sql . "LIMIT " . $offset . $limit; } function _close($conn_id) { @mysql_close($conn_id); } } ?>
Did this file decode correctly?
Original Code
<?php
if (!defined("\102\101\123\105\120\x41\x54\110")) { die("\x4e\157\40\144\151\x72\145\143\164\x20\x73\143\162\151\160\x74\x20\x61\x63\x63\145\x73\x73\x20\141\154\x6c\x6f\x77\x65\x64"); } class CI_DB_mysql_driver extends CI_DB { var $dbdriver = "\x6d\x79\163\x71\154"; var $_escape_char = "\140"; var $_like_escape_str = ''; var $_like_escape_chr = ''; var $delete_hack = TRUE; var $_count_string = "\123\x45\114\105\103\x54\40\x43\117\x55\x4e\x54\x28\x2a\51\x20\101\123\x20"; var $_random_keyword = "\40\x52\101\x4e\104\x28\51"; function db_connect() { if ($this->port != '') { $this->hostname .= "\72" . $this->port; } return @mysql_connect($this->hostname, $this->username, $this->password, TRUE); } function db_pconnect() { if ($this->port != '') { $this->hostname .= "\72" . $this->port; } return @mysql_pconnect($this->hostname, $this->username, $this->password); } function reconnect() { if (mysql_ping($this->conn_id) === FALSE) { $this->conn_id = FALSE; } } function db_select() { return @mysql_select_db($this->database, $this->conn_id); } function db_set_charset($charset, $collation) { return @mysql_query("\x53\x45\x54\40\116\101\x4d\x45\123\40\47" . $this->escape_str($charset) . "\47\x20\103\117\114\x4c\x41\124\105\x20\x27" . $this->escape_str($collation) . "\47", $this->conn_id); } function _version() { return "\123\x45\x4c\x45\103\x54\x20\166\x65\162\x73\151\x6f\x6e\50\51\x20\101\x53\40\166\x65\x72"; } function _execute($sql) { $sql = $this->_prep_query($sql); return @mysql_query($sql, $this->conn_id); } function _prep_query($sql) { if ($this->delete_hack === TRUE) { if (preg_match("\57\136\134\x73\x2a\104\x45\x4c\x45\x54\x45\x5c\x73\x2b\x46\122\117\115\x5c\x73\53\x28\x5c\123\53\x29\x5c\x73\x2a\44\x2f\151", $sql)) { $sql = preg_replace("\57\136\134\163\52\x44\105\114\x45\x54\105\x5c\x73\x2b\x46\122\117\115\x5c\x73\53\50\134\x53\x2b\x29\x5c\x73\x2a\44\57", "\104\x45\x4c\105\x54\x45\40\x46\122\117\115\40\134\61\x20\127\110\x45\x52\x45\40\x31\75\61", $sql); } } return $sql; } function trans_begin($test_mode = FALSE) { if (!$this->trans_enabled) { return TRUE; } if ($this->_trans_depth > 0) { return TRUE; } $this->_trans_failure = $test_mode === TRUE ? TRUE : FALSE; $this->simple_query("\123\105\x54\x20\x41\x55\x54\117\103\117\115\115\x49\x54\x3d\x30"); $this->simple_query("\123\x54\x41\122\x54\x20\x54\122\x41\x4e\x53\101\103\x54\111\117\116"); return TRUE; } function trans_commit() { if (!$this->trans_enabled) { return TRUE; } if ($this->_trans_depth > 0) { return TRUE; } $this->simple_query("\103\117\x4d\115\x49\x54"); $this->simple_query("\x53\105\124\40\101\x55\x54\117\103\117\115\115\111\x54\75\61"); return TRUE; } function trans_rollback() { if (!$this->trans_enabled) { return TRUE; } if ($this->_trans_depth > 0) { return TRUE; } $this->simple_query("\x52\117\114\x4c\x42\101\x43\x4b"); $this->simple_query("\x53\105\124\40\101\125\124\x4f\103\117\115\115\111\x54\x3d\x31"); return TRUE; } function escape_str($str, $like = FALSE) { if (is_array($str)) { foreach ($str as $key => $val) { $str[$key] = $this->escape_str($val, $like); } return $str; } if (function_exists("\155\171\163\x71\154\x5f\162\x65\x61\154\x5f\x65\163\x63\141\160\145\x5f\x73\164\x72\x69\x6e\147") and is_resource($this->conn_id)) { $str = mysql_real_escape_string($str, $this->conn_id); } elseif (function_exists("\x6d\171\163\x71\154\x5f\145\x73\x63\x61\x70\145\x5f\x73\164\x72\x69\156\x67")) { $str = mysql_escape_string($str); } else { $str = addslashes($str); } if ($like === TRUE) { $str = str_replace(array("\45", "\x5f"), array("\134\45", "\134\137"), $str); } return $str; } function affected_rows() { return @mysql_affected_rows($this->conn_id); } function insert_id() { return @mysql_insert_id($this->conn_id); } function count_all($table = '') { if ($table == '') { return 0; } $query = $this->query($this->_count_string . $this->_protect_identifiers("\156\165\x6d\x72\157\x77\x73") . "\40\106\x52\117\115\x20" . $this->_protect_identifiers($table, TRUE, NULL, FALSE)); if ($query->num_rows() == 0) { return 0; } $row = $query->row(); return (int) $row->numrows; } function _list_tables($prefix_limit = FALSE) { $sql = "\123\110\117\127\x20\124\101\x42\x4c\x45\123\40\106\122\117\x4d\40" . $this->_escape_char . $this->database . $this->_escape_char; if ($prefix_limit !== FALSE and $this->dbprefix != '') { $sql .= "\x20\114\111\113\105\x20\x27" . $this->escape_like_str($this->dbprefix) . "\45\x27"; } return $sql; } function _list_columns($table = '') { return "\x53\x48\x4f\x57\40\x43\117\114\125\x4d\116\123\x20\106\x52\117\x4d\40" . $table; } function _field_data($table) { return "\x53\105\x4c\105\103\124\x20\52\40\x46\x52\117\115\40" . $table . "\40\114\x49\115\x49\x54\x20\61"; } function _error_message() { return mysql_error($this->conn_id); } function _error_number() { return mysql_errno($this->conn_id); } function _escape_identifiers($item) { if ($this->_escape_char == '') { return $item; } foreach ($this->_reserved_identifiers as $id) { if (strpos($item, "\x2e" . $id) !== FALSE) { $str = $this->_escape_char . str_replace("\x2e", $this->_escape_char . "\56", $item); return preg_replace("\x2f\x5b" . $this->_escape_char . "\135\x2b\x2f", $this->_escape_char, $str); } } if (strpos($item, "\56") !== FALSE) { $str = $this->_escape_char . str_replace("\56", $this->_escape_char . "\x2e" . $this->_escape_char, $item) . $this->_escape_char; } else { $str = $this->_escape_char . $item . $this->_escape_char; } return preg_replace("\57\133" . $this->_escape_char . "\x5d\53\57", $this->_escape_char, $str); } function _from_tables($tables) { if (!is_array($tables)) { $tables = array($tables); } return "\x28" . implode("\54\40", $tables) . "\51"; } function _insert($table, $keys, $values) { return "\111\x4e\123\x45\x52\x54\x20\111\x4e\124\117\40" . $table . "\x20\x28" . implode("\54\x20", $keys) . "\51\40\126\x41\114\x55\x45\123\x20\x28" . implode("\54\x20", $values) . "\51"; } function _update($table, $values, $where, $orderby = array(), $limit = FALSE) { foreach ($values as $key => $val) { $valstr[] = $key . "\x20\75\40" . $val; } $limit = !$limit ? '' : "\x20\114\x49\115\x49\124\x20" . $limit; $orderby = count($orderby) >= 1 ? "\40\x4f\x52\104\x45\x52\40\102\131\40" . implode("\54\x20", $orderby) : ''; $sql = "\x55\120\x44\x41\x54\105\40" . $table . "\x20\123\105\124\40" . implode("\54\40", $valstr); $sql .= ($where != '' and count($where) >= 1) ? "\x20\127\110\x45\122\x45\x20" . implode("\x20", $where) : ''; $sql .= $orderby . $limit; return $sql; } function _truncate($table) { return "\124\x52\x55\x4e\x43\101\124\105\x20" . $table; } function _delete($table, $where = array(), $like = array(), $limit = FALSE) { $conditions = ''; if (count($where) > 0 or count($like) > 0) { $conditions = "\xa\x57\x48\105\x52\105\40"; $conditions .= implode("\xa", $this->ar_where); if (count($where) > 0 && count($like) > 0) { $conditions .= "\x20\101\x4e\x44\x20"; } $conditions .= implode("\12", $like); } $limit = !$limit ? '' : "\x20\114\111\115\x49\124\x20" . $limit; return "\x44\105\x4c\x45\x54\105\40\x46\x52\x4f\x4d\40" . $table . $conditions . $limit; } function _limit($sql, $limit, $offset) { if ($offset == 0) { $offset = ''; } else { $offset .= "\54\x20"; } return $sql . "\x4c\x49\x4d\x49\124\x20" . $offset . $limit; } function _close($conn_id) { @mysql_close($conn_id); } }
Function Calls
| None |
Stats
| MD5 | 394a9314861223c4ba01e41edf7aa329 |
| Eval Count | 0 |
| Decode Time | 98 ms |