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
|
$res = ldap_get_entries($connect, $result);
for ($i=0; $i < $res["count"]; $i++) {
$result2=ldap_list($connect, "OU=".$res[$i]["ou"][0].",OU=PROFS,".$base_dnref, "(cn=*)");
$res2 = ldap_get_entries($connect, $result2);
for($j=0;$j<$res2["count"];$j++){
$NOM = $res2[$j]["cn"][0];
$insert=$db->query("INSERT INTO PROFESSEURS(NOM) VALUES ('".$NOM."')");
$insert->fetch();
}
}
$result=ldap_list($connect, "OU=ELEVES,".$base_dnref, "(ou=*)");
$res = ldap_get_entries($connect, $result);
for ($z=0; $z < $res["count"]; $z++) {
$NUMERO = strval($res[$z]["ou"][0]);
$insert=$db->query("INSERT INTO CLASSE(NUMERO) VALUES ('".$NUMERO."')");
$insert->fetch();
$result2=ldap_list($connect, "OU=".$res[$z]["ou"][0].",OU=ELEVES,".$base_dnref, "(cn=*)");
$res2 = ldap_get_entries($connect, $result2);
for($y=0;$y<$res2["count"];$y++){
$NOM = $res2[$y]["cn"][0];
$insert=$db->query("INSERT INTO ELEVE(NOM) VALUES ('".$res2[$y]["cn"][0]."')");
$insert->fetch();
}
} |
Partager