Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/rgiit/rgiit/x/html/
Upload File :
Current File : /var/www/html/mmishra/indem/rgiit/rgiit/x/html/backupOfsearch

<html>
<head>
<title>
User Information
</title>
</head>
<body bgcolor=#DDC899>
<h1>Search for person</h1>
<h3>Choose any one option</h3>
<p>

</p>
<form action=index1.php method=post>
<table border=0>
<tr>	<td><input type=radio name=stype value=1>Surname
	<td><input type=text name=surname size=15>
	<td><input type=radio name=stype value=2>Username
	<td><input type=text name=login size=15>
<tr>    <td><input type=radio name=stype value=3>Email address
	<td><input type=text name=mail size=15>
        <td><input type=radio name=stype value=4>UserId
	<td><input type=text name=uid size=15> 
<tr>
        <td><input type=radio name=stype value=5>HomeCity
	<td><input type=text name=uid size=15> 
        <td><input type=radio name=stype value=6>Givenname
	<td><input type=text name=Gn size=15> 
<tr>
<td><td><td><td align="right"><input type=submit value="Search">
</table>

</form></br></br>
<h2>Search Result</h2>
<?
	$ldapserver=ldap_connect("rgiita.ac.in");
	if(!$ldapserver)
	{
		print "System Error";
		exit(0);
	}
	$bind = ldap_bind($ldapserver,"dc=rgiita,dc=ac,dc=in","sec");
	if(!bind)
	{
		print "System Error";
		exit(0);
	}
	$base_dn = "DC=rgiita,DC=ac,DC=in";
	if($_POST['stype'] == 1)	/* surname look up */
	{
		$filter = "sn=" . trim($_POST['surname']);
	}
	else if($_POST['stype'] == 2)
	{
		$filter = "cn=" . trim($_POST['login']);
	}
	else if($_POST['stype'] == 3)
	{
		$mail = trim($_POST['mail']);
		if(!strstr($mail,"@"))
		{
			$mail .= "@rgiita.ac.in";
		}
		$filter = "mail=" . $mail;
	}
        else if($_POST['stype'] == 4)
	{
		$filter = "uid=" . trim($_POST['uid']);
	}
        else if($_POST['stype'] == 5)
	{
		$filter = "permanentaddress=" . trim($_POST['uid']);
	}
        else if($_POST['stype'] == 6)
	{
		$filter = "givenName=" . trim($_POST['Nickname']);
	}

	$inforequired = array(
			"permanentaddress",
			"uid",
			"mail",
			"givenName",
			"sn",
			"cn");

	$result = ldap_search($ldapserver,$base_dn,$filter,$inforequired);
	$info = ldap_get_entries($ldapserver,$result);
        echo $info[0]["ginenName"][0];
	if($info["count"] == 0)
	{
		print "<p>Sorry No information available";
	}
	else
	{
		print "<table border=5><tr>"
			. "<th>Nickname"
			. "<th>Username"
			. "<th>Surname"
			. "<th>UserId"
			. "<th>MailId"
			. "<th>PermanentAddress";
		for($i=0;$i<$info["count"];$i++)
		{
			//$row[$i] = "<tr>" 
			// . "<td>" . $info[$i]["nickName"][0]
			// . "<td>" . $info[$i]["sn"][0]
			 //. "<td>" . $info[$i]["department"][0]
			 //. "<td>" . $info[$i]["employeetype"][0]
			 //. "<td>" . $info[$i]["mail"][0]
			 //. "<td>" . $info[$i]["cn"][0];

		       $row[$i] = "<tr>" 
			 . "<td>" . $info[$i]["givenName"][0]
			 . "<td>" . $info[$i]["cn"][0]
			 . "<td>" . $info[$i]["sn"][0]
			 . "<td>" . $info[$i]["uid"][0]
			 . "<td>" . $info[$i]["mail"][0]
			 . "<td>" . $info[$i]["parmanentaddress"][0];



               }
		sort($row);
		for($i=0;$i<$info["count"];$i++) print $row[$i] . "\n";
		print "</table>";
	}
	
?>

</body>
</html>