DBAuthenticator.inc
1.05 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require_once("$default->owl_fs_root/lib/authentication/Authenticator.inc");
/**
* $Id$
*
* Perform authentication tasks against the database.
*
* @version $Revision$
* @author <a href="mailto:michael@jamwarehouse.com>Michael Joseph</a>, Jam Warehouse (Pty) Ltd, South Africa
* @package dmslib
*/
class DBAuthenticator extends Authenticator {
/**
* Checks the user's password against the database
*
* @param $userName
* the name of the user to check
* @param $password
* the password to check
* @return true if the password is correct, else false
*/
function checkPassword($userName, $password) {
global $default;
$sql = new Owl_DB;
$query = "select * from $default->owl_users_table where username = '$userName' and password = '" . md5($password) . "'";
$sql->query($query);
$numrows = $sql->num_rows($sql);
if ($numrows == "1") {
return true;
} else {
return false;
}
}
}
?>