From a8dcfa1769193bc365263e260a2bc93b83dfd498 Mon Sep 17 00:00:00 2001 From: Tom Lake <tswsl1989@sucs.org> Date: Mon, 16 Sep 2013 16:00:51 +0000 Subject: [PATCH] Update LDAP queries against university DB The old server appears to have disappeared, so the query has been updated to make authenticated requests against the new server. --- lib/validationData.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/validationData.php b/lib/validationData.php index 6221e08..97f5efd 100644 --- a/lib/validationData.php +++ b/lib/validationData.php @@ -1,12 +1,16 @@ <? // lookup real names from sid's useing campus ldap function lookupSID($sid) { - $ds=ldap_connect("nds-stud.swan.ac.uk"); - $sr=ldap_search($ds, "ou=Students,o=uws", "cn=".$sid); - $info = ldap_get_entries($ds, $sr); - ldap_unbind($ds); - return ucwords(strtolower($info[0]['givenname'][0]." ".$info[0]['sn'][0])); + $ds=ldap_connect("ccs-suld1.swan.ac.uk"); + $ldappw = file_get_contents("/etc/unildap.secret"); + $ldappw = trim($ldappw); + ldap_bind($ds, "cn=SUCS-BIND,ou=ServiceAccount,o=SWANUNI",$ldappw ); + $sr=ldap_search($ds, "ou=students,ou=Swansea,o=swanuni", "uid=".$sid); + $info = ldap_get_entries($ds, $sr); + ldap_unbind($ds); + return ucwords(strtolower($info[0]['givenname'][0]." ".$info[0]['sn'][0])); } + // lookup addresses from postcodes useing the univeritys website function lookup_postcode($postcode = "") { -- GitLab