Changeset 8173
- Timestamp:
- Dec 17, 2010, 3:46:17 PM (13 years ago)
- Location:
- extensions/LCAS/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/LCAS/trunk/include/functions.inc.php
r8166 r8173 853 853 854 854 855 /**856 * Function called from main.inc.php857 * Checks if username already exists in database according of case sensitivity858 *859 * @param : Username860 *861 * @return : Bool862 */863 function CaseSensitiveUsername($username)864 {865 global $conf;866 867 if (isset($username))868 {869 $query = "870 SELECT ".$conf['user_fields']['username']."871 FROM ".USERS_TABLE."872 WHERE LOWER(".stripslashes($conf['user_fields']['username']).") = '".strtolower($username)."'873 ;";874 $users = mysql_num_rows(pwg_query($query));875 if ($users > 0)876 {877 return true;878 }879 else880 {881 return false;882 }883 }884 }885 886 887 855 // DebugLog function 888 function DebugLog($var1, $var2, $var3, $var4 )856 function DebugLog($var1, $var2, $var3, $var4, $var5) 889 857 { 890 858 $fo=fopen (LCAS_PATH.'admin/debuglog.txt','a') ; … … 895 863 fwrite($fo, "\n" . $var3 . "\r\n") ; 896 864 fwrite($fo, "\n" . $var4 . "\r\n") ; 865 fwrite($fo, "\n" . $var5 . "\r\n") ; 897 866 fclose($fo) ; 898 867 } -
extensions/LCAS/trunk/main.inc.php
r8166 r8173 55 55 56 56 /* Username non case sensitive */ 57 if (isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true' and CaseSensitiveUsername($_POST['username'])) 58 { 59 60 /* ********************** */ 61 DebugLog($var1,$var2,$var3,$var4); 62 /* ********************** */ 63 // pending code for test 64 /*add_event_handler('login_failure', 'LCAS_action'); 57 //if (isset($conf_LCAS[1]) and $conf_LCAS[1] == 'false') 58 //{ 59 // This does not work - Unable to invalidate try_log_user() function 60 add_event_handler('login_success', 'LCAS_action'); 61 add_event_handler('login_failure', 'LCAS_action'); 65 62 66 63 function LCAS_action() 67 64 { 68 return($lang['login_error'] = l10n('login_error')); 69 }*/ 65 global $conf; 66 // retrieving the encrypted password of the login submitted 67 $query = ' 68 SELECT '.$conf['user_fields']['id'].' AS id, 69 '.$conf['user_fields']['password'].' AS password 70 FROM '.USERS_TABLE.' 71 WHERE LOWER('.$conf['user_fields']['username'].') = \''.pwg_db_real_escape_string(strtolower($_POST['username'])).'\' 72 ;'; 73 $row = pwg_db_fetch_assoc(pwg_query($query)); 74 if ($row['password'] == $conf['pass_convert']($_POST['password'])) 75 { 76 //log_user($row['id'], $remember_me); 77 //trigger_action('login_success', stripslashes($_POST['username'])); 78 //return true; 79 $var1 = 'Typed login : '.$_POST['username']; 80 $var2 = 'Typed login lowercase : '.strtolower($_POST['username']); 81 $var3 = 'Typed pwd hash : '.$conf['pass_convert'] ($_POST['password']); 82 $var4 = 'Pwd hash in DB : '.$row['password']; 83 $var5 = 'User ID in DB : '.$row['id']; 84 /* ********************** */ 85 DebugLog($var1,$var2,$var3,$var4,$var5); 86 /* ********************** */ 87 70 88 } 89 //trigger_action('login_failure', stripslashes($_POST['username'])); 90 return false; 91 } 92 //} 71 93 } 72 94 ?>
Note: See TracChangeset
for help on using the changeset viewer.