Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include('dbconn.php');
- $error_msg = "";
- $sumbit = filter_input(INPUT_POST, 'submit');
- $username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_ENCODED);
- $password = password_hash(filter_input(INPUT_POST, 'password', FILTER_SANITIZE_ENCODED), PASSWORD_DEFAULT, ['cost' => 12]);
- echo $password;
- //echo password_hash($password, PASSWORD_DEFAULT, ['cost' => 12]);
- //exit();
- if (isset($sumbit)) {
- if ($username != "" || $password != "") {
- $result = $db->query("SELECT * FROM `acl_admin_login` WHERE `admin_login_username`='" . $username . "'");
- if ($result->num_rows > 0){
- $row = $result->fetch_assoc();
- if(password_verify($row['admin_login_password'], $password)){
- echo "right";
- exit();
- }else{
- echo "wrong";
- exit();
- }
- if ($row['admin_login_status'] == 1 && password_verify($row['admin_login_password'], password_hash($password, PASSWORD_DEFAULT, ['cost' => 12]))) {
- $_SESSION['name'] = $row['admin_login_username'];
- header("Location:admin.php");
- } else {
- $error_msg = "بياناتك تم منعها";
- }
- } else {
- $error_msg = "الرجاءالتأكد من البيانات المدخلة";
- }
- } else {
- $error_msg = "الرجاء تعبئة البيانات";
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>tutorial</title>
- <link rel="shortcut icon" href="images/logo.png" />
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="stylesheet" href="css/bootstrap.min.css">
- <link rel="stylesheet" href="css/font-awesome.min.css">
- <link rel="stylesheet" href="css/hover.css">
- <link rel="stylesheet" href="css/animate.css">
- <link rel="stylesheet" href="css/site.css">
- <link href='https://fonts.googleapis.com/css?family=Asset|Diplomata+SC|Montserrat|Merriweather:400,900,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="css/style.css">
- <script type="text/javascript" src="js/jssor.slider.min.js"></script>
- </head>
- <body>
- <div class="">
- <form class="form-signin col-lg-offset-3 col-lg-6" id="login-form" action="login.php"
- method="POST">
- <h2 class="form-signin-heading">Login</h2>
- <label class="sr-only" for="inputUsername">Username</label>
- <input type="text" autofocus="" name="username" required="" oninvalid="this.setCustomValidity('الرجاء أدخل إسم المستخدم')" placeholder="username" class="form-control" id="inputUsername">
- <label class="sr-only" for="inputPassword">Password</label>
- <input type="password" oninvalid="this.setCustomValidity('الرجاء أدخل كلمة المرور')" required="" name="password" placeholder="Password" class="form-control" id="inputPassword">
- <br>
- <button type="submit" class="btn btn-lg btn-primary btn-block submit" name="submit" >Sign in</button>
- <?php
- if ($error_msg != null || $error_msg != '') {
- echo "<br><p style=\"color:red;\font-size:20px;\">" . $error_msg . "</p>";
- }
- ?>
- </form>
- </div>
- <script src="js/jquery-2.2.0.min.js"></script>
- <script src="js/bootstrap.min.js"></script>
- <script src="js/wow.min.js"></script>
- <script>
- new WOW().init();
- </script>
- <script src="js/main.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement