Created
March 11, 2018 10:29
-
-
Save ARMADAIX/580a1ac192ea17e141d64b868c8ec2c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// старт сессии | |
session_start(); | |
// если были отправлены данные | |
if(!empty($_POST)){ | |
// Сравниваем введенную капчу с тем, что храниться в сессии | |
if($_SESSION['capcha'] == $_POST['capcha']){ | |
echo 'Капча верная'; | |
}else { | |
echo 'Капча не верная'; | |
} | |
// Удаляем значение капчи из сессии | |
unset($_SESSION['capcha']); | |
} | |
?> | |
<? | |
if(! defined('BASEPATH') ){ exit('Unable to view file.'); } | |
$mesaj = '<div class="message info">Connect to Admin Panel</div>'; | |
if(isset($_POST['logare'])) { | |
$name = $db->EscapeString($_POST['login']); | |
$pass = $db->EscapeString($_POST['pass']); | |
$sql = $db->Query("SELECT id FROM `admins` WHERE `login`='".$name."' AND `pass`=MD5('".$pass."')"); | |
$num = $db->GetNumRows($sql); | |
if($num > 0) { | |
$db->Query("UPDATE `admins` SET `online`=NOW() WHERE `login`='".$name."'"); | |
$_SESSION['EX_admin'] = $name; | |
redirect('index.php'); | |
}else{ | |
$mesaj = '<div class="message error">Wrong Username or Password</div>'; | |
} | |
} | |
?> | |
<body class="login"> | |
<div class="login-box widget"> | |
<header><h2>Admin Login</h2></header> | |
<section> | |
<?=$mesaj?> | |
<form id="form" method="post"> | |
<p> | |
<input type="text" id="login" class="full" value="" name="login" required="required" placeholder="Username" /> | |
</p> | |
<p> | |
<input type="password" id="password" class="full" value="" name="pass" required="required" placeholder="Password" /> | |
</p> | |
<p class="clearfix"> | |
<img src="capcha.php" width="120" height="40" /><br /> | |
Digits in image: <input type="text" name="capcha" /><br /> | |
<button class="button button-gray fr" type="submit" name="logare">Login</button> | |
</p> | |
</form> | |
<ul><li><a href="#">Forgot password?</a></li></ul> | |
</section> | |
</div> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment