Jump to content

[SOLVED] if statement help


darkfreaks

Recommended Posts

need help with modding my statement.

 

so it is

 

<?php if($age<18) { echo "You can not add this user for security reasons";}?>

 

but i also want it to search the user who is trying to add te under age user and get there age and if they are above 18 to not allow them to add that user but i still want other teenagers below 18 to still be able to add each other.

Link to comment
Share on other sites

I don't see why you had to go and create a second topic on this.  But...

 

The logic you want is:  If both users are under 18 OR both users are 18 and over Then they can add each other.

 

if($age1 < 18 && $age2 < 18 || $age1 >= 18 && $age2 >= 18){
  // then add
}else{
  // fail
}

 

But I don't see this is a very realistic solution.  Why should a 17 year old not be able to add an 18 year old (assuming this is a facebook or myspace type site)?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.