Conditions | 6 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public static function check_conditions($user) |
||
17 | { |
||
18 | $file = api_get_path(SYS_CODE_PATH).'auth/conditional_login/conditional_login.php'; |
||
19 | if (file_exists($file)) { |
||
20 | include_once $file; |
||
21 | if (isset($login_conditions)) { |
||
|
|||
22 | foreach ($login_conditions as $condition) { |
||
23 | //If condition fails we redirect to the URL defined by the condition |
||
24 | if (isset($condition['conditional_function'])) { |
||
25 | $function = $condition['conditional_function']; |
||
26 | $result = $function($user); |
||
27 | if (false == $result) { |
||
28 | $_SESSION['conditional_login']['uid'] = $user['user_id']; |
||
29 | $_SESSION['conditional_login']['can_login'] = false; |
||
30 | header("Location: ".$condition['url']); |
||
31 | exit; |
||
32 | } |
||
45 |