<?php

   require 'db_conn.php';
   require 'core.php';

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="csrf-token" content="ZHWJfTjkwrLXTg5fBgo5CgRzTb6jijO3TQefKgkQ">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OCTA STOCK MARKET| Investment Platform.</title>



   <!-- Google Fonts -->
  <link href="https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900&display=swap" rel="stylesheet">

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

    <!-- Libraries CSS Files -->
        <link href="temp/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
        <link href="temp/lib/animate/animate.min.css" rel="stylesheet">
        <link href="temp/lib/ionicons/css/ionicons.min.css" rel="stylesheet">
        <link href="temp/lib/owl.carousel/assets/owl.carousel.min.css" rel="stylesheet">
        <link href="temp/lib/icofont/icofont.min.css" rel="stylesheet">
        <link href="temp/lib/jquery/magnific-popup.css" rel="stylesheet">
        <link href="temp/lib/aos/aos.css" rel="stylesheet">
        <link href="temp/lib/venobox/venobox.css" rel="stylesheet">
        <link href="temp/lib/icofont/icofont.min.css" rel="stylesheet">

        <link href="temp/css/frontend_style_blue.css" rel="stylesheet">
        
        <!-- JavaScript Libraries -->
        
        <script src="temp/lib/jquery/jquery.min.js"></script>
        <script src="temp/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="temp/lib/jquery.easing/jquery.easing.min.js"></script>
        <script src="temp/lib/php-email-form/validate.js"></script>
        <script src="temp/lib/waypoints/jquery.waypoints.min.js"></script>
        <script src="temp/lib/counterup/counterup.min.js"></script>
        <script src="temp/lib/isotope-layout/isotope.pkgd.min.js"></script>
        <script src="temp/lib/venobox/venobox.min.js"></script>
        <script src="temp/lib/owl.carousel/owl.carousel.min.js"></script>
        <script src="temp/lib/aos/aos.js"></script>

        <!-- Template Main Javascript File -->
        <script src="temp/js/main.js"></script>

</head>
<body class="d-flex flex-column h-100 auth-page">
    <!-- ======= Loginup Section ======= -->
    <section class="auth">
        <div class="container">
            <div class="row justify-content-center user-auth">
                <div class="col-12 col-md-6 col-lg-6 col-sm-10 col-xl-6 ">
                    <div class="text-center mb-4">
                        
                            
                                                </div>
                    
                    <div class="card ">
                        <h1 class="text-center mt-3"> User Login</h1>
                        <form method="POST" action="" class="mt-5 card__form">
                        <?php 
                if (isset($_POST['email'])&&isset($_POST['password'])) {
                    $email = $_POST['email'];
                    $password = $_POST['password'];

                    $password_hash = md5($password);

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

                    {
                        $query = "SELECT `id` FROM `users` WHERE `email`='$email' AND `password`='$password_hash'";

                        if ($query_run = mysqli_query($conn, $query)) {
                            $query_num_rows = mysqli_num_rows($query_run);

                            if ($query_num_rows==0) {
                                echo "Invalid username/password combination";
                            }elseif($query_num_rows==1){

                                while($row = mysqli_fetch_assoc($query_run)) {
                                  echo $id = $row['id'];
                                   
                                }
                                
                                $_SESSION['id']=$id;
                                header('Location: index.php');
                            }
                        }
                    }else{
                        echo "You must supply an account name or password";
                    }
                }


                ?>

                            <input type="hidden" name="_token" value="ZHWJfTjkwrLXTg5fBgo5CgRzTb6jijO3TQefKgkQ"> 
                            
                            <div class="form-group ">
                                                                <label for="email">Email address</label>
                                <input type="email" class="form-control" name ="email" value="" id="email" placeholder="name@example.com" required>
                            </div>
                            <div class="form-group">
                                                                <label for="password">Password</label>
                                <input type="password" class="form-control" name="password" id="password" placeholder="Enter Password" required>
                            </div>
                            
                            <div class="form-group">
                                <button class="btn btn-primary mt-4" type="submit">Login</button>
                            </div>
    
                            <div class="text-center mb-3">
                                <small class=" text-center mb-2">Forget your Password <a href="password/reset" class="link ml-1">Reset.</a> </small>
                                <small class=" text-center">Dont have an Account yet? <a href="https://e-forexmarket.xyz/signup.php" class="link ml-1">Sign up.</a> </small>
                            </div>
                            <div class="text-center">
                                <hr>
                                <small class=" text-center">&copy; Copyright  2016 &nbsp; OCTA STOCK MARKET&nbsp; All Rights Reserved.</small>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    
    </section>
    
    
 <!-- Start of LiveChat (www.livechat.com) code -->
	  
<!-- Smartsupp Live Chat script -->
<script type="text/javascript">
var _smartsupp = _smartsupp || {};
_smartsupp.key = 'f9ea53219acfac0925fc060efeadfc8be1033b23';
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>
<!-- End of LiveChat code -->

</body>
</html>
