Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Age-check with an email verification javascript? for simple htm

    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">&nbsp;</p>
    <p align="center"><a class="tools" href="mailto:name@domain.com?subject=&lt;&lt;&lt;Members_Question&gt;&gt;&gt;"><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.

  • #2
    New Coder
    Join Date
    Jul 2006
    Location
    California
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Kinda like this? (I havn't checked it, so don't depend on it)
    Code:
    <script language="javascript" type="text/javascript">
    	<!-- "hide" code in case someone is liveing in the stone age...
    		function validate() {
    			//Shorthand vars
    			var year = parseInt(document.forms["verification"]["year"].value);
    			var month = parseInt(document.forms["verification"]["month"].value) - 1;
    			var day = parseInt(document.forms["verification"]["day"].value);
    			//Date stuff
    			var date1 = new Date((year + 18), month, day); //Change 18 to the min age
    			var now = new Date;
    			//Are they old enough?
    			if ( (today.getTime() - theirDate.getTime()) < 0) {
    				//*boot* too younge, kiddo!
    				document.location="http://www.google.com";
    			} else {
    				//They are old enough,  but is the email there? (not advanced checking)
    				if ( document.forms["verification"]["email"] == "" ) {
    					//No email!
    					alert("You forgot to enter your email.");
    				} else {
    					//All seems OK...
    					document.location="http://www.xxx.xxx/xxx.xxx"; //move to the welcome page
    				}
    			}
    		}
    	-->
    </script>
    <p>Please enter your age and email:</p>
    <form name="verification" method="post" onsubmit="validate()" action="">
    	<p>Month:
    	<select name="month">
    		<option selected="selected">1</option>
    		<option>2</option>
    		<option>3</option>
    		<option>4</option>
    		<option>5</option>
    		<option>6</option>
    		<option>7</option>
    		<option>8</option>
    		<option>9</option>
    		<option>10</option>
    		<option>11</option>
    		<option>12</option>
    	</select><br />
    	Day:
    	<select name="day">
    		<option selected="selected">1</option>
    		<option>2</option>
    		<option>3</option>
    		<option>4</option>
    		<option>5</option>
    		<option>6</option>
    		<option>7</option>
    		<option>8</option>
    		<option>9</option>
    		<option>10</option>
    		<option>11</option>
    		<option>12</option>
    		<option>13</option>
    		<option>14</option>
    		<option>15</option>
    		<option>16</option>
    		<option>17</option>
    		<option>18</option>
    		<option>19</option>
    		<option>20</option>
    		<option>21</option>
    		<option>22</option>
    		<option>23</option>
    		<option>24</option>
    		<option>25</option>
    		<option>26</option>
    		<option>27</option>
    		<option>28</option>
    		<option>29</option>
    		<option>30</option>
    		<option>31</option>
    	</select><br />
    	Year:
    	<input type="text" name="year" size="4" maxlength="4" /></p>
    	<input type="checkbox" name="remember" value="1" checked />
    		<small>Don't ask me again</small><br />
    	<input type="text" name="email" size="35" maxlength="35" /><br />
    	<input type="submit" name="submit" value="Verify" />
    </form>
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rich Cook

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok thanks Lordrea
    I will try this script thanks again and happy fourth of july

  • #4
    New Coder
    Join Date
    Jul 2006
    Location
    California
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No problem, and good luck.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rich Cook

  • #5
    New Coder
    Join Date
    Jun 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no go all it does now is refresh the webpage and I have an caution icon done with errors thanks any way if you get it working let me know and again thanks

  • #6
    New Coder
    Join Date
    Jun 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok how about this:
    you have to have the month, day and year correct to date to verify age 18 or older that part should work and even though the email is bogus (doesn't really verify that it's a real email address), they have to fill it out before they can go.
    so if ther b-date say's there 18 and older if they don't fill in the email address it becomes return= false & it pop's up and say's email address required

    if ther b-date say's there under 18 if they do fill in the email address it becomes return= false & it pop's up and say's your not old enough and redirect them to the non adult site (& (would be cool it also had there ip address and stated that there ip address has been detain for future refference (not a must though))

    if ther b-date say's there 18 and older if they do fill in the email address it becomes return= true & goes to my web page

    what would be cool is in the 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.');
    it also had there ip address and stated that there ip address has been detain for future refference to trick them to be scared if they are lying lol
    ok well that's all i got thanks in advance.
    Last edited by Chozin; 07-05-2006 at 09:32 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •