age check for pages

Started on the old forum in April 2010 · view the original in the archive · old links redirect here

10 replies · 749 views · started 16 years ago · 1 min read

6 participants
brand Senior · 391 posts #1

can some one help me and tell me where i have gone wrong on this please

<?php
$age = 16; /*Required Age*/$date = getdate();
$year = $date['year'];
/*Assuming $_POST['YearOfBirth'] is the year of birth specified by the user*/if ($year – $_POST['YearOfBirth'] >= $age){ /* Redirect to your homepage */header("Location: http://yourdomain.com/index.php"); /*Change http://yourdomain.com/index.php to your home page*//*
}else{die("you can not access this part"); 
}
?>

i am trying to get it to work on lava script

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

brand Senior · 391 posts #3

i want it so it takes me back to the main page if they are under 18 and if there over 18 it takes them to the page they want to go to

 this is also the error i get as well

Parse error: syntax error, unexpected T_STRING in /home/********/public_html/malex/index.php on line 211

the error is on this line

if ($year – $_POST['YearOfBirth'] >= $age){

have i done some thing wrong ppl

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

subzero Super moderator Fellow · 3,954 posts #4
agelimit();
function getage($birthdate) 
{ 
   list($day, $month, $year) = split('-',  $birthdate); 
              $tmonth = date('n'); 
              $tday = date('j'); 
              $tyear = date('Y'); 
              $years = $tyear - $year; 
              if ($tmonth <= $month) 
              { 
              if ($month == $tmonth) 
              { 
              if ($day > $tday)$years--; 
               } 
               else $years--; 
               } 

           return $years; 
} 
function agelimit($text)
{
$age = mysql_fetch_array(mysql_query("SELECT age FROM YOURBASE WHERE id='".$id." ' "));
echo mysql_error();
$isage = getage($age[0]);
if($isage<18)
{
        echo "<br/>You have to be 18+ to view this place.<br/>";
}
}

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

brand Senior · 391 posts #5

subzero wrote:

agelimit();
function getage($birthdate) 
{ 
   list($day, $month, $year) = split('-',  $birthdate); 
              $tmonth = date('n'); 
              $tday = date('j'); 
              $tyear = date('Y'); 
              $years = $tyear - $year; 
              if ($tmonth <= $month) 
              { 
              if ($month == $tmonth) 
              { 
              if ($day > $tday)$years--; 
               } 
               else $years--; 
               } 

           return $years; 
} 
function agelimit($text)
{
$age = mysql_fetch_array(mysql_query("SELECT age FROM YOURBASE WHERE id='".$id." ' "));
echo mysql_error();
$isage = getage($age[0]);
if($isage<18)
{
        echo "<br/>You have to be 18+ to view this place.<br/>";
}
}

thanks sub but where do i put all this i am trying to put it on my galley/index.php page for malex and femalex

HELP THEM WHO HELPS YOU

External image (may be gone)

i only work on wapdesire v_2 coding only

subzero Super moderator Fellow · 3,954 posts #6

Well use this if($isadult == "yes"); { echo agelimit(); }else{ Your content here for adults only... }

As seen on chat4u.mobi 🙂

fourms / downloads / gallery / chat has adult now they are blocked...

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

mahejabeen Newbie · 1 posts #7

just try it now

$age = 16; /Required Age/$date = getdate(); $year = $date['year']; $_POST['YearOfBirth'] if ($year – $_POST['YearOfBirth'] >= $age) { header("Location: http://yourdomain.com/index.php"); } else { die("you can not access this part"); } ?>

woody Developer · 176 posts #8

or just dont allow minors on your site, they're only gonna get to that page and then go and change their age in the settings lol so i'd suggest no minors or no adult content

subzero Super moderator Fellow · 3,954 posts #9

+++100 ++++ for woody !!

Well said...

but how they will change name on my site when i dont let users edit there bday once they enter thats it lol

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

ksg91 Developer · 162 posts #10

try this one

<?php
$age = 16; /*Required Age*/
$date = getdate();
$year = $date['year'];
/*Assuming $_POST['YearOfBirth'] is the year of birth specified by the user*/
$yob=$_POST['YearOfBirth'];
if ($year – $yob >= $age){ 
/* Redirect to your homepage */
header("Location: http://yourdomain.com/index.php"); 
/*Change http://yourdomain.com/index.php to your home page*/
}
else{
die("you can not access this part"); 
}
?>

Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

amylee Principal · 1,092 posts #11

lol only way to truely block people under 18 is to use credit card authorization upon signing up, but thats a big no no on wap or if your really anal about it request photo id and ****, but that's the gay way

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close