私のコードは19歳以上であれば人を人にさせていますが、もしあなたが古い人にあなたがなぜこれを入力させないのであれば?私は、人は1958年に私のサイト今日を入力しようとしていた、まだ私は1989を入力することができます追い出さしまった、それは年齢が古いものを蹴飛ばしているコードを確認しますか?
インデックスページ
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>510 Vapour</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/responsive.css">
<link rel="stylesheet" href="css/animate.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
</head>
<div class="js">
<body>
<!-- Preloader section -->
<div id="preloader"></div>
<!-- Preloader section -->
<div class="container">
<!-- AccessBox section -->
<div id="accessbox"class="animated bounceInDown"> <img class="profile-img" src="images/logo.png" />
<h2 class="text-center">Please enter your date of birth</h2>
<!-- Form section-->
<form action="php/access.php" method="post" class="access-form">
<input type="text" name="yy" class="access-input-lg" placeholder="2016" required autofocus>
<input type="text" name="mm" class="access-input" placeholder="05">
<input type="text" name="dd" class="access-input" placeholder="10">
<input type="submit" name="submit"class="access-btn" value="OK" >
<div id="remember" class="checkbox text-center">
<label class="text-center">
<input type="checkbox" value="remember-me">
Remember me </label>
</div>
</form>
<!-- Form section-->
<h1 class="text-center"><i class="fa fa-exclamation-triangle red"></i> You must be 19+ to enter this site </h1>
<p class="text-center">By ENTERING, you are consenting to your Province's Smoking Laws. You may be required to show a valid government issued Photo ID indicating your date of birth at time of delivery or at the Post Office.</p>
</div>
<!-- AccessBox section -->
</div>
<!-- /container -->
<!-- JS files-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- Pre Loader-->
<script type="text/javascript">
jQuery(document).ready(function($) {
$(window).load(function(){
$('#preloader').fadeOut('slow',function(){$(this).remove();});
});
});
</script>
</body>
</div>
</html>
access.phpの
<?php
$minAge = 19;
if(isset($_POST['submit'])){
if(strlen($_POST['mm'])==1)
$month = '0'.$_POST['mm'];
else
$month = $_POST['mm'];
$agevar = $_POST['yy'];
$age = strtotime($agevar);
$nineteen = strtotime("-" . $minAge . " years");
if($age && $nineteen && $age <= $nineteen){
header('Location: https://www.510vapour.com/main');
}
else{
header('Location: ../error.html');
}
}
?>
* all *コントロールブロックに中括弧を使用すると、このようなバグが少なくなります。また、日付計算にstrtotimeを使用しないでください。そのためのものではありません。 –
日にちをチェックしてみませんか?ユーザーは月の最終日に生まれた可能性があり、技術的にはまだ18歳です。 –
lol申し訳ありません私はPHPに新しいので、あなたはあなたの助けを喜んで助けることができます取得 –