This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-07-19 12:16:51

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

How to check passwords against a phpBB3 database

I (once again) have figured it out.  As many of you know, phpBB3's hash function returns differently for the same result every time, however, there is a way to check passwords.

Code:

<?php
mysql_connect("localhost", "user", "password");
mysql_select_db("database");
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
$username = mysql_real_escape_string($_GET["username"]);
$password = $_GET["password"];
$q = mysql_query("SELECT * FROM `phpbb_users` WHERE `username` = '{$username}' LIMIT 1") or die("Error User 1: ".mysql_error());
$passhash = mysql_result($q, 0, "user_password");
unset($q);
if (phpbb_check_hash($password, $passhash)) {
  $usr_q = mysql_query("SELECT * FROM `phpbb_users` WHERE `username` = '{$username}'") or die("Error User 2: ".mysql_error());
  $usr = mysql_fetch_assoc($usr_q);
  $grp_id = $usr["group_id"];
  $grp_q = mysql_query("SELECT * FROM `phpbb_groups` WHERE `group_id` = {$grp_id}") or die("Error Group: ".mysql_error());
  $grp = mysql_fetch_assoc($grp_q);
  $grp_name = $grp["group_name"];
  die($grp_name);
}
else {
  die("false");
}
?>

Hope this helps!  big_smile


http://i.imgur.com/BAEgGDL.png

Offline

 

#2 2012-07-19 13:13:56

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: How to check passwords against a phpBB3 database

You inspired me to write the FluxBB version of this guide.
Thanks.  smile


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#3 2012-07-19 20:02:44

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: How to check passwords against a phpBB3 database

jvvg wrote:

You inspired me to write the FluxBB version of this guide.
Thanks.  smile

Mhm... just like I inspired you to do FluxHost.


http://i.imgur.com/BAEgGDL.png

Offline

 

#4 2012-07-21 14:55:20

Pitusky12
Scratcher
Registered: 2011-09-21
Posts: 500+

Re: How to check passwords against a phpBB3 database

Will this work in Safari? If so,how would i make it work in safari?


Scratch 2.0 Beta Tester  wink

Offline

 

#5 2012-07-21 15:26:55

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: How to check passwords against a phpBB3 database

Pitusky12 wrote:

Will this work in Safari? If so,how would i make it work in safari?

It's PHP.  It works with all browsers.


http://i.imgur.com/BAEgGDL.png

Offline

 

Board footer