function login_database($l, $p) { $sql = "SELECT ident\n from " . tbl_prefix . "users u LEFT JOIN " . db_gw_name . ".phpgw_accounts a on a.account_lid=u.username \n WHERE u.username = '******'\n AND a.account_pwd= '{$p}'\n AND u.active = 'yes'\n AND u.user_type = 'person'"; $result = db_query($sql); if ($row = $result[0]) { $ok = init_session_database($row->ident); } // Set Persistent Cookie if ($_POST['remember']) { remember_login($row->ident); } return $ok; }
/** * Authentication Function * @param string $username * @param string $password plaintext password * @return boolean */ function authenticate_account($username, $password) { global $CFG, $USER; if (empty($CFG->auth)) { $CFG->auth = 'internal'; } if (!file_exists($CFG->dirroot . 'auth/' . $CFG->auth . '/lib.php')) { $CFG->auth = 'internal'; } require_once $CFG->dirroot . 'auth/' . $CFG->auth . '/lib.php'; // Module authentication function $function = $CFG->auth . '_authenticate_user_login'; // Does the function exist if (!function_exists($function)) { print 'Error: function ' . $function . ' not found in auth/' . $CFG->auth . '/lib.php'; return false; } if (!($user = $function($username, $password))) { return false; } $ok = true; if (user_flag_get("banned", $user->ident)) { // this needs to change. $ok = false; $user = false; $USER = false; global $messages; $messages[] = __gettext("You have been banned from the system!"); return false; } // Set Persistent Cookie $rememberme = optional_param('remember', 0); if (!empty($rememberme)) { remember_login($user->ident); } $USER = init_user_var($user); return $ok; }
function authenticate_account($username, $password) { global $CFG, $USER; if (empty($CFG->auth)) { $CFG->auth = 'internal'; } if (!file_exists($CFG->dirroot . 'auth/' . $CFG->auth . '/lib.php')) { $CFG->auth = 'internal'; } require_once $CFG->dirroot . 'auth/' . $CFG->auth . '/lib.php'; if (!($user = authenticate_user_login($username, $password))) { return false; } $ok = true; if (run("users:flags:get", array("banned", $user->ident))) { // this needs to change. $ok = false; $user = false; $USER = false; global $messages; $messages[] = gettext("You have been banned from the system!"); return false; } // Set Persistent Cookie $rememberme = optional_param('remember', 0); if (!empty($rememberme)) { remember_login($user->ident); } $USER = init_user_var($user); return $ok; }