Mighty Mike Posted April 26, 2005 Share Posted April 26, 2005 Hi All, What i would like to do is apply an age restriction to the create_account file where nobody under the age of X can create an account. Has anybody done this on their site as yet or have any idea how it would be done. I had a look in the contribs area but could not find anything. I assume it would be similar to what the other checks are doing but would need to work out the current date less x number of years. Any ideas or pointers would be great. :thumbsup: Thanks Mike Link to comment Share on other sites More sharing options...
FalseDawn Posted April 26, 2005 Share Posted April 26, 2005 Don't waste your time. What's to stop anyone lying about their age? Link to comment Share on other sites More sharing options...
Guest Posted April 26, 2005 Share Posted April 26, 2005 In create_account.php find this code: if (ACCOUNT_DOB == 'true') { if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) { $error = true; $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR); } } ...change it to this: if (ACCOUNT_DOB == 'true') { if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) { $error = true; $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR); } // Change the cutoff to whatever number you want $age_cutoff = 35; $age_cutoff_timestamp = mktime(0, 0, 0, date("m"), date("d"), date("Y")-$age_cutoff); $age_timestamp = strtotime($dob); $too_young = $age_timestamp > $age_cutoff_timestamp ? true : false; if ( $too_young ){ $error = true; $messageStack->add('create_account', 'You must be '.$age_cutoff.' years old to register.'); } # end age check } Bobby Link to comment Share on other sites More sharing options...
Mighty Mike Posted April 26, 2005 Author Share Posted April 26, 2005 I understand what you are saying, but i dont really care if they lie about their age. There is nothing i can do to stop them, except pop around their house and ask for a copy of their birth certificate. LOL Its just for legal reason's, i can get fined for supplying goods to underage people. I can easily put on the create account file "you must be 18 years or over to apply" but just thought it would be a nice feature to have. I also have it stated on my terms. Maybe you are right, and i dont really need it.. but it would be nice to have. Link to comment Share on other sites More sharing options...
Mighty Mike Posted April 26, 2005 Author Share Posted April 26, 2005 Ahhh.. just as i was typing, Bobby comes to the rescue. I wil give it a go l8r. Thanks Alot :thumbsup: Cheers Link to comment Share on other sites More sharing options...
Guest Posted April 26, 2005 Share Posted April 26, 2005 ...coded, tested, and verified functional on my development server. Enjoy! Bobby Link to comment Share on other sites More sharing options...
Mighty Mike Posted April 26, 2005 Author Share Posted April 26, 2005 ...coded, tested, and verified functional on my development server. Enjoy! Bobby <{POST_SNAPBACK}> Hi Bobby Thanks very much for your solution to my wee problem. Works like a dream :thumbsup: Mike :D Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.