Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
RevCMS 1.9.9.9 class.engine.php
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Marlboro20" data-source="post: 296954" data-attributes="member: 40837"><p style="text-align: center"><span style="font-size: 18px">RevolutionCMS engine class update</span></p> <p style="text-align: center"><span style="font-size: 18px"><span style="color: #ff0000">H</span><span style="color: #808080">e</span><span style="color: #80ff00">l</span><span style="color: #ff8000">l</span><span style="color: #ffff00">o</span> <span style="color: #80ff00">b</span><span style="color: #00ff80">a</span><span style="color: #00ffff">s</span><span style="color: #0080ff">t</span><span style="color: #b30059">a</span><span style="color: #006666">r</span><span style="color: #006600">d</span><span style="color: #ff4da6">s</span>! <span style="color: #666600"><img src="/styles/default/xenforo/smilies/emojione/biggrin.png" class="smilie" loading="lazy" alt=":D" title="Big Grin :D" data-shortname=":D" /></span></span></p> <p style="text-align: center"><span style="color: #000000"><strong>i am here to share i quick update of revolutionCMS engine class updated to use mysqli instead of mysql</strong></span></p> <p style="text-align: center"><em><span style="font-size: 9px">Also i haven't tested this but it should work, Just replace the following code below with your class.engine.php</span></em></p> <p style="text-align: center"><em><em><span style="font-size: 9px">i also advise you to actually rename your class.engine.php to class.engine.php.bak and make a new file..</span></em></em></p><p>Just replace the following code below into your class.engine.php in the app folder! </p><p>[PHP]</p><p><?php</p><p> /**</p><p> * Revolution CMS</p><p> *</p><p> * @author Kryptos</p><p> * @author Marlboro20</p><p> *</p><p> * A mysqli class for RevolutionCMS</p><p> */</p><p> namespace Revolution;</p><p> use mysqli;</p><p></p><p> if(!defined('IN_INDEX'))</p><p> {</p><p> die('Direct access to this file was denied');</p><p> }</p><p></p><p> class engine</p><p> {</p><p> protected $connection = null;</p><p></p><p> private $_initiated = false;</p><p> private $_connected = false;</p><p></p><p> final public function Initiate()</p><p> {</p><p> global $_CONFIG;</p><p> </p><p> if($this->_initiated == false)</p><p> {</p><p> $this->_initiated = true;</p><p> $this->connect($_CONFIG['mysql']['connection_type']);</p><p> }</p><p> }</p><p> </p><p> /**</p><p> * Creates a new database connection</p><p> * @return boolean</p><p> */</p><p> final public function connect($type = 'pconnect')</p><p> {</p><p> global $core, $_CONFIG;</p><p> $connection = (($type == 'pconnect') ? 'p:' : '') . $_CONFIG['mysql']['hostname'];</p><p> </p><p> $this->connection = new mysqli($connection, $_CONFIG['mysql']['username'], $_CONFIG['mysql']['password'], $_CONFIG['mysql']['username'], $_CONFIG['mysql']['database']);</p><p> $this->_connected = true;</p><p> </p><p> if(mysqli_connect_errno())</p><p> {</p><p> $core->systemError('MySQL Engine', mysqli_connect_error());</p><p> $this->_connected = false;</p><p> return $this->_connected;</p><p> }</p><p> $this->connection->set_charset("utf8");</p><p> </p><p> return $this->_connected;</p><p> }</p><p> /**</p><p> * Disconnects the database connection</p><p> * @return void</p><p> */</p><p> final public function disconnect()</p><p> {</p><p> global $core;</p><p> </p><p> if($this->_connected == true || $this->connection !== null)</p><p> {</p><p> $this->connection->close();</p><p> $this->connection = null;</p><p> $this->_connected = false;</p><p> }</p><p> }</p><p> /**</p><p> * Secures a string.</p><p> * @input string</p><p> * @return string</p><p> */</p><p> final public function secure($string)</p><p> {</p><p> return $this->connection->real_escape_string(stripslashes(htmlspecialchars($string)));</p><p> }</p><p> /*</p><p> * Runs a query in the database.</p><p> * @returns (object) mysqli object result || False</p><p> */</p><p> final public function query($sql)</p><p> {</p><p> global $core;</p><p> </p><p> if(!$result = $this->connection->query($sql))</p><p> {</p><p> $core->systemError('MySQL Engine', mysqli_error());</p><p> }</p><p> return $result;</p><p> }</p><p> /**</p><p> * Returns the amount of rows in a table.</p><p> * @return (int) row count.</p><p> */</p><p> final public function num_rows($query)</p><p> {</p><p> if($result = $this->query($query))</p><p> {</p><p> return (int) $result->num_rows;</p><p> }</p><p> }</p><p> /**</p><p> * Returns the first row in the array.</p><p> * @return (string) of first array key.</p><p> */</p><p> final public function result($query)</p><p> {</p><p> if($result = $this->fetch_array($query, MYSQLI_NUM))</p><p> {</p><p> return (string) $result[0];</p><p> }</p><p> }</p><p> /**</p><p> * Returns an array of rows from a table in the database.</p><p> * @return (array) $results</p><p> */</p><p> final public function fetch_array($query, $type = MYSQLI_BOTH)</p><p> {</p><p> $results = array();</p><p> </p><p> while($row = $this->query($query)->fetch_array($type))</p><p> {</p><p> $results[] = $row;</p><p> }</p><p> </p><p> return $results;</p><p> $results->free();</p><p> }</p><p> /**</p><p> * Returns an associative array of rows from the database</p><p> * @return (array)(assoc)</p><p> */</p><p> final public function fetch_assoc($query)</p><p> {</p><p> return $this->fetch_array($query, MYSQLI_ASSOC);</p><p> }</p><p> }</p><p>?></p><p>[/PHP]</p><p><strong></strong></p><p><strong>If there is anything wrong please message me!</strong></p></blockquote><p></p>
[QUOTE="Marlboro20, post: 296954, member: 40837"] [CENTER][SIZE=5]RevolutionCMS engine class update [COLOR=#ff0000]H[/COLOR][COLOR=#808080]e[/COLOR][COLOR=#80ff00]l[/COLOR][COLOR=#ff8000]l[/COLOR][COLOR=#ffff00]o[/COLOR] [COLOR=#80ff00]b[/COLOR][COLOR=#00ff80]a[/COLOR][COLOR=#00ffff]s[/COLOR][COLOR=#0080ff]t[/COLOR][COLOR=#b30059]a[/COLOR][COLOR=#006666]r[/COLOR][COLOR=#006600]d[/COLOR][COLOR=#ff4da6]s[/COLOR]! [COLOR=#666600]:D[/COLOR][/SIZE] [COLOR=#000000][B]i am here to share i quick update of revolutionCMS engine class updated to use mysqli instead of mysql[/B][/COLOR] [I][SIZE=1]Also i haven't tested this but it should work, Just replace the following code below with your class.engine.php[/SIZE] [I][SIZE=1]i also advise you to actually rename your class.engine.php to class.engine.php.bak and make a new file..[/SIZE][/I][/I][/CENTER] Just replace the following code below into your class.engine.php in the app folder! [PHP] <?php /** * Revolution CMS * * @author Kryptos * @author Marlboro20 * * A mysqli class for RevolutionCMS */ namespace Revolution; use mysqli; if(!defined('IN_INDEX')) { die('Direct access to this file was denied'); } class engine { protected $connection = null; private $_initiated = false; private $_connected = false; final public function Initiate() { global $_CONFIG; if($this->_initiated == false) { $this->_initiated = true; $this->connect($_CONFIG['mysql']['connection_type']); } } /** * Creates a new database connection * @return boolean */ final public function connect($type = 'pconnect') { global $core, $_CONFIG; $connection = (($type == 'pconnect') ? 'p:' : '') . $_CONFIG['mysql']['hostname']; $this->connection = new mysqli($connection, $_CONFIG['mysql']['username'], $_CONFIG['mysql']['password'], $_CONFIG['mysql']['username'], $_CONFIG['mysql']['database']); $this->_connected = true; if(mysqli_connect_errno()) { $core->systemError('MySQL Engine', mysqli_connect_error()); $this->_connected = false; return $this->_connected; } $this->connection->set_charset("utf8"); return $this->_connected; } /** * Disconnects the database connection * @return void */ final public function disconnect() { global $core; if($this->_connected == true || $this->connection !== null) { $this->connection->close(); $this->connection = null; $this->_connected = false; } } /** * Secures a string. * @input string * @return string */ final public function secure($string) { return $this->connection->real_escape_string(stripslashes(htmlspecialchars($string))); } /* * Runs a query in the database. * @returns (object) mysqli object result || False */ final public function query($sql) { global $core; if(!$result = $this->connection->query($sql)) { $core->systemError('MySQL Engine', mysqli_error()); } return $result; } /** * Returns the amount of rows in a table. * @return (int) row count. */ final public function num_rows($query) { if($result = $this->query($query)) { return (int) $result->num_rows; } } /** * Returns the first row in the array. * @return (string) of first array key. */ final public function result($query) { if($result = $this->fetch_array($query, MYSQLI_NUM)) { return (string) $result[0]; } } /** * Returns an array of rows from a table in the database. * @return (array) $results */ final public function fetch_array($query, $type = MYSQLI_BOTH) { $results = array(); while($row = $this->query($query)->fetch_array($type)) { $results[] = $row; } return $results; $results->free(); } /** * Returns an associative array of rows from the database * @return (array)(assoc) */ final public function fetch_assoc($query) { return $this->fetch_array($query, MYSQLI_ASSOC); } } ?> [/PHP] [B] If there is anything wrong please message me![/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
RevCMS 1.9.9.9 class.engine.php
Top