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 Q&A
PHP Bcrypt Hashing and Verifying Passwords.
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="Berk" data-source="post: 415715" data-attributes="member: 63611"><p>Hello everyone.</p><p>This might be a habbo related but however. Sorry if posted in wrong section.</p><p>I'm using Micro Edit (<a href="https://devbest.com/threads/micro-hotel-release-cabbo-edit.80306/" target="_blank">https://devbest.com/threads/micro-hotel-release-cabbo-edit.80306/</a>) by [USER=66193]@JynX[/USER] and I use bcrypt on my revcms. </p><p></p><p>For HK login, it uses md5 and I want to use bcrypt.</p><p>My RevCMS bcrypt function </p><p>[PHP] public function hashed($string) { </p><p>return password_hash($string, PASSWORD_BCRYPT, array('cost' => 12));</p><p>}</p><p>[/PHP] </p><p>Login function for HK: </p><p>[PHP]</p><p> </p><p> public function authenticate($user_name,$password)</p><p> {</p><p> if($user_name == NULL || $password == NULL)</p><p> {</p><p> return false;</p><p> }</p><p> else</p><p> {</p><p> $user_name = parent::filter($user_name);</p><p> $password = parent::password($password);</p><p> // $staff_pin = parent::filter($_POST['pin']);</p><p> $find_user = mysql_query("SELECT * FROM `users` WHERE `username` = '".$user_name."' AND `password` = '".$password."' LIMIT 1");</p><p> if(mysql_num_rows($find_user) == 0)</p><p> {</p><p> $this->log_Login($user_name,FALSE);</p><p> return false;</p><p> }</p><p> else</p><p> {</p><p> $user_name = parent::user_Data($user_name,'username');</p><p> $rank_id = parent::user_Data($user_name,'rank');</p><p> $allow_access = mysql_query("SELECT * FROM `housekeeping_permissions` WHERE `rank_id` = '".$rank_id."' LIMIT 1");</p><p> $allow_access = mysql_fetch_array($allow_access);</p><p> if($allow_access['hk.login'] == 1)</p><p> {</p><p> $this->log_Login($user_name,TRUE);</p><p> if($this->create_Session($user_name))</p><p> {</p><p> return true;</p><p> }</p><p> else</p><p> {</p><p> return false;</p><p> }</p><p> }</p><p> else</p><p> {</p><p> $this->log_Login($user_name,FALSE);</p><p> return false;</p><p> }</p><p> }</p><p> }</p><p> }</p><p>[/PHP] </p><p>password function (parent:<img src="/styles/default/xenforo/smilies/emojione/tongue.png" class="smilie" loading="lazy" alt=":p" title="Stick Out Tongue :p" data-shortname=":p" />assword($password))</p><p>[PHP]</p><p>public function password($data)</p><p> {</p><p> if($data == NULL)</p><p> {</p><p> return $this->error_Handler('Validate Data','The given data could not be validated.');</p><p> }</p><p> else</p><p> {</p><p> return md5($data);</p><p> }</p><p> }</p><p>[/PHP]</p><p>I want to change this to BCRYPT. I tried to change everything but didn't worked. Could you help me? Thanks.</p></blockquote><p></p>
[QUOTE="Berk, post: 415715, member: 63611"] Hello everyone. This might be a habbo related but however. Sorry if posted in wrong section. I'm using Micro Edit ([URL]https://devbest.com/threads/micro-hotel-release-cabbo-edit.80306/[/URL]) by [USER=66193]@JynX[/USER] and I use bcrypt on my revcms. For HK login, it uses md5 and I want to use bcrypt. My RevCMS bcrypt function [PHP] public function hashed($string) { return password_hash($string, PASSWORD_BCRYPT, array('cost' => 12)); } [/PHP] Login function for HK: [PHP] public function authenticate($user_name,$password) { if($user_name == NULL || $password == NULL) { return false; } else { $user_name = parent::filter($user_name); $password = parent::password($password); // $staff_pin = parent::filter($_POST['pin']); $find_user = mysql_query("SELECT * FROM `users` WHERE `username` = '".$user_name."' AND `password` = '".$password."' LIMIT 1"); if(mysql_num_rows($find_user) == 0) { $this->log_Login($user_name,FALSE); return false; } else { $user_name = parent::user_Data($user_name,'username'); $rank_id = parent::user_Data($user_name,'rank'); $allow_access = mysql_query("SELECT * FROM `housekeeping_permissions` WHERE `rank_id` = '".$rank_id."' LIMIT 1"); $allow_access = mysql_fetch_array($allow_access); if($allow_access['hk.login'] == 1) { $this->log_Login($user_name,TRUE); if($this->create_Session($user_name)) { return true; } else { return false; } } else { $this->log_Login($user_name,FALSE); return false; } } } } [/PHP] password function (parent::password($password)) [PHP] public function password($data) { if($data == NULL) { return $this->error_Handler('Validate Data','The given data could not be validated.'); } else { return md5($data); } } [/PHP] I want to change this to BCRYPT. I tried to change everything but didn't worked. Could you help me? Thanks. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
PHP Bcrypt Hashing and Verifying Passwords.
Top