Getting password from db or already a var?

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
User avatar
rockethobbit
Registered User
Posts: 13
Joined: Mon Sep 05, 2005 1:23 am
Location: Phoenix, AZ
Contact:

Getting password from db or already a var?

Post by rockethobbit »

I am needing to get the password from the phpbb db for use with logging into a teamspeak server. I wanted to know if, after the user logs in, phpbb keeps the password as a variable in the session information or if it dumps it?

If it dumps it, which I am betting it does, I would have to then write a sql query to get it again. I have already started testing that, but I am getting a result that isn't correct:

Code: Select all

$sql = "SELECT user_password FROM phpbb_users WHERE username = '$nickname'";
$result = $db->sql_query($sql);
$password = $result;
The result I am getting is "result id #21"

ScionCrow
Registered User
Posts: 3621
Joined: Fri Feb 13, 2004 6:59 am
Location: Darkness

Post by ScionCrow »

Passwords are MD5 hashed. There is no way to "unhash" the password at all. So, your basically out of luck..
No longer supporting phpBB. PM or email me regarding support and you will be ignored. I'm fully done with phpBB and everything.

User avatar
rockethobbit
Registered User
Posts: 13
Joined: Mon Sep 05, 2005 1:23 am
Location: Phoenix, AZ
Contact:

Post by rockethobbit »

That is ok if they are hashed. I just need the hash string in a var like $password. I am just comparing the two hashed versions to see if they are equal. Basically the team speak server DB user/pass info is a mirror of the phpbb one.

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Post by D¡cky »

Try this

Code: Select all

		$sql = "SELECT user_password FROM phpbb_users WHERE username = '$nickname'"; 
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Error in obtaining user password', '', __LINE__, __FILE__, $sql);
		}
		$row = $db->sql_fetchrow($result);
		$password = $row['user_password'];
Have you hugged someone today?

User avatar
rockethobbit
Registered User
Posts: 13
Joined: Mon Sep 05, 2005 1:23 am
Location: Phoenix, AZ
Contact:

Post by rockethobbit »

Thank you, that did the trick. I appreciate it.

afterlife_69
I've Been Banned!
Posts: 630
Joined: Tue Nov 30, 2004 10:35 am

Post by afterlife_69 »

they are already set. $userdata['user_password']

Post Reply

Return to “[2.0.x] MOD Writers Discussion”