login.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php // $Id: login.php 22201 2009-07-17 19:57:03Z cfasanando $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Roan Embrechts
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ==============================================================================
  22. * Users trying to login, who already exist in the Dokeos database
  23. * and have ldap as authentication type, get verified here.
  24. *
  25. * @author Roan Embrechts
  26. * @package dokeos.auth.ldap
  27. ==============================================================================
  28. */
  29. /*
  30. An external authentification module
  31. needs to set
  32. - $loginFailed
  33. - $uidReset
  34. - $_user['user_id']
  35. - register the $_user['user_id'] in the session
  36. As the LDAP code shows, this is not as difficult as you might think.
  37. */
  38. /*
  39. ===============================================
  40. LDAP authentification module
  41. this calls the loginWithLdap function
  42. from the LDAP library, and sets a few
  43. variables based on the result.
  44. ===============================================
  45. */
  46. //require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded
  47. require_once('authldap.php');
  48. $loginLdapSucces = ldap_login($login, $password);
  49. if ($loginLdapSucces)
  50. {
  51. $loginFailed = false;
  52. $uidReset = true;
  53. $_user['user_id'] = $uData['user_id'];
  54. api_session_register('_uid');
  55. // Jand: copied from event_login in events.lib.php to enable login statistics:
  56. event_login();
  57. }
  58. else
  59. {
  60. $loginFailed = true;
  61. unset($_user['user_id']);
  62. $uidReset = false;
  63. }
  64. ?>