<?php 
include("header.php");
$msg="";$msg1="";
if(isset($_POST['email']))
{
	$sqlcheck=mysql_query("select * from tbl_users where email='".$_POST['email']."'");
	if(mysql_num_rows($sqlcheck)>0)
	{
		$result=mysql_fetch_assoc($sqlcheck);
		
		$message='<div id=":nm" class="ii gt m152202c763663e6d adP adO"><div id=":nl" class="a3s" style="overflow: hidden;"><div marginwidth="0" marginheight="0"><div class="adM">
	   </div><div dir="ltr" style="background-color:#f5f5f5;margin:0;padding:70px 0 70px 0;width:100%"><div class="adM">
		  </div><table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
			 <tbody>
				<tr>
				   <td align="center" valign="top">
					  <div>
					  </div>
					  <table style="background-color:#fdfdfd;border:1px solid #dcdcdc;border-radius:3px!important" border="0" cellpadding="0" cellspacing="0" width="600">
						 <tbody>  
						 <tr>
							   <td align="center" valign="top">
								  <table style="margin-top:20px" border="0" cellpadding="0" cellspacing="0" width="600">
									 <tbody>
										<tr>
										   <td align="center" style="text-align: center;
font-family: Open Sans Condensed,Helvetica Neue,sans-serif;
font-size: 28px;
font-weight: bold;
text-transform: uppercase;">
												<a href="'.$actual_link.'index" style="color:#5e5e5e;">
 
												<span class="logo-icon"><i class="icon icon-search-1 ln-shadow-logo shape-0"></i> </span> Exchangekarde.com </a> 
												
											   				
											  
										   </td>
										   
										</tr>
									 </tbody>
								  </table>
							   </td>
							</tr>                      
							<tr>
							   <td align="center" valign="top">
								  <table border="0" cellpadding="0" cellspacing="0" width="600">
									 <tbody>
										<tr>
										   <td style="background-color:#fdfdfd" valign="top">
											  <table border="0" cellpadding="20" cellspacing="0" width="100%">
												 <tbody>
													<tr>
													   <td style="padding:48px" valign="top">
														  <div style="color:#000;font-family:&quot;Helvetica Neue&quot;,Helvetica,Roboto,Arial,sans-serif;font-size:14px;line-height:150%;text-align:left">
															 
															 <p style="margin:0 0 16px">Dear '.$result['fullname'].', We have received your forgot password request. Please click on link for reset password.<br>
															 <a href="'.$actual_link.'reset_password/'.base64_encode($_POST['email']).'">Click here for reset password</a>
															 
															 
															 </p>                                                         
														  </div>
													   </td>
													</tr>
												 </tbody>
											  </table>
										   </td>
										</tr>
									 </tbody>
								  </table>
							   </td>
							</tr>
							<tr>
							   <td align="center" valign="top">
								  <table border="0" cellpadding="10" cellspacing="0" width="600">
									 <tbody>
										<tr>
										   <td style="padding:0" valign="top">
											  <table border="0" cellpadding="10" cellspacing="0" width="100%">
												 <tbody>
													<tr>
													   <td colspan="2" style="border:0;color:#000;font-family:Arial;font-size:12px;line-height:125%;text-align:center" valign="middle">
														  <p>Powered by Exchangekarde.com</p>
													   </td>
													</tr>
												 </tbody>
											  </table>
										   </td>
										</tr>
									 </tbody>
								  </table>
							   </td>
							</tr>
						 </tbody>
					  </table>
				   </td>
				</tr>
			 </tbody>
		  </table></div></div></div></div>';
		  
			
			
			$subject="Forgot Password";
			$to   = $_POST['email'];
			$from = 'info@exchangekarde.com';
			
			$headers = "From: " . strip_tags($from) . "\r\n";
			$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
			
			$headers .= "MIME-Version: 1.0\r\n";
			$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
			
			$mail=mail($to, $subject, $message, $headers);
			
			if($mail==true)
			{
				$msg1="Please check your email we have sent a mail";
			}
			
			?>
			<script>
			setTimeout(function(){
			window.location="<?php echo $actual_link;?>index";
			},3000);
			</script>
			<?php
			
			
	}
	else
	{
		$msg="Email does not exists in record";
	}
	
}
?>
 
<div class="main-container">
<div class="container">
<div class="row">
<div class="col-sm-5 login-box">
<?php 
if($msg!=="")
{
	?>
		<div class="alert alert-danger">
        <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
        	<?php echo $msg;?>
        </div>
	<?php
}
?>
<?php 
if($msg1!=="")
{
	?>
		<div class="alert alert-success">
        <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
        	<?php echo $msg1;?>
        </div>
	<?php
}
?>
<div class="panel panel-default">
<div class="panel-intro text-center">
<h2 class="logo-title">
 
<span class="logo-icon"><i class="icon icon-search-1 ln-shadow-logo shape-0"></i> </span> Exchangekarde.com </h2>
</div>
<div class="panel-body">
<form role="form" method="post">
<div class="form-group">
<label for="sender-email" class="control-label">Email:</label>
<div class="input-icon"> <i class="icon-user fa"></i>
<input id="sender-email" type="email" name="email" placeholder="Email" class="form-control email" required>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-lg btn-block">Send me my password</button>
</div>
</form>
</div>
<div class="panel-footer">
<p class="text-center "> <a href="login"> Back to Login </a> </p>
<div style=" clear:both"></div>
</div>
</div>
<div class="login-box-btm text-center">
<p> Don't have an account? <br>
<a href="signup"><strong>Sign Up !</strong> </a> </p>
</div>
</div>
</div>
</div>
</div>
 
<?php include("footer.php");?>