Name
Name shold be alphanets";
$tipsPassword="Password
Only alpha numeric(A-Z a-Z 0-9)
4-25 characters are allowed";
$tipsEmail="Email
Email id will be used as a user name";
$tipsCaptcha="Security Code[CAPTCHA]
The FOUR DIGIT COLOR number";
//------------------------------PROCESSING FORM DATAS FOLLOWS-----------------------//
if($_POST['submit']=="Submit"){
if(isset($_POST['seccode'])) $seccode=strip_tags($_POST['seccode']); else $seccode="";
$img = new Securimage();
$validSecurityCode = $img->check($seccode);
$err_msg.=validateDatas($_POST);
if($validSecurityCode != true) $err_msg.=" CAPTCHA, ";
if(isset($_POST['member_name'])) $member_name=$_POST['member_name'];
if(isset($_POST['age'])) $age=$_POST['age'];
if(isset($_POST['height'])) $height=$_POST['height'];
if(isset($_POST['gender'])) $gender=$_POST['gender'];
if(isset($_POST['marital_status'])) $marital_status=$_POST['marital_status'];
if(isset($_POST['mother_tongue'])) $mother_tongue=$_POST['mother_tongue'];
if(isset($_POST['education'])) $education=$_POST['education'];
if(isset($_POST['occupation'])) $occupation=$_POST['occupation'];
if(isset($_POST['email'])) $email=$_POST['email'];
if(isset($_POST['password'])) $password=$_POST['password'];
if(isset($_POST['password_confirm'])) $password_confirm=$_POST['password_confirm'];
if(isset($_POST['profile_created'])) $profile_created=$_POST['profile_created'];
$profile_created_date=date("y-m-d h-i-s");
$ip_address=$_SERVER['REMOTE_ADDR'];
$err_msg.=validSpecialDatas($password,$password_confirm); //if false error message will be returned
if(!isEmailExist($email)){
if($err_msg=="" && $validSecurityCode == true){
$qry="INSERT INTO tbl_member(member_name,age,height,gender,marital_status,mother_tongue,education,occupation,email,password,profile_created_date,profile_created_ip,profile_created)
values('$member_name',$age,$height,$gender,$marital_status,$mother_tongue,$education,$occupation,'$email','$password','$profile_created_date','$ip_address',$profile_created)";
//echo $qry;
if(mysql_query($qry)){
header("Location:member_registration_success.jsp?email=$email");
$err_msg="Done successfully";
}else{
$err_msg="Error in executing query";
}
}
}else{
$err_msg="Email already exist Click here Login - Forget password";
}
}//if form is submited
//------------------------------FUNCTION DEFINITION-----------------------//
function validateDatas($_POST2){
$err_msg="";
foreach($_POST2 as $fieldName=>$value){
if($value=="") $err_msg.="$fieldName, ";
}
return $err_msg;
}
function isEmailExist($email){
$qry="SELECT email FROM tbl_member WHERE email='$email'";
$rs=mysql_query($qry);
if(mysql_num_rows($rs)>0) return TRUE ; else return FALSE;
}
function validSpecialDatas($password,$password_confirm){
$errMsg="";
if($password!=$password_confirm) $errMsg=" Password, ";
return $errMsg;
}
//------------------------PHP MAIN CODE ENDED VIEW LAYER PHP CODE MAY FOLLOWED-----------------//
?>