aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/auth/auth_db.php
blob: 0c9d0adf3ea1a69f9f654fbd8b7ab4c0893f9566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

//
// Authentication plug-ins is largely down to
// Sergey Kanareykin, our thanks to him. 
//
function login_db(&$username, &$password)
{
	global $db, $board_config;

	$sql = "SELECT user_id, username, user_password, user_email, user_active  
		FROM " . USERS_TABLE . "
		WHERE username = '" . str_replace("\'", "''", $username) . "'";
	$result = $db->sql_query($sql);

	if ( $row = $db->sql_fetchrow($result) )
	{
		$db->sql_freeresult($result);

		if ( md5($password) == $row['user_password'] && $row['user_active'] )
		{
			return $row;
		}
	}

	return false;
}

?>