<?php include("includes/header.php"); ?>
<!DOCTYPE html>
<html>
<head>
  <title><?php echo $sitename; ?> | Login and start trading.</title>
  
    <meta name="description" lang="en" content='<?php echo $sitename; ?> is a leading crypto-asset trading and investment platform, offering a wide array of tools to invest in the cryptocurrency market.' />
  	<meta name="keywords" content="Bitcoin trading, Trading,ceypto,crypto trading,Blockchain."/>
  	<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
  	<meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <script src="bootstrap/js/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <!----------------------------------------------------------------------->
    
    
    
    

    <!-- Font Awesome -->
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    
    <style>
      body{
        background-color: ;
      }
    </style>
    <style>
      .rotate {

        overflow-y: hidden;
          -webkit-animation: spin 40.99s infinite linear;
          animation: spin 40.99s infinite linear;
      }
      @-webkit-keyframes spin {
          100% { -webkit-transform: rotate(360deg); }
      }
      @-moz-keyframes spin {
          100% { -moz-transform: rotate(360deg); }
      }
      @keyframes spin {
          100% {
              -moz-transform:rotate(360deg);
              -o-transform:rotate(360deg);
              transform:rotate(360deg);
          }
      }

      body{
        background-color:#fff;
      }

      .inna-btc{
        position:absolute;
        top:100px;
        left: 150px;
      }


      @keyframes float {
        0% {
          box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
          transform: translatey(0px);
        }
        50% {
          box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2);
          transform: translatey(-20px);
        }
        100% {
          box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6);
          transform: translatey(0px);
        }
      }

      .avatar {
        overflow-x: hidden;
        overflow-y: hidden;
        animation: float 1.9s ease-in-out infinite;
      }
      .bend-img{
          -ms-transform: rotate(45deg); /* IE 9 */
          -webkit-transform: rotate(45deg); /* Safari 3-8 */
          transform: rotate(45deg);
      }
      .fa-check-design{
        padding: 10px 10px;
        border-radius: 100%;
        color: #f2a900;
        border:2px solid #f2a900;
      }
      .panelshadow{
        box-shadow: 10px 10px 8px #888888;
      }
    </style>
    <link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>

    
</head>
<body onload="">
    <?php include("includes/navbar.php"); ?>
    <br><br>
    <div class="container">
   <div class="row">
    <div class="col-sm-1"></div>
    <div class="col-sm-4">
      <br><br><br>
      <div class="panel panel-default" style="border-radius: 0px;">
        <div class="panel-body">
          <div align="left"><span style="font-size: 25px;">Welcome Admin,</span><br><span>Fill in your account information to login!</span></div>
          <br>

          <?php
          $login_error = "";
          if(isset($_POST["loginbtn"])){
            $email = mysqli_real_escape_string($conn, $_POST["z_email"]);
            $password = mysqli_real_escape_string($conn, $_POST["z_password"]);


            if(!empty($email) && !empty($password)){


              $query = mysqli_query($conn, "SELECT * FROM admin WHERE email = '$email'");
              $numrow = mysqli_num_rows($query);
              if($numrow >= 1){
                $row = mysqli_fetch_assoc($query);
                $dbpassword = $row["password"];
                $admin_id = $row["id"];

                if($dbpassword == $password){

                   $_SESSION["admin_id"] = $admin_id;

                   echo "<script>window.location.assign('dashboard.php');</script>";
                   
                }else{
                  $login_error = '
                  <div class="alert alert-danger">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    Incorrect Password
                  </div>';
                }
              }else{
                $login_error = '
                <div class="alert alert-danger">
                  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                  <i class="fa fa-bell"></i> The email address you entered is not registered on btczux.
                </div>';
              }
            }else{
              $login_error = '
              <div class="alert alert-danger">
                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                Fill in all forms.
              </div>';
            }
          }
          ?>
          

          <?php echo $login_error; ?>
          <form action="" method="POST">
          <div class="form-group">
            <input type="email" name="z_email" class="form-control input-lg" style="border-radius: 0px;" placeholder="Email" required>
            <span id="email-error" style="color:darkred;"></span>
            <br>
            <input type="text" name="z_password" class="form-control input-lg" style="border-radius: 0px;" placeholder="Password" required>
            
            <br>
            <button type="submit" name="loginbtn" class="btn btn-block btn-danger btn-lg" style="border-radius:0px; background-color:#ffb900; border-color: #ffb900; color:#000;"><i class="fa fa-lock"></i> Sign In</button>
            
            <br>

          </div>
          </form>
        </div>
      </div>
      <br><br>

    </div>
    <div class="col-sm-1">
      
    </div>
    <div class="col-sm-5" align="center">
     <br><br><br>
    <div class="hidden-xs hidden-sm"><img src="images/2766240.png" class="img-responsive" width="400"></div>

    </div>
    <div class="col-sm-1">
      
    </div>
  </div>
</div>
</body>
</html>