Last change
on this file since 383 was
40,
checked in by g7moreau, 17 years ago
|
- Add web-klask project from Kevin Reverchon
|
File size:
1.1 KB
|
Line | |
---|
1 | <? |
---|
2 | |
---|
3 | function auth_ldap ($idLogin, $passwd) { |
---|
4 | |
---|
5 | |
---|
6 | if ($idLogin != "" && $passwd != "") { |
---|
7 | $ds=@ldap_connect($GLOBALS['hostLDAP'], "389"); |
---|
8 | $r = @ldap_search( $ds,$GLOBALS['dnUser'], 'uid=' . $idLogin); |
---|
9 | if ($r) { |
---|
10 | $result = @ldap_get_entries( $ds, $r); |
---|
11 | //echo $result[0]['dn'] ; |
---|
12 | if ($result[0]) { |
---|
13 | if (@ldap_bind( $ds, $result[0]['dn'], $passwd) ) { |
---|
14 | //echo $result[0]; |
---|
15 | return 1; |
---|
16 | }else{ |
---|
17 | return "AUTHENTIFICATION: [FAILED]" ; |
---|
18 | } |
---|
19 | }else{ |
---|
20 | return "AUTHENTIFICATION: [FAILED]"; |
---|
21 | } |
---|
22 | }else{ |
---|
23 | return "AUTHENTIFICATION: [FAILED]"; |
---|
24 | } |
---|
25 | }else{ |
---|
26 | return "Les champs Login et mot de passe sont obligatoires"; |
---|
27 | } |
---|
28 | |
---|
29 | |
---|
30 | } |
---|
31 | |
---|
32 | function getServiceLDAP ($idLogin) { |
---|
33 | |
---|
34 | |
---|
35 | if ($idLogin != "" ) { |
---|
36 | |
---|
37 | $ds=@ldap_connect($GLOBALS['hostLDAP'], "389"); |
---|
38 | $r = @ldap_search( $ds,$GLOBALS['dnUser'], 'uid=' . $idLogin); |
---|
39 | |
---|
40 | if ($r) { |
---|
41 | $result = @ldap_get_entries( $ds, $r); |
---|
42 | //echo $result[0]['dn'] ; |
---|
43 | if ($result[0]) { |
---|
44 | return $result[0][$GLOBALS['dnService']]; |
---|
45 | } |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.