diff --git a/user_login.php b/user_login.php index f62216f..cfa09bb 100644 --- a/user_login.php +++ b/user_login.php @@ -26,7 +26,7 @@ require_once("common.inc.php"); require_once("user.inc.php"); - function try_login($user, $pass) + function try_login($user, $pass, $type=null) { /* Ensure sanity of inputs, user should be an email address, but it's stored * in the username field */ @@ -40,10 +40,12 @@ //$x = user_valid_password($pass); if(!strlen($pass)) return false; + if($type) $typequery=" AND types LIKE '%$type%'"; else $typequery=""; $q = mysql_query("SELECT id,username,password FROM users WHERE username='$user' + $typequery AND deleted='no'"); echo mysql_error(); if(mysql_num_rows($q) != 1) return false; @@ -101,7 +103,7 @@ { if($_POST['pass'] && $_POST['user']) { - $id = try_login($_POST['user'], $_POST['pass']); + $id = try_login($_POST['user'], $_POST['pass'],$type); if($id == false) { header("location: user_login.php?type=$type¬ice=login_failed"); exit;