28 require_once(
'AWLUtilities.php');
29 require_once(
'DataUpdate.php');
37 function auth_other_awl( $username, $password ) {
40 $authconn = pg_Connect($c->authenticate_hook[
'config'][
'connection']);
43 <html><head><title>Database Connection Failure</title></head><body>
44 <h1>Database Error</h1>
45 <h3>Could not connect to PostgreSQL database</h3>
52 if ( isset($c->authenticate_hook[
'config'][
'columns']) )
53 $cols = $c->authenticate_hook[
'config'][
'columns'];
57 if ( isset($c->authenticate_hook[
'config'][
'where']) )
58 $andwhere =
" AND ".$c->authenticate_hook[
'config'][
'where'];
62 $qry =
new AwlQuery(
"SELECT $cols FROM usr WHERE lower(username) = text(?) $andwhere", strtolower($username) );
63 $qry->SetConnection($authconn);
64 if ( $qry->Exec(
'Login',__LINE,__FILE__) && $qry->rows() == 1 ) {
66 if ( session_validate_password( $password, $usr->password ) ) {
68 $qry =
new AwlQuery(
"SELECT * FROM usr WHERE user_no = $usr->user_no;" );
69 if ( $qry->Exec(
'Login',__LINE,__FILE__) && $qry->rows() == 1 )
74 $qry =
new AwlQuery( sql_from_object( $usr, $type,
'usr',
"WHERE user_no=$usr->user_no" ) );
75 $qry->Exec(
'Login',__LINE__,__FILE__);
80 if ( isset($usr->active) && $usr->active ==
'f' )
return false;
97 function auth_external( $username, $password ) {
100 $qry =
new AwlQuery(
"SELECT * FROM usr WHERE active AND lower(username) = text(?) ", strtolower($username) );
101 if ( $qry->Exec(
'Login',__LINE__,__FILE__) && $qry->rows() == 1 ) {
102 $usr = $qry->Fetch();