| Current Path : /var/www/html/mmishra/indem/ |
| Current File : /var/www/html/mmishra/indem/alumnireg.inc |
<h2>Alumni Account Setting</h2>
<?php
if ($uid) {
$gecos = htmlsafe($_POST["gecos"]);
$eno = htmlsafe($_POST["eno"]);
$setmail = $_POST["setmail"];
$clearalias = $_POST["clearalias"];
$forwardmail = htmlsafe($_POST["forwardmail"]);
$mobile = htmlsafe($_POST["mobile"]);
$postaladdress = htmlsafe($_POST["postaladdress"]);
$phone = htmlsafe($_POST["phone"]);
$homepostaladdress = htmlsafe($_POST["homepostaladdress"]);
$homephone = htmlsafe($_POST["homephone"]);
$www = htmlsafe($_POST["www"]);
if (strpos($www,"iiita.ac.in")) $www = "http://profile.iiita.ac.in/$uid";
$secrethint = htmlsafe($_POST["secrethint"]);
$secretcode = htmlsafe($_POST["secretcode"]);
$source_ip = $_SERVER["REMOTE_ADDR"];
$dated = date("Y-m-d H:i:s");
//session created...proceed with registration form
$ds = ldap_connect("ldap.iiita.ac.in"); // must be a valid LDAP server!
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$z = ldap_bind($ds);
$a = ldap_search($ds, "ou=alumni,dc=iiita,dc=ac,dc=in", "(&(uid=$uid)(posixaccount=posixAccount))");
$b = ldap_get_entries($ds, $a);
$dn = $b[0]["dn"];
if ($submit == "SUBMIT" && $eno && $uid) {
if (strpos($forwardmail, "iiita.ac.in")) {
echo "Forwarding address must be <b id='alert'>External Email</b>.<br>";
} else if (!$forwardmail) {
echo "Forwarding address is mandatory and must be <b id='alert'>External</b>.<br>";
} else {
$bd = ldap_bind($ds, "cn=Manager,dc=iiita,dc=ac,dc=in","\$dollfinn");
if ($setmail == 'yes') $info0["mail"] = array();
if ($clearalias == 'yes') $info0["mailAlternateAddress"] = array();
$info0["mailForwardingAddress"] = array();
$r = ldap_mod_del($ds, $dn, $info0);
$info1["cn"][0] = str_replace(' ', '-', $gecos . '-' . $eno);
ldap_modify($ds, $dn, $info1);
if (ldap_error($ds) != 'Success') ldap_add($ds, $dn, $info1);
$info1["gecos"][0] = $gecos;
if ($eno) $info1["employeeNumber"][0] = $eno;
if ($sn) $info1["sn"][0] = $sn;
if ($setmail == 'yes') $info1["mail"][0] = $rollno . "@iiita.ac.in";
if ($forwardmail) $info1["mailForwardingAddress"][0] = $forwardmail;
if ($mobile) $info1["mobile"][0] = $mobile;
if ($postaladdress) $info1["postalAddress"][0] = $postaladdress;
if ($labeleduri) $info1["labeledURI"][0] = $labeleduri;
if ($secretcode) $info1["registeredAddress"][0] = $secrethint.':'.$secretcode;
$r = ldap_modify($ds, $dn, $info1);
//foreach ($info1 as $inf) {
//echo $inf[0]."<br>";
//}
echo "Thanks <b id='alert'>$gecos!</b>, you have been registered successfully.<br>";
}
}
if ($uid) {
$q = ldap_search($ds, "ou=alumni,dc=iiita,dc=ac,dc=in", "(&(uid=$uid)(objectclass=posixAccount))");
$info = ldap_get_entries($ds, $q);
if ($info["count"] > 0) {
$cn = strtoupper($info[0]["cn"][0]);
$gecos = ucwords(strtolower(strtr($info[0]["gecos"][0],"-"," ")));
$rollno = $info[0]["employeenumber"][0];
$sn = $info[0]["sn"][0];
$mail = $info[0]["mail"][0];
$forwardmail = $info[0]["mailforwardingaddress"][0];
$mobile = $info[0]["mobile"][0];
$postaladdress = $info[0]["postaladdress"][0];
$labeleduri = $info[0]["labeleduri"][0];
$secret = explode(':', $info[0]["registeredaddress"][0]);
if ($secret[0]) $secrethint = $secret[0];
if ($secret[1]) $secretcode = $secret[1];
}
}
echo "<br>
<table border='0' cellspacing='0' width='100%'>
<tr><td >UID</td><td><b>$uid ($mail)</b></td></tr>
<tr><td>Name *</td><td><input type='text' name='gecos' value='$gecos' size='30'></td></tr>
";
if ($mailalias) {
echo "<tr valign='top'><td>Mail-alias</td><td>$mailalias
<input type='checkbox' name='clearalias' value='yes'>Remove mail-alias</td></tr>";
}
echo "
<tr valign='top'><td>Roll No. *</td><td><input type='text' name='rollno' value='$rollno' size='30'></td></tr>
<tr><td></td><td><input type='checkbox' name='setmail' value='yes'> Set <b>rollno@iiita.ac.in</b> as official email.</td></tr>
<tr valign='top'><td nowrap>Forward Email *</td><td><input type='text' name='forwardmail' value='$forwardmail' size='30'><br>Current email address to forward mails</td></tr>
<tr valign='top'><td>Contact No.</td><td><input type='text' name='mobile' value='$mobile' size='30'></td></tr>
<tr valign='top'><td>Postal Address</td><td><textarea name='postaladdress' rows=3 cols=30>$postaladdress</textarea></td></tr>
<tr valign='top'><td>Homepage</td><td><input type='text' name='labeleduri' value='$labeleduri' size='30'> <br>External web profile</td></tr>
<tr valign='top'><td>Secret Hint</td><td><input type='text' name='secrethint' value='$secrethint' size='30'> <br>May be a question</td></tr>
<tr valign='top'><td>Secret Code</td><td><input type='text' name='secretcode' value='$secretcode' size='30'> <br>One word code</td></tr>
<tr><td></td><td><input type='submit' name='submit' value='SUBMIT'></td></tr>
</table>Edit information and press button to update.<br>
<ol>
<li>* are mandatory nformation.</li>
<li>Blank fields may cause login problem on mail server.</li>
<li>Official mail address is permanent and not editable.</li>
<li>Mail-alias will be revoked on completion of course.</li>
<li>Mail forwarding address is mandatory and must be external.</li>
<li>Contact No. is useful in official communications.</li>
</ol>";
ldap_close($ds);
}
?>