Chozin
07-04-2006, 10:52 PM
Chozin here,
does any one here that can help me with a simple java script i can use, that
ask for your b-date and an email address then if both are ok then it let's you enter, if age does'nt match the criteria or the e-mail doesn't verify then it returns to the page again but if they try three time it redirect to another website with out adult content that i made. this is what i got but when i try to merge them i get error. first age-check and Email-verification
age-check
age-check.js:
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
};
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
};
if ( readCookie('OVER_18') != 'yes' )
{
var over_18 = confirm('You are about to view adult sexlife, which includes some products ' +
'intended for adults. You must be 18 or 21 years old (depending on your location) to ' +
'view the site. Click OK to indicate you are of legal age, and are not offended by ' +
'adult products. To be redirected to Kids life, our general site, click Cancel.');
if ( over_18 )
{
createCookie( 'OVER_18', 'yes' );
} else {
window.location = '/-18_index.html';
}; };
age-check.html:
<form action="" method="post">
<select name="dob_month" tabindex="1">
<option value="01" selected="selected">Jan</option>
<option value="02">Feb</option>
<option value="03">Mar</option>
<option value="04">Apr</option>
<option value="05">May</option>
<option value="06">Jun</option>
<option value="07">Jul</option>
<option value="08">Aug</option>
<option value="09">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
<input type="text" name="dob_day" value="dd" size="2" maxlength="2" tabindex="2" onfocus="if(this.value=='dd')this.value='';" onblur="if(this.value=='')this.value='dd';" />
<input type="text" name="dob_year" value="year" size="4" maxlength="4" tabindex="3" onfocus="if(this.value=='year')this.value='';" onblur="if(this.value=='')this.value='year';" />
<br /><br />
<input type="checkbox" name="remember" value="1" checked />
<small>Don't ask me again</small>
<br /><br />
<input type="submit" name="dob_submit" value="Click to submit your electronic signature" tabindex="4" />
</form>
<p class="disclaimer">
Access by minors is strictly forbidden. If you are a minor or are not interested in our adult products, please go to our non-adult website, <a href="/index.html">Kids life</a> website.
</p>
now i got this Email Verify:
<script language="javascript">
function Submitform()
{
if (document.sub.addr.value=='') alert("Invalid Email Address");
else {
if ( ((document.sub.addr.value.indexOf('@',1))==-1)||(document.sub.addr.value.indexOf('.',1))==-1 )
alert("Invalid Email Address");
else document.sub.submit();
}
}
</script>
html:
<td width="50%" align="center" bgcolor="#9F0018">
<p><font face="Verdana" size="2" color="#FFFFFF"><b>Enter your Email Address</b></font></p>
<form action="" method="POST">
<input type="text" name="addr" maxlength="250" size="30">
<input type="hidden" name="type" value="inscription">
<input type="submit" value="Go !" onclick=Submitform()>
</form>
<p align="center"> </p>
<p align="center"><a class="tools" href="mailto:name@domain.com?subject=<<<Members_Question>>>"><b><font face="Arial" color="#FFFF00" size="5">E-mail Support</font></b></a></p>
is there a way i can merge these to so that the submit depends on both the b-date and email with only 1 type of submit
thanks in advance.
does any one here that can help me with a simple java script i can use, that
ask for your b-date and an email address then if both are ok then it let's you enter, if age does'nt match the criteria or the e-mail doesn't verify then it returns to the page again but if they try three time it redirect to another website with out adult content that i made. this is what i got but when i try to merge them i get error. first age-check and Email-verification
age-check
age-check.js:
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
};
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
};
if ( readCookie('OVER_18') != 'yes' )
{
var over_18 = confirm('You are about to view adult sexlife, which includes some products ' +
'intended for adults. You must be 18 or 21 years old (depending on your location) to ' +
'view the site. Click OK to indicate you are of legal age, and are not offended by ' +
'adult products. To be redirected to Kids life, our general site, click Cancel.');
if ( over_18 )
{
createCookie( 'OVER_18', 'yes' );
} else {
window.location = '/-18_index.html';
}; };
age-check.html:
<form action="" method="post">
<select name="dob_month" tabindex="1">
<option value="01" selected="selected">Jan</option>
<option value="02">Feb</option>
<option value="03">Mar</option>
<option value="04">Apr</option>
<option value="05">May</option>
<option value="06">Jun</option>
<option value="07">Jul</option>
<option value="08">Aug</option>
<option value="09">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
<input type="text" name="dob_day" value="dd" size="2" maxlength="2" tabindex="2" onfocus="if(this.value=='dd')this.value='';" onblur="if(this.value=='')this.value='dd';" />
<input type="text" name="dob_year" value="year" size="4" maxlength="4" tabindex="3" onfocus="if(this.value=='year')this.value='';" onblur="if(this.value=='')this.value='year';" />
<br /><br />
<input type="checkbox" name="remember" value="1" checked />
<small>Don't ask me again</small>
<br /><br />
<input type="submit" name="dob_submit" value="Click to submit your electronic signature" tabindex="4" />
</form>
<p class="disclaimer">
Access by minors is strictly forbidden. If you are a minor or are not interested in our adult products, please go to our non-adult website, <a href="/index.html">Kids life</a> website.
</p>
now i got this Email Verify:
<script language="javascript">
function Submitform()
{
if (document.sub.addr.value=='') alert("Invalid Email Address");
else {
if ( ((document.sub.addr.value.indexOf('@',1))==-1)||(document.sub.addr.value.indexOf('.',1))==-1 )
alert("Invalid Email Address");
else document.sub.submit();
}
}
</script>
html:
<td width="50%" align="center" bgcolor="#9F0018">
<p><font face="Verdana" size="2" color="#FFFFFF"><b>Enter your Email Address</b></font></p>
<form action="" method="POST">
<input type="text" name="addr" maxlength="250" size="30">
<input type="hidden" name="type" value="inscription">
<input type="submit" value="Go !" onclick=Submitform()>
</form>
<p align="center"> </p>
<p align="center"><a class="tools" href="mailto:name@domain.com?subject=<<<Members_Question>>>"><b><font face="Arial" color="#FFFF00" size="5">E-mail Support</font></b></a></p>
is there a way i can merge these to so that the submit depends on both the b-date and email with only 1 type of submit
thanks in advance.