Age Restrictions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 17

Age Restrictions

How to make a website age restricted using PHP

3rd Jul 2020, 9:02 PM
Ndeanaefo Chidalu
Ndeanaefo Chidalu - avatar
14 Answers
+ 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.
3rd Jul 2020, 9:15 PM
A͢J
A͢J - avatar
+ 11
AJ Anant I am still a beginner
3rd Jul 2020, 9:20 PM
Ndeanaefo Chidalu
Ndeanaefo Chidalu - avatar
+ 11
Thanks for the answer AJ Anant
3rd Jul 2020, 9:29 PM
Ndeanaefo Chidalu
Ndeanaefo Chidalu - avatar
+ 10
it is a form for logging in
4th Jul 2020, 9:45 AM
Ndeanaefo Chidalu
Ndeanaefo Chidalu - avatar
3rd Jul 2020, 9:25 PM
A͢J
A͢J - avatar
+ 6
Bhavya How using cookies?
4th Jul 2020, 6:18 AM
A͢J
A͢J - avatar
+ 6
Cood question, Thanks AJ Anant, beginners really need skilled members explanation
5th Jul 2020, 7:07 AM
Sherzodbek Rahmatov
Sherzodbek Rahmatov - avatar
+ 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.
4th Jul 2020, 10:23 AM
A͢J
A͢J - avatar
+ 4
You can put a checkbox asking if user is above specific age when signing up then
4th Jul 2020, 9:46 AM
Bhavya
Bhavya - avatar
+ 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.
4th Jul 2020, 10:37 AM
A͢J
A͢J - avatar
+ 3
Using cookies
3rd Jul 2020, 10:37 PM
Bhavya
Bhavya - avatar
+ 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
4th Jul 2020, 9:12 AM
Bhavya
Bhavya - avatar
+ 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?
4th Jul 2020, 10:28 AM
Bhavya
Bhavya - avatar
+ 1
You should google it for more detailed information.
4th Jul 2020, 4:12 PM
Sofia7847