| Current Path : /var/www/html/ |
| Current File : /var/www/html/index.php |
<?php
require("header.inc");
//require("fucntions.inc");
$ds = ldap_connect("172.31.1.42") or die("Could not connect");
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ds) {
//$ldapsearch = ldap_list($ds,"ou=Faculty,ou=Employee,dc=iiita,dc=ac,dc=in","(&(uid=*)(objectClass=posixAccount))",array('gecos','labeleduri','mail'));
$sd = ldap_search($ds,"ou=faculty,ou=employee,dc=iiita,dc=ac,dc=in","(&(uid=*)(objectClass=posixAccount))");
ldap_sort($ds,$sd,"uid");
//asort($sd);
$info1 = ldap_get_entries($ds, $sd);
echo "<table width='100%'>
<tr><th>No.</th><th>URL</th><th>Name</th><th>Email</th></tr>";
//asort($info1);
foreach ($info1 as $info) {
//$i++;
echo "<tr><td>$i</td>
<td nowrap><a href='" . $info["labeleduri"][0] . "'>" . $info["labeleduri"][0] . "</a></td>
<td>" . $info["gecos"][0] . "</td>
<td><a href='mailto:" . $info["mail"][0] . "'>" . str_replace("@","{at}",$info["mail"][0]) . "</a></td>
</tr>";
$i++;
}
echo "</table>";
}
ldap_close($ds);
counter();
function counter() {
$file = "counter.inc";
if (!file_exists($file)) {
touch ($file);
$count=0;
} else {
include "counter.inc";
$count++;
}
$str = '<? $count='.$count.'; echo "<font size=-2>Counter: $count</font>";?>';
$handle = fopen ($file, 'r+');
fwrite ($handle, $str);
fclose($handle);
}
?>