Age Verification Script

Reply

Join Date: Apr 2007
Posts: 2
Reputation: Duke Nukem is an unknown quantity at this point 
Solved Threads: 0
Duke Nukem Duke Nukem is offline Offline
Newbie Poster

Age Verification Script

 
0
  #1
Apr 10th, 2007
Duke SNIPPED Nukem will only allow 18 and above on his site. It seems like my html page is correct and my php is the problem. Anyone have any answers they would like to share with me? MAY JUSTICE REIGN SUPREME!!!!!





  1. <?php
  2. $month = $_REQUEST['bmonth'];
  3. $day = $_REQUEST['day'];
  4. $year = $_REQUEST['year'];
  5. $this_day = date(d);
  6. $this_month = date(m);
  7. $this_year = date(Y);
  8. $day_val = $this_day - $day;
  9. $month_val = $this_month - $month;
  10. $year_val = $this_year - $year;
  11. if($year_val >= 19) {
  12. header('Location: <a rel="nofollow" class="t" href="http://www.URL.com/Tour/Tour1.html'" target="_blank">http://www.URL.com/Tour/Tour1.html'</a>);
  13. }
  14. if($month_val >= 0) {
  15. header('Location: <a rel="nofollow" class="t" href="http://www.URL.com/Tour/Tour1.html'" target="_blank">http://www.URL.com/Tour/Tour1.html'</a>);
  16. }
  17. if($day_val >= 0) {
  18. header('Location: <a rel="nofollow" class="t" href="http://www.URL.com/Tour/Tour1.html'" target="_blank">http://www.URL.com/Tour/Tour1.html'</a>);
  19.  
  20. } else {
  21. header('Location: <a rel="nofollow" class="t" href="http://www.URL.com/notvalidbday.html'" target="_blank">http://www.URL.com/notvalidbday.html'</a>);
  22. }
  23. ?>




Last edited by happygeek; Aug 2nd, 2009 at 2:42 pm. Reason: removed vulgarities, snipped adult url
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 160
Reputation: w_3rabi is an unknown quantity at this point 
Solved Threads: 9
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: Age Verification Script

 
0
  #2
Apr 10th, 2007
dude you should remove the three conditions and put em in one condition so the code should look something like this

  1. <?php
  2. $month = $_REQUEST['bmonth'];
  3. $day = $_REQUEST['day'];
  4. $year = $_REQUEST['year'];
  5. $this_day = date(d);
  6. $this_month = date(m);
  7. $this_year = date(Y);
  8. $day_val = $this_day - $day;
  9. $month_val = $this_month - $month;
  10. $year_val = $this_year - $year;
  11. if($year_val >= 19&&$month_val >= 0&&$day_val >= 0) {
  12. header('Location: http://www.URL.com/Tour/Tour1.html');
  13. }
  14. else {
  15. header('Location: http://www.URL.com/notvalidbday.html');
  16. }
  17.  
  18. ?>
Last edited by happygeek; Aug 2nd, 2009 at 2:42 pm. Reason: snipped adult URLs in code
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 2
Reputation: Duke Nukem is an unknown quantity at this point 
Solved Threads: 0
Duke Nukem Duke Nukem is offline Offline
Newbie Poster

Re: Age Verification Script

 
0
  #3
Apr 11th, 2007
Nice!!! Thanks for the help!
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 160
Reputation: w_3rabi is an unknown quantity at this point 
Solved Threads: 9
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: Age Verification Script

 
0
  #4
Apr 11th, 2007
no problem man
take care
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 2
Reputation: 14music is an unknown quantity at this point 
Solved Threads: 0
14music 14music is offline Offline
Newbie Poster

Re: Age Verification Script

 
0
  #5
Aug 2nd, 2009
This script doesn't work! Calculation is off beat
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 160
Reputation: w_3rabi is an unknown quantity at this point 
Solved Threads: 9
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: Age Verification Script

 
0
  #6
Aug 2nd, 2009
try this one
  1. <?php
  2. $allowed_age = 19;
  3. $bdate = strtotime($_REQUEST['y'].'-'.$_REQUEST['m']."-".$_REQUEST['d']);
  4. $age = (time()-$bdate)/31536000;
  5. if($age >= $allowed_age) {
  6. header('Location: http://www.URL.com/Tour/Tour1.html');
  7. exit;
  8. }
  9. else {
  10. header('Location: http://www.URL.com/notvalidbday.html');
  11. exit;
  12. }
  13. ?>
Last edited by happygeek; Aug 2nd, 2009 at 2:43 pm. Reason: Snipped adult URL in code
programming is an art ,only for those who can understand it.
- th3 php wr3nch -
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 2
Reputation: 14music is an unknown quantity at this point 
Solved Threads: 0
14music 14music is offline Offline
Newbie Poster

Re: Age Verification Script

 
0
  #7
Aug 2nd, 2009
Redirect problem
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 7529 | Replies: 6
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC