非常に機密のサイトがあり、ログインできる人数は少数です。ユーザーがログインを3回試みたかどうか、私のサーバーからディレクトリ全体が削除されます。これは難しいですか?ログイン試行回数が最大に達した場合にサイトディレクトリ全体を削除する方法
は、ここに私のログインページです:
<?php
require_once('scripts/user_authentication.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href='http://fonts.googleapis.com/css?family=Inder' rel='stylesheet' type='text/css'>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Access login</title>
<link href="../styles/users.css" rel="stylesheet" type="text/css" />
<style>
span {font-family: 'Inder', sans-serif; color: #369; font-style: italic;}
#login {width: 400px; margin: 60px auto 0 auto; padding: 20px; text-align: center;
box-shadow: 0px 9px 21px rgba(0, 0, 0, 0.63);
-moz-box-shadow: 0px 9px 21px rgba(0, 0, 0, 0.63);
-webkit-box-shadow: 0px 9px 21px rgba(0, 0, 0, 0.63);
}
#login p {text-align: left;}
form {padding: 0; margin: 0; }
input {margin: 0; padding: 0;}
h1 { margin: 0 0 20px 0; padding: 0;}
</style>
</head>
<body>
<div id="login">
<h1><span>p*******</span> Partners Only</h1>
<div id="inner">
<?php if ($failed) { ?>
<p class="warning">Login failed. Try Again. Please contact ******* ***** if you do not know your access information. After multiple attempts this site will self destruct. Thank you for your cooperation.</p>
<?php } ?>
<form id="form1" name="form1" method="POST">
<p>
<label for="username">Username:</label>
<input type="text" name="username" id="username" />
</p>
<p>
<label for="password">Password:</label>
<input type="password" name="password" id="password" />
</p>
<p>
<input type="submit" name="signin" id="signin" value="Sign in" />
</p>
</form>
</div>
</div>
</body>
</html>
、ここuser_authenticationである:それは非常に危険であるコメントで述べた人々はそれをやって
<?php
$failed = FALSE;
if ($_POST) {
if (empty($_POST['username']) || empty($_POST['password'])) {
$failed = TRUE;
} else {
require_once('library.php');
// check the user's credentials
try {
$auth = Zend_Auth::getInstance();
$adapter = new Zend_Auth_Adapter_DbTable($dbRead, 'users', 'first_name', 'family_name', 'password' 'sha1(?)');
$adapter->setIdentity($_POST['username']);
$adapter->setCredential($_POST['password']);
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$storage = $auth->getStorage();
$storage->write($adapter->getResultRowObject(array(
'username', 'first_name', 'family_name')));
header('Location: members_only.php');
exit;
} else {
$failed = TRUE;
}
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
if (isset($_GET['logout'])) {
require_once('library.php');
try {
$auth = Zend_Auth::getInstance();
$auth->clearIdentity();
} catch (Exception $e) {
echo $e->getMessage();
}
}
をアクセスするために、実際のユーザーのための安全な手順を持っているためにそれらを必要としますか?ユーザーがパスワードを忘れた場合、または他のユーザーがユーザー名を使用してページにアクセスしようとしている場合はどうなりますか? – Virendra
これは非常に危険なアプローチです。攻撃者があなたのサーバから情報を削除して、実際のユーザがアクセスできないようにします。 –
URLを投稿すると誰かがあなたのためにテストすると確信しています;) – Ram