Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/
Upload File :
Current File : /var/www/html/mmishra/indem/applicants.inc

<?php
  //header("location: applicants.php?url=LIST");
?>
<html>
<head><title>INDEM Registration</title>
<link href="h.css" rel="stylesheet" type="text/css">
<style>
#alert{
  font-family: tahoma;
  color: orange;
  font-weight: bold;
  font-size: bigger;
} 
</style>
</head><body><center> 
<font size=+1>INDIAN INSTITUTE OF INFORMATION TECHNOLOGY, ALLAHABAD</font><br>
<b>INDEM Registration Form</b><br></center>
<a href='http://indem.iiita.ac.in'>Back</a><hr>
<?php
include "auth.php";
include "db.php";
include "html.php";

$submit = $_POST["submit"];
$login_id = $_POST["login_id"];
$passwd = $_POST["passwd"];
$source_ip = $_SERVER["REMOTE_ADDR"];
$dated = date("Y-m-d H:i:s");
$skill = $_POST["skill"];
$exposure = $_POST["exposure"];
$idea = $_POST["idea"];
$status = $_POST["status"];
$url = "LIST";//$_REQUEST["url"];

$ds = ldap_connect("ldap.iiita.ac.in");  // must be a valid LDAP server!
dbConnect();
if ($submit && $login_id){
  $stat = authenticate($login_id, $passwd);
  if ($stat == "FAIL"){
    echo "<b id='alert'>Invalid login...</b> Please try again.";
    regform($login_id, $passwd, $skill, $exposure, $idea, $edit);
    exit;
  }
  $z = ldap_bind($ds);
  $a = ldap_search($ds, "dc=iiita,dc=ac,dc=in", "uid=$login_id");
  $b = ldap_get_entries($ds, $a);
  $dn = $b[0]["dn"];
  //$pwd = $b[0]["userPassword"];
  $r = ldap_bind($ds, $dn, $passwd);
  if ($r){
    $q = ldap_search($ds, "dc=iiita,dc=ac,dc=in", "(&(uid=$login_id)(objectclass=posixAccount))");
    $info = ldap_get_entries($ds, $q);
    if ($info && $info["count"] > 0){
      $name = ucwords(strtoupper(strtr($info[0]["gecos"][0],"-"," ")));
      $email = $info[0]["mail"][0];
    }else{
      echo "<b id='alert'>Invalid login...</b> Please try again.";
      regform($login_id, $passwd, $skill, $exposure, $idea, $edit);
      exit;
    }
  }
  $rset = mysql_query("select * from applicants where login_id='$login_id'");
  if (mysql_num_rows($rset)){
    if ($submit == "UPDATE"){
      $skill = htmlsafe($skill);
      $exposure = htmlsafe($exposure);
      $idea = htmlsafe($idea);
      mysql_query("update applicants set source_ip='$source_ip',skill='$skill',exposure='$exposure',idea='$idea' where login_id='$login_id'");
      echo "Thanks <b id='alert'>$name!</b> Your registration updated successfully.<br>";
    }else{
      echo "Hi <b id='alert'>$name!</b> You are already registered, To update press UPDATE button.<br>";
      $edit = "TRUE";
    }
  }else{
    $skill = htmlsafe($skill);
    $exposure = htmlsafe($exposure);
    $idea = htmlsafe($idea);
    mysql_query("insert into applicants(login_id,source_ip,dated,skill,exposure,idea) values('$login_id','$source_ip','$dated', '$skill', '$exposure', '$idea')");
    echo "Thanks <b id='alert'>$name!</b> Registration submitted successfully.<br>";
  }     
}

if ($url == 'LIST'){
  echo "<b>Submitted Applications</b>
        <div align='right'><b><marquee><font color='orange'>Interview (HR) on 16.09.2007 at 5:00 PM in CC2</a></marquee></b>
        <!--<a href='" . $_SERVER["PHP_SELF"] . "?url=FORM'>Application form</a>--></div>
        <table border='1' bgcolor='white' cellspacing='0' width='100%'>
        <tr valign='top' bgcolor='#ccccff'><th width='2%'>Sr.</th><th width='13%'>Applicant</th>
        <th width='25%'>Applicant's Skillsets</th><th width='25%'>Exposure</th>
        <th width='25%'>Applicant's Ideas</th><th width='10%'>Dated</th></tr>";
  $i = 0;
  $rset = mysql_query("select * from applicants where dated like '200%' and status = 'screened' order by dated,login_id");
  if ($ds) {
    while ($o = mysql_fetch_object($rset)){
      $i++;
      $login = $o->login_id;
      echo "<tr valign='top'><td width='2%'>$i</td>";
      $z = @ldap_bind($ds);
      $a = @ldap_search($ds, "dc=iiita,dc=ac,dc=in", "uid=$login");
      $b = @ldap_get_entries($ds, $a);
      $c = $b[0]["dn"];
      $pwd = $b[0]["userPassword"];
      $r = @ldap_bind($ds, $c, $pwd);
      if ($r){
        $q = @ldap_search($ds, "dc=iiita,dc=ac,dc=in", "(&(uid=$login)(objectclass=posixAccount)(|(host=172.31.1.22)(host=\*)))");
        if (($e = @ldap_get_entries($ds, $q)) && $e["count"] > 0){
          $info = ldap_get_entries($ds, $q);
          $name = ucwords(strtolower(strtr($info[0]["gecos"][0],"-"," ")));
          $email = $info[0]["mail"][0];
          echo "<td>$name<br>($email)</td>";
        }
      }
      echo "<td>$o->skill</td><td>$o->exposure</td><td>$o->idea</td><td>$o->dated<br>($o->source_ip)</td></tr>";
    }
  }
  echo "</table>";
}else if ($edit == "TRUE"){
  echo "<b>Update Application</b>";
  regform($login_id,$passwd,$skill,$exposure,$idea,$edit);
}else{
  echo "<b>Submit Application</b>";
  regform($login_id,$passwd,$skill,$exposure,$idea,"");
}


function regform($login_id,$passwd,$skill,$exposure,$idea,$edit){
  echo"<div align='right'><a href='" . $_SERVER["PHP_SELF"] . "?url=LIST'>Submitted Applications</a></div>
       <form method='post' action='" . $_SERVER["PHP_SELF"] . "'>
       <table class=normal border='0' bgcolor='white' cellspacing='0' width='100%'>
       <tr><td>Login ID *</td><td><input type='text' name='login_id' value='$login_id'></td></tr>
       <tr><td>Password *<br>&nbsp;</td><td><input type='password' name='passwd' value='$passwd'><br>&nbsp;</td></tr>
       <tr valign='top'><td>Skillsets on system/network services (pl. be specific)<br>LDAP, DNS, FIREWALL/GATEWAY, PROXY, WEB, MAIL, NFS,<br>NAS, IP-SAN, Router, Layer-3 Switch etc.</td><td><textarea name='skill' rows='5' cols='50'>$skill</textarea></td></tr>
       <tr valign='top'><td>What you know about IIITA network (exposure)<br>Topology, Layout, Implementation, Policies etc.</td><td><textarea name='exposure' rows='5' cols='50'>$exposure</textarea></td></tr>
       <tr valign='top'><td>What you want to implement on IIITA network (idea)<br>New services, value addition in exsting services etc.</td><td><textarea name='idea' rows='5' cols='50'>$idea</textarea></td></tr>
       <tr><td></td><td><input type='submit' name='submit' value='";
  if($edit) echo "UPDATE"; else echo "SUBMIT";
  echo "'></td></tr>
       </table></form>* are mandatory<br>";
  note();
  return;
}

function note(){
  echo "<ol>
        <li>Skillsets, Exposure and Idea shuld not be left blank.</li>
        <li>Only one application will be accepted from an individual.</li>
        <li>Applications from invalid loginid/password will be rejected by server.</li>
        <li>Skillsets must be described for LDAP, DNS, FIREWALL, PROXY, WEB, MAIL, NFS etc. services under LINUX environment.</li>
        <li>Your knowledge about IIITA network implementation will help us to judge your awareness and involvement with the environment.</li>
        <li>Your idea that you want to implement on IIITA network in order to add some value/feature on existing services.</li>
        <li>Software in use at present on different LINUX platforms<dir>tinydns for DNA<br>squid for PROXY<br>iptables for FIREWALL/GATEWAY<br>Apache2 for Web<br>qmail, courier-imap, ezmlm for mail<br>squirrelmail/nutsmail for mailclient<br>mysql for database<br>open-ldap3 for LDAP<br>open-iscsi for IP-SAN etc.</dir></li>
        </ol><br>
        <b><center>INDEM@IIITA</center></b>";
  return;
}
?>
</body></html>