1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| <?php
$connect = ldap_connect($ldap_host, $ldap_port)
or die( "Impossible de se connecter au serveur LDAP $ldap_host" );
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
if ($connect){
$bind = ldap_bind($connect, $ldap_user, $ldap_pass)
or die(">>Impossible de se connecter sur $ldap_host<<");
$filtre_unix = "uid=$utilisateur";
$restriction_unix = array( "groupeunix");
$search_unix = ldap_search($connect,"ou=annuaire,dc=ifremer,dc=fr" ,$filtre_unix,$restriction_unix);
$resultat_unix = ldap_get_entries($connect, $search_unix);
for ($i=0; $i<$resultat_unix["count"]; $i++){
$group_unix = $resultat_unix[$i]["groupeunix"][0];
}
// Recherche de toutes les fiches appartenant à l'utilisateur : fiche partagée et fiche personelle
$filtre = "(|(uid=$utilisateur)(groupeunix=$group_unix))";
$search = ldap_search($connect,"ou=carnets,dc=ifremer,dc=fr" ,$filtre);
$resultat = ldap_get_entries($connect, $search);
echo "<table border='0' valign='center' cellpadding='0' cellspacing='0' height='100%' width='100%' >
<form name='modif_fiche' method='post' action='' onsubmit='return testsubmit()'>
<tr><td align='center'>
<table width='1200' bgcolor='#FFFFFF' border='2' cellpadding='2' cellspacing='2' bordercolor='#FF9900' frame='void'>
<tr><td>
<table width='400%' border='0' cellpadding='6' cellspacing=6'>
<tr><td align='center' colspan='0' bgcolor='#FF9900'>
<font color='black' face='Arial,Helvetica' size='6'>
<b>Liste des fiches de l'utilisateur : <i>$utilisateur</i></b>
</font>
</td></tr>
</table>
<table width='100%' border='1' cellpadding='1' cellspacing='1' bordercolor='#FF9900' frame='hsides'>
<font color='black' face='Courier New, Courier, mono' size='4'>
<tr bgcolor='#FFCC33'><th>Prénom Nom </th>
<th>E-mail</th>
<th>Type de fiche</th>
<th></th>
<th>Modifier</th>
<th>Supprimer</th>
</tr></font>";
for ($i=0; $i<$resultat["count"]; $i++){
$groups_unix = $resultat[$i]["groupeunix"][0];
$nom = $resultat[$i]["sn"][0];
$prenom = $resultat[$i]["givenname"][0];
$mail = $resultat[$i]["mail"][0];
$tel = $resultat[$i]["telephonenumber"][0];
$adresse = $resultat[$i]["street"][0];
$entreprise = $resultat[$i]["company"][0];
$codepostal = $resultat[$i]["postalcode"][0];
$ville = $resultat[$i]["l"][0];
$dn = $resultat[$i]["dn"];
$cn = $resultat[$i]["cn"][0];
$uid_perso = $resultat[$i]["uid"][0];
if ($groups_unix !=""){
$droit_fiche = "Grp";}
else $droit_fiche = "Perso";
// Caractères à afficher si les données ne sont pas renseignées
if ($nom == ""){
$nom = "...";}
if ($prenom == ""){
$prenom = "...";}
if ($mail == ""){
$mail = "...";}
if ($tel == ""){
$tel = "...";}
if ($adresse == ""){
$adresse = "...";}
if ($entreprise == ""){
$entreprise = "...";}
if ($codepostal == ""){
$codepostal = "...";}
if ($ville == ""){
$ville = "...";}
// Remplissage du tableau avec les informations obtenues
if ($droit_fiche == "Perso"){
echo " <tr bgcolor='#FFFFCC'>";}
else if ($droit_fiche == "Grp"){
echo " <tr bgcolor='#99CCCC'>";}
echo " <th>$prenom $nom </th>
<th><a href ='mailto:$mail'>$mail</a></th>
<th>$droit_fiche</th>
<input name='prenom' value='$prenom' type='hidden'/>
<input name='nom' value='$nom' type='hidden'/>
<input name='mail' value='$mail' type='hidden'/>
<input name='tel' value='$tel' type='hidden'/>
<input name='entreprise' value='$entreprise' type='hidden'/>
<input name='adresse' value='$adresse' type='hidden'/>
<input name='codepostal' value='$codepostal' type='hidden'/>
<input name='ville' value='$ville' type='hidden'/>
<input name='droit_fiche' value='$droit_fiche' type='hidden'/>
<input name='dn' value='$dn' type='hidden'/>
<input name='cn' value='$cn' type='hidden'/>
<input name='uid' value='$uid_perso' type='hidden'/>
<input name='utilisateur' value='$utilisateur' type='hidden'/>
<input name='groupeunix' value='$groups_unix' type='hidden'/>
<th></th>
<th><input type='button' value='Modifier' onClick=gopage('modifi.php')></th>
<th><input type='button' value='Supprimer' onClick=gopage('suppr.php')></th>
</form></tr>";
}
echo "</table></table>";
}
// Fermeture de la connexion
ldap_close($connect);
?> |
Partager