Current location: Hot Scripts Forums » Programming Languages » PHP » Date of Birth validation for registration


Date of Birth validation for registration

Reply
  #1 (permalink)  
Old 01-22-12, 06:40 PM
dsflyerds dsflyerds is offline
New Member
 
Join Date: Oct 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Date of Birth validation for registration

I am working on a registration page for a website I am designing. I would like the form to check the birthrate and send people who are over 13 to complete the registration and people who are under the age of 13 taken to a page where there are instructions on what to do. Is there a way to do this?
Here is my scirpt that i have so far
PHP Code:

 <?php

echo "<h1>Register</h1>";

$submit $_POST['submit'];

$firstname strip_tags($_POST['firstname']);
$lastname strip_tags($_POST['lastname']);
$username strip_tags($_POST['username']);
$password strip_tags($_POST['password']);
$repeatpassword strip_tags($_POST['repeatpassword']);
$birthdate strip_tags($_POST['birthdate']);
$gamespyid strip_tags($_POST['gamespyid']);
$base strip_tags($_POST['base']);
$date date ("Y-m-d");
if (
$submit)
{

 
//check for existance
    
if($firstname&&$lastname&&$username&&$password&&$repeatpassword&&$birthdate&&       $gamespyid&&$base)
    {

        if (
$password==$repeatpassword)
        {
        
//check legths of other fields
        
if(strlen($firstname)>25||strlen($lastname)>25||strlen($username)>25||               strlen($gamespyid)>25)
        {
        echo 
"Max limit for First name, Last name, and username is 25                        characters";
        }
         else
        {
        
//password legnth
        
if (strlen($password)>25||strlen($password)<6)
        {
         echo 
"Password must be between 6 and 25 characters!";
        }
        else
        {
        
//register
        //encryptions of passwords
        
$password md5($password);
        
$repeatpassword md5($repeatpassword);
         echo 
"Success!";
        
//open db<br>
        
$connect mysql_connect("localhost","*********","*******") or die ("Couldn't Connect"); //host,username,               password
        
mysql_select_db("**************") or die ("Could not find database");

        
$queryreg mysql_query("

        INSERT INTO Users VALUES('','
$username','$password','$firstname','$lastname','$date','$gamespyid','$base','$birthdate','')
        "
);
        die (
"Your have been registered!<a href='../index.php'>Home</a>");
        }
        }

        }
        else
            echo 
"Your passowrds do not match!";
    }
    else
        echo 
"Please fill in all fields!";

}
//if($submit)
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
date / time validation mcrob PHP 13 04-23-08 10:06 PM
Data validation code needed for MS Access Harlequin Job Offers & Assistance 1 11-29-07 10:53 AM
converting date-string to Date object UnrealEd Everything Java 4 05-15-07 07:20 PM
date validation sharad JavaScript 0 09-21-04 10:39 AM


All times are GMT -5. The time now is 01:30 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.