Jiri Zaloudek
Jiri Zaloudek

Reputation: 380

how to get same password hash(md5()) as phpbb3

i have on my page phpbb3 and now I am also starting some advertisementing... So basicly want to have a form where i fill a username and password, then I want the script to hash and md5 the password (the same way as my phpbb3 does) and compare the password and username with table forum_users.... whatever I do I just cant make that works...

<?php

define('IN_PHPBB', true);
include ("../Forum/common.php");
include ("../Forum/includes/functions.php");


$pass = "password";
$hash = phpbb_hash($pass);

echo $hash;

?>

it doesnt do anything actually

Upvotes: 0

Views: 8705

Answers (2)

DigiOz Multimedia
DigiOz Multimedia

Reputation: 1176

If your goal is to authenticate the username and password that your user is providing to you against what is in the database then this is all you should need:

<?php
/**
*
* Login script for phpBB using username/password
* Used for website authentication
*
*/
define('IN_PHPBB', true);
$phpbb_root_path = dirname(__FILE__) . '/./';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include("common.php");
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$username = request_var('username', '');
$password = request_var('password', '');

if(isset($username) && isset($password))
{
  $auth->login($username, $password, true);
}
?>

But if you still wish to figure out the PHPBB password encryption hash, it is no longer MD5 in version 3.0 or higher and is a custom hash. Take a look at this thread:

http://www.phpbb.com/community/viewtopic.php?f=71&t=585387

I hope this helps.

Pete

Upvotes: 1

Alex Emilov
Alex Emilov

Reputation: 1271

Try with the API: http://wiki.phpbb.com/Function.phpbb_check_hash

Upvotes: 1

Related Questions