The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
register_verify_age.php cookie drop - I can't make this work
I was trying to make a cookie drop when people enter their age so that they can't go back and change it to be older than 13 (as my boards are locked to under 13) but no matter what I do, I just can't get this to work.
Is there anyone who can figure out where I'm going wrong? Code:
<script type="text/javascript"> <!-- if(document.cookie.indexOf("underage")>=0){location.href="http://www.mysite.com";} function checkform(formobj) { var dob=new Date(); var date=dob.getDate(); var varmonth=dob.getMonth()+1; var varyear=dob.getYear(); year+=(year<2006)?1900:0; var month=parseInt(document.TermsandConditions.month.options[document.TermsandConditions.month.selectedIndex].value); var day=parseInt(document.TermsandConditions.day.options[document.TermsandConditions.day.selectedIndex].value); var year=parseInt(document.TermsandConditions.year.options[document.TermsandConditions.year.selectedIndex].value); age=year-cmbyear; if(month>varmonth){age--;} else if(month==varmonth && day>date){age--;} if(month==0){alert("You must enter the month you were born in.");return false;} else if(day==0){alert("You must enter the date you were born on.");return false;} else if((day>29 && month==2) || (day>30 && month==4) || (day>30 && month==6) || (day>30 && month==9) || (day>30 && month==11)){alert("That is an invalid date.");return false;} else if(year==2006){alert("You must enter the year you were born in.");return false;} else if(day>28 && month==2 && year/4==Math.round(cmbyear/4)){alert("That is an invalid date.");return false;} else if(age<13){ alert("You are too young to enter these forums."+age); document.cookie="underage=yes;expires="+new Date(new Date().getTime() + 4320*3600).toGMTString(); location.replace("http://www.mysite.com/"); return false;} else if(!document.TermsandConditions.agree.checked){alert('Check the Proceed box to enter this site.');return false;} else{return true;} } // --> </script> </head> <body> $header <br /> <br /> <form method="post" action="register.php" onsubmit="return checkform(this)"> <input type="hidden" name="do" value="checkdate" /> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="url" value="$url" /> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="70%" align="center"> <tr> <td class="tcat"><phrase 1="$vboptions[bbtitle]">$vbphrase[register_at_x]</phrase></td> </tr> <tr> <td class="panelsurround" align="center"> <div class="panel"> <div style="width:70%" align="$stylevar[left]"> <fieldset class="fieldset"> <legend>$vbphrase[please_enter_your_date_of_birth]</legend> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" align="center" width="100%"> <tr> <td> $vbphrase[month]:<br /> <select name="month"> <option value="" selected="selected">-</option> <option value="01">$vbphrase[january]</option> <option value="02">$vbphrase[february]</option> <option value="03">$vbphrase[march]</option> <option value="04">$vbphrase[april]</option> <option value="05">$vbphrase[may]</option> <option value="06">$vbphrase[june]</option> <option value="07">$vbphrase[july]</option> <option value="08">$vbphrase[august]</option> <option value="09">$vbphrase[september]</option> <option value="10">$vbphrase[october]</option> <option value="11">$vbphrase[november]</option> <option value="12">$vbphrase[december]</option> </select> </td> <td> $vbphrase[day]:<br /> <select name="day"> <option value="" selected="selected">-</option> <option value="01">1</option> <option value="02">2</option> <option value="03">3</option> <option value="04">4</option> <option value="05">5</option> <option value="06">6</option> <option value="07">7</option> <option value="08">8</option> <option value="09">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> </td> <td> $vbphrase[year]:<br /> <input type="text" class="bginput" name="year" size="10" maxlength="4" value="" /> </td> </tr> </table> </fieldset> </div> </div> <div style="margin-top:$stylevar[cellpadding]px"> <input type="submit" class="button" value="$vbphrase[proceed]" accesskey="s" /> |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|