+ 17
Age Restrictions
How to make a website age restricted using PHP
14 ответов
+ 13
Ndeanaefo Chidalu It's a simple things just compare the birthday year with current year. If difference is greater than restricted age then do not allow to register.
+ 11
AJ Anant I am still a beginner
+ 11
Thanks for the answer AJ Anant
+ 10
it is a form for logging in
+ 8
Ndeanaefo Chidalu You can go through this link to know how to get difference between two dates
https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-calculate-the-difference-between-two-dates-in-php/amp/
+ 6
Bhavya How using cookies?
+ 6
Cood question, Thanks AJ Anant, beginners really need skilled members explanation
+ 5
Bhavya To store in cookies first we should know about the the DOB of the user. How will you store in cookies without knowing the DOB. Without making form or DOB provided by the user we can't get what is the DOB of the User.
BTW Ndeanaefo Chidalu was asking at the time of sign up so there is no need of cookies because it's a 1 time activity. @Chidalu you should mention with question.
We can check the age restriction on server side after asking DOB by the user.
+ 4
You can put a checkbox asking if user is above specific age when signing up then
+ 4
Bhavya Cookies can be destroy so obviously we need to ask dob. Btw his question is about at the time of Sign Up.
He wrongly mentioned loggin time and I don't think we need to ask every time on login because if user is already registered then why we need dob at the time of login. We can see the example of Gmail and Facebook.
+ 3
Using cookies
+ 3
How else will you know if the user is above some age without storing it in a cookie, or session unless you are making them sign up and login AJ Anant - C#/Java Challenger
+ 3
AJ Anant - C#/Java Challenger its pretty obvious you need to ask for dob so i didn't mention it. Anyway how exactly will you restrict access to website without storing that information anywhere. Will you just ask for dob everytime the user visits the page?
+ 1
You should google it for more detailed information.