<?php
session_start();
require_once 'classconn/class.user.php';
require_once 'action/login/login.php';
if($actionParam->user_is_logged_in() !="")
{
    $actionParam->redirect('dashboard/html/ltr/vertical-menu/');
}
?>
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<head>
    <!-- Required meta tags -->
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400&amp;display=swap" rel="stylesheet" />

    <link rel="stylesheet" href="fonts-1/icomoon/style.css" />

    <link rel="stylesheet" href="cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.html" />

    <link rel="stylesheet" href="css-1/owl.carousel.min.css" />

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css-1/bootstrap.min.css" />

    <!-- Style -->
    <link rel="stylesheet" href="css-1/style.css" />

    <title>Login | BitXprofits</title>
    <link rel="icon" type="image/x-icon" href="images/new/favicon.png" />
</head>

<body>
    <div class="d-lg-flex half">
        <div class="bg order-1 order-md-2" style="background-image: url('images/new/signup.jpg')">
            <h1 class="text-center text-white" style="padding-top: 50%">
                Login Here
            </h1>
        </div>

        <div class="contents order-2 order-md-1">
            <div class="container">
                <div class="row align-items-center justify-content-center">
                    <div class="col-md-7">
                        <h3>Login</h3>
                        <p class="mb-4">
                            <span class="fa fa-lock"></span> SECURED ACCESS
                        </p>
                        <form action="" method="post" id="login-form">
                        <?php if(isset($_GET['account']) && isset($_GET['id'])) { ?>
                                <div class='alert' style='background-color: #00a875; color: #fff; border-left-color: #fff;'>
                                    <?php 
                                          //get variables direct from url
                                          $email_encoded = $_GET['account'];//email
	                                      $password_encoded = $_GET['id'];//password
                                    ?>
                                    An authentication code has been sent to your mail, use it to verify your login attempt. This may take a few seconds.<a href="?resend&account=<?php echo $email_encoded; ?>&id=<?php echo $password_encoded; ?>" style="color: #fff; font-size: 11pt; font-weight: 900;"> Resend code</a>
                                  </div>
								 <?php } ?>
								 <?php if(isset($_GET['authentication-error'])) { ?>
                                <div class='alert' style='background-color: indianred; color: #fff; border-left-color: #fff;'>
                                    Failed to login. Authentication code is not correct.
                                </div>
                            <?php } ?>
                            <?php if(isset($_GET['login-password-error'])) { ?>
                                <div class='alert' style='background-color: #DC143C; color: #fff; border-left-color: #fff;'>
                                    Failed to login. Incorrect password.
                                </div>
                            <?php } ?>
                            <?php if(isset($_GET['login-email-error'])) { ?>
                                <div class='alert' style='background-color: #DC143C; color: #fff; border-left-color: #fff;'>
                                    Failed to login. Incorrect email.
                                </div>
                            <?php } ?>
                            <?php if(isset($_GET['account']) && isset($_GET['id'])){ ?>
                                <div class="form-group">
                                <input type="email" name="email" id ="email" value="<?php echo $email; ?>" class="input-text" placeholder="Email Address" required>
                            </div>
                            <div class="form-group">
                                <input type="password" name="password" id ="password" value="<?php echo $password; ?>" class="input-text" placeholder="Password" required>
                            </div>
                            <div class="form-group">
                                <input type="text" name="authcode" id ="authcode" class="input-text" placeholder="AUTHENTICATION CODE" required>
                            </div>
                            <div class="col-5">
                                    <button type="submit" name ="btn-login-auth" class="btn-md btn-theme">Login</button>
                                </div>
                            <p class="none-2">Don't have an account? <a href="register" class="thembo"> Register here</a></p>
                            <?php }else{ ?>
                            <p class="error login-error"></p>
                            <p class="error" id="login_info"></p>
                            <div class="form-group first">
                                <input type="text" class="form-control" placeholder="Email" id="email" name="email" required/>
                                <span class="email_error error"></span>
                            </div>
                            <div class="form-group last mb-3">
                                <input type="password" class="form-control" placeholder="Password" name="password" id="password" required/>
                                <span class="password_error error"></span>
                            </div>

                            <input type="submit" value="Log In" class="btn btn-block btn-primary" name="btn-login">

                            <div style="padding-bottom: 10px; padding-top: 10px">
                                <span class="caption">
                    <a href="register">Create Account</a>
                  </span>

                                <span style="padding-right: 20px"></span>

                                <span class="caption"><a href="forgotpassword" class=""
                      >Forgot Password</a
                    ></span
                  >
                </div>
                <?php } ?>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>

    <script src="js-1/jquery-3.3.1.min.js"></script>
    <script src="js-1/popper.min.js"></script>
    <script src="js-1/bootstrap.min.js"></script>
    <script src="js-1/main.js"></script>
    
    <!-- Smartsupp Live Chat script -->
<script type="text/javascript">
var _smartsupp = _smartsupp || {};
_smartsupp.key = '67100947b215cb9ad6cda42dc50eefb8b3f924be';
window.smartsupp||(function(d) {
  var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];
  s=d.getElementsByTagName('script')[0];c=d.createElement('script');
  c.type='text/javascript';c.charset='utf-8';c.async=true;
  c.src='https://www.smartsuppchat.com/loader.js?';s.parentNode.insertBefore(c,s);
})(document);
</script>
<noscript> Powered by <a href=“https://www.smartsupp.com” target=“_blank”>Smartsupp</a></noscript>


  </body>


</html>