View file iblog/admin/recover-password.php

File size: 3.24Kb
<?php
	session_start();
	include "../lib/config.php"; 
	include "../lib/function.php"; 
	$uid = isset($_SESSION['aid']);
	$url = HOSTNAME."admin";
	
	if($conn->connect_error){
		header("Location: ../setup/database.php");		
		//echo 'Databse connection failed! Please contact support team';
	}
	else if($uid != ''){
		header("Location: $url");
	}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>iBlog | Recover Password</title>
	
	<!-- FAVICONS -->
    <link rel="shortcut icon" href="../uploads/favicon/<?php echo setting($conn,'favicon');?>" type="image/x-icon">
	
    <!-- Bootstrap -->
    <link href="plugins/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="css/notie.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="css/custom.css" rel="stylesheet">
	
	<style>
		a {
			color: #337ab7;
			text-decoration: none;
		}
	</style>
  </head>

  <body style="background:#F7F7F7;">
    <div class="">
      <a class="hiddenanchor" id="toregister"></a>
      <a class="hiddenanchor" id="tologin"></a>

      <div id="wrapper">
        <div id="login" class=" form">
          <section class="login_content">
            <form id="recoverpass">
              <h1>Recover Password</h1>
              <div>
                <input type="email" class="form-control" name="email" placeholder="Enter email"/>
              </div>
              <div>
				<input type="hidden" name="login">
                <input type="submit" class="btn btn-default submit" value="Get Password">
                <a class="reset_pass" href="login.php">Do you have password?</a>
              </div>
              <div class="clearfix"></div>
              <div class="separator">
			  
                <div class="clearfix"></div>
                <br />
                <div>
                  <h1><i class="fa fa-comments-o" style="font-size: 26px;"></i> iBlog</h1>

                  <p><?php echo setting($conn,'footer');?></p>
                </div>
              </div>
            </form>
          </section>
        </div>
      </div>
    </div>
  </body>
  
  <!-- jQuery -->
    <script src="plugins/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="plugins/bootstrap/dist/js/bootstrap.min.js"></script>
	
    <script src="js/notie.js"></script>
	
	<script>
		//Recover Password
		$("#recoverpass").submit(function (event){
		event.preventDefault();
		
		$.ajax({
				url:'controller/reset_password.php',
				type:'POST',
				data:$(this).serialize(),
				success: function(data){
					if(data == 1){
						
						$('#recoverpass')[0].reset();
						notie.alert('success', 'Password reset success. Password has been sent to your registered E-mail', 20);
					}
					else if(data == 2){
						
							notie.alert('info', 'E-Mail not found!', 3);
					}
					else{
						
							notie.alert('error', data, 3);
							
						}
				}

			});
				
		});
	</script>
</html>