Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/indem/
Upload File :
Current File : /var/www/html/mmishra/indem/passwordreset.php

<h2>Password Reset</h2>
<?php
$emailid = $_POST["emailid"];
?>
Email <input type='text' name='emailid' size='20' value='<?php echo $emailid; ?>'>@iiita.ac.in
<input type='submit' name='submit'  value='SUBMIT'><br><br>
<?php
if ($emailid) {
	$ipaddr = $_SERVER["REMOTE_ADDR"];
	$dated = date("Y-m-d H:i:s");

	$ds = ldap_connect("ldap.iiita.ac.in"); 
	ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
	$q = ldap_search($ds, "dc=iiita,dc=ac,dc=in", "(&(uid=$emailid)(objectclass=posixAccount))");
	$info = ldap_get_entries($ds, $q);
        $dn = $info[0]["dn"];
        $lastchange = $info[0]["shadowLastChange"];
        $pager = $info[0]["pager"];
	
	if ($info["count"] > 0) {
               	$cn = strtoupper($info[0]["cn"][0]);
               	$gecos = ucwords(strtolower(strtr($info[0]["gecos"][0],"-"," ")));
               	$eno = $info[0]["employeenumber"][0];
               	$email = $info[0]["mail"][0];
               	if (!$forwardmail) $forwardmail = $info[0]["mailforwardingaddress"][0];
               	if (!$mobile) $mobile = $info[0]["mobile"][0];
		$secret = explode(':',$info[0]["registeredaddress"][0]);
               	$secrethint = $secret[0];
               	$secretcode1 = $secret[1];
	
			if (strpos($forwardmail, "iiita.ac.in") || !$forwardmail) {
				echo "Please mention some external email address.<br>Thanks.";
			} else if ($secretcode1 == $secretcode) {
               			ldap_bind($ds, "cn=Manager,dc=iiita,dc=ac,dc=in","\$dollfinn");
       				$pwd1 = 'iiita' . rand(111,999);
       				//$pwd = '{CRYPT}' . crypt($pwd1);
       				$pwd = "{SHA}" . base64_encode(pack("H*", sha1($pwd1)));
       				$info1["userPassword"] = "$pwd";
        			if (ldap_modify($ds, $dn, $info1)) {
				 	include "classes/class.phpmailer.php";
					$mail = new PHPMailer();
				        $mail->IsSMTP(); // telling the class to use SMTP
				        //$mail->IsHTML(true); // telling the class to use SMTP
				        $mail->FromName = "INDEM @ IIITA";
				        $mail->From = "indem@iiita.ac.in";
				        $mail->Username = "indem@iiita.ac.in";
				        $mail->Password = "chintan2014";

       					$mail->AddAddress($forwardmail, $loginid);
       					//$mail->AddAddress("mmishra@iiita.ac.in","$loginid");
       					$mail->AddCC("indem@iiita.ac.in", "INDEM @ IIITA");

					$mail->Subject = "Password Self Recovery";
       					$mail->Body = "Dear $gecos ($eno) ! \n
Your request for PASSWORD @ IIITA Self Recovery has been recevied to INDEM @ IIITA. We are pleased to set your new password as $pwd1 so that you can get into your Mail @ IIITA. As this is a pure temporary arrangement, you are advised to change it at the very first login to avoid any inconvenience.

If needed, you will be contacted on your No. $mobile, however, if desired, you may also contact INDEM at 91-532-2922151/2/3.

$ipaddr is the IP address of your system request for PASSWORD @ IIITA Self-Recovery received from.

Happy mailing,


INDEM
IIIT - Allahabad

(auto generated)";
					if ($mail->Send()) 
						echo "<dir><font color=red>Thanks $gecos! Please goto your mailbox $forwardmail and 
						get the new password thereby in the sent mail.</font></dir>";
					else 
						echo "Mail could not be sent. ".$mail->ErrorInfo."<dir>".$mail->Body."</dir>";
				} else {
					echo "<dir><font color=red>Sorry $gecos! Mail with new password could not be sent to $forwardmail. 
					Try with other email address.</font></dir>";
				}
			} else {
				echo "<dir><font color=red>Sorry $gecos! Try again as secret code did not match.</font><br> 
				Please set your secret code on <a href='?pg=accountreg'>Mail Account Setting</a> 
				or contact at 91-532-2922151/2/3<br> Thanks.</dir>";
			}
		} else {	
        		echo "
	        	<table border='0' cellspacing='0' width='100%'>
        		<tr><td>UID</td><td><b>$loginid </b></td></tr>
        		<tr><td nowrap>External Email*</td><td><input type='text' name='forwardmail' value='$forwardmail' size='20'></td></tr>
        		<tr><td>Mobile No.</td><td><input type='text' name='mobile' value='$mobile' size='20'></td></tr>
        		<tr><td nowrap>Secret Hint</td><td style='color: blue; font-size:14pt; padding:5pt'>$secrethint</td></tr>
        		<tr valign='top'><td nowrap>Secret Code*</td>
			<td><input type='password' name='secretcode' value='' size='20'><br>(hidden text)</td></tr>
        		<tr><td></td><td><input type='submit' name='submit' value='RESET PASSWORD'></td></tr>
        		</table><br>";
		}
	}
	ldap_close($ds);
}
?>
<br><ol>
<li>Secret hint and code is user credential for this service.</li>
<li>Forwarding email is mandatory for password self recovery.</li>
</ol>