Hi,
I tried to create a register page, but faced a problem with age of users.
Thing is that I want to allow only 18+ years old users to register, but I cannot create a input which could count how many years they have by their input.
What I have tried was something like this:
!!! but as you can see, it does not do all I want... I used 365 days a year, when we have 366 days every 4 years.PHP Code:$get_year = $_GET['year'];
$get_month = $_GET['month'];
$get_day = $_GET['day'];
if ($get_year > 1992 || $get_year < 1932) { $error = "denied"; $err7 = "Enter the birth year";}
elseif ($get_month > 12 || $get_month < 1) { $error = "denied"; $err7 = "Enter the birth month";}
elseif ($get_day > 31 || $get_day < 1) { $error = "denied"; $err7 = "Enter the birth day";}
$y_days = (2011 - $get_year)* 365;
$m_days = $get_month * 30;
$total_days = $y_days + $m_days + $get_day;
if ($total_days < 6600) { $error = "denied"; $err7 = "You must be over 18 to register";}
}
What is more I use 30 days a month, when we have 28, 30 and 31.
So all those errors can allow users to register when they are still 17.
What I can do to create such script, which would count the exact age.
My html script is:
So it actually only collects the numbers... I would like to have 3 inputs which could show where to write year, month and day.HTML Code:<div id='td'>Your Birth Date</div> <div id='td'> <input class='small_inputas' MAXLENGTH=4 type="text" id='year'> <input class='small_inputas' MAXLENGTH=2 type="text" id='month'> <input class='small_inputas' MAXLENGTH=2 type="text" id='day'> <div id="date2"></div> </div>
As an example would Paypal.com website register page.
All suggestions are welcome... Thanks.



Reply With Quote



Bookmarks