JezK
Edit File: franchise_registration.php
<?php //error_reporting(0); include "app/useraccess.php"; $userobj=new user(); /*if($_SESSION['uid']!='') { header('Location: profile.php'); }*/ //var_dump($_POST); if(isset($_POST['firstName'])) { //echo 'ok'; $franchise_name=trim($_POST['firstName']); $franchise_mobile=trim($_POST['phone']); $franchise_password=trim($_POST['password']); $franchise_email=trim($_POST['email']); $otp=trim($_POST['otp']); $op=$userobj->franchiseRegistration($franchise_name,$franchise_email,$franchise_mobile,$franchise_password,$otp); if($op) { $userID = $op['userID']; $OTP = $op['OTP']; //sending SMS $numbers = array("91".$phone); $type = 1; //sendOTP include("send.php"); echo "<script>alert('You have registered successfully. Your account need to be approved by admin..');</script>"; echo '<script>location.replace("franchise/index");</script>'; } else { echo "<script>alert('Try again,error occured');</script>"; } }?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Rural2Global Matrimonial</title> <link rel="icon" type="img/png" href="img/favicon-32x32.png" sizes="32x32" /> <link rel="icon" type="img/png" href="img/favicon-16x16.png" sizes="16x16" /> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <link href="css/media.css" rel="stylesheet"> </head> <body> <div class="bgimg"> <?php include("innerbanner.php");?> <!-- <img src="img/bg1.jpg" style="width: 100%; height: 100%;" class="fxdBg"> --> <div class="layerTop"> <div class="container"> <div class="row"> <!-- logo cntr--> <div class="col-sm-2 col-xs-12"> <div class="logo"> <a href='index.php'><img src="img/logo.png"> </a></div> </div> <!-- logo cntr--> <!-- right cntr--> <div class="col-sm-10 col-xs-12"> <p class="hdng1">fRANCHISE REGISTRATION</p> <div> <div class="form-box"> <div class="regbox"> <!-- registration fields --> <div class="formFixed"> <form class="" method="post" action="" id="Myform"> <section class="myrow"> <div class="textBox153">Name</div> <div class="textBox270 prelative"> <input class="fxdtxtbox other regvalid" name="firstName" id="firstName" type="text" /> <!--onchange="return unName();"--> <span id="rg1" class="errstyl"></span> </div> <div class="textBox153-2 mrgrlft mobileMrgn">E - mail</div> <div class="textBox270-2 prelative"> <input class="fxdtxtbox other" name="email" id="email" type="text" onblur="return validEmail(this.value);"> <br/> <span id="rg4" class="errstyl"></span> <span id="emerror" style="color:#ffc66b!important"></span> </div> <div class="clr "></div> </section> <section class="myrow"> <div class="textBox153">Mobile No</div> <div class="textBox270 prelative"> <input class="fxdtxtbox other regvalid" name="phone" id="phone" type="text" max="10" onChange="return validMobile(this.value);"> <span id="rg3" class="errstyl"></span> <span id="phmerror" style="color:#ffc66b"></span> </div> <div class="clr "></div> </section> <section class="myrow"> <div class="textBox153">Password</div> <div class="textBox270 prelative"> <input class="fxdtxtbox other regvalid" name="password" id="password" type="password"> <span id="rg6" class="errstyl"></span> </div> <div class="textBox153-2 mrgrlft mobileMrgn">Confirm Password</div> <div class="textBox270-2 prelative"> <input class="fxdtxtbox other regvalid" name="cpassword" id="cpassword" type="password"> <span id="rg7" class="errstyl"></span> </div> <div class="clr "></div> </section> <section class="myrow"> <div class="textBox153">OTP</div> <div class="textBox270 prelative"> <input class="fxdtxtbox other" name="otp" id="otp" type="text" > <br/> <input type="hidden" name="otpsend" id="otpsend"/> <span id="rg2" class="errstyl"></span> <span id="emerror" style="color:#ffc66b!important"></span> </div> <div class="textBox153-2 mrgrlft mobileMrgn"> <div class="resendOtpBlock"> <input type="button" class="resendOtp" value="Resend OTP" onclick="return validMobile();"> </div> </div> <div class="clr "></div> </section> <div> <input class="greenSubbt" value="Register" type="button" onClick="return validate();" name="registrationSub"> </div> </form> </div> <!-- registrations fields end--> </div> </div> </div> </div> <!-- right cntr--> </div> </div> </div> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <!-- <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> <script type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.min.js"></script> --> <script src="js/bootstrap.min.js"></script> <script type="text/javascript"> <!--Registration Validation start--> $('input[type=text]').blur(function(){ $(this).val($.trim($(this).val())); }); $('input[type=text]').blur(function(){ $("span.error").remove(); if ($("#phone").val().search(/[^0-9- \s]/) != -1) { $("#rg3").html(''); $("#rg3").html('Special Characters Not Allowed'); $("#phone").val(''); $("#phone").focus(); } }); function validate() { var err1 = 0; $("#rg1").html(''); $("#rg2").html(''); $("#rg3").html(''); $("#rg4").html(''); $("#rg6").html(''); $("#rg7").html(''); $("#rg8").html(''); $("#phmerror").html(''); if ($("#firstName").val()== "") { $("#rg1").html(''); $("#rg1").html('Required Field'); err1++; } if ($("#phone").val()== "") { $("#rg3").html(''); $("#rg3").html('Required Field'); err1++; } /*if ($("#email").val()== "") { $("#rg4").html(''); $("#rg4").html('Required Field'); err1++; }*/ if ($("#otp").val()== "") { $("#rg2").html(''); $("#rg2").html('Required Field'); err1++; } if ($("#password").val()== "") { $("#rg6").html(''); $("#rg6").html('Required Field'); err1++; } if ($("#cpassword").val()== "") { $("#rg7").html(''); $("#rg7").html('Required Field'); err1++; } if ($("#firstName").val() != "") { if ($("#firstName").val().search(/[^A-Za-z- \s]/) != -1) { $("#rg1").html(''); $("#rg1").html('Special Characters Not Allowed'); $("#firstName").focus(); err1++; } } /*if ($("#email").val() != "") { if (/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test($("#email").val()) == false) { $("#rg4").html(''); $("#rg4").html('Enter valid email'); $("#email").focus(); err1++; } }*/ if ($("#password").val() != "") { if ($("#password").val().length < 6) { $("#rg6").html(''); $("#rg6").html('Password length must be graterthan 6.'); $("#password").focus(); err1++; } } if ($("#cpassword").val() != "") { if ($("#cpassword").val().length < 6) { $("#rg7").html(''); $("#rg7").html('Password length must be graterthan 6.'); $("#cpassword").focus(); err1++; } } if ($("#password").val() != "" && $("#cpassword").val() != "") { if ($("#password").val() != $("#cpassword").val()) { $("#rg7").html(''); $("#rg7").html('Password Mismatch'); err1++; } } if ($("#otp").val() != "" && $("#otpsend").val() != "") { if ($("#otp").val() != $("#otpsend").val()) { $("#rg2").html(''); $("#rg2").html('Entered OTP is not valid. Please enter a valid OTP.'); err1++; } } if ($("#phone").val() != "") { if ($("#phone").val().search(/[^0-9- \s]/) != -1) { $("#rg3").html(''); $("#rg3").html('Special Characters Not Allowed'); $("#phone").focus(); err1++; } } if ($("#phone").val() != "") { if ($("#phone").val().length > 16 || $("#phone").val().length < 10) { $("#rg3").html(''); $("#rg3").html('Allowed only 10-16 Digits'); $("#phone").focus(); err1++; } } if (err1) { return false; } else { //alert('ok'); document.getElementById("Myform").submit(); // return true; } } function unName() { var frsname1 = $('#firstName').val(); if (frsname1 != '') { var frsname = frsname1.replace(/ /g, "_"); $.ajax({ url: "ajaxcheck", type: "POST", data: "mode=" + "UNAME" + "&frsname=" + frsname, success: function(result) { //alert(result); $("#username").val(''); $("#username").val(result); } }); } } function validEmail(val) { var email = val; $.ajax({ url: "ajaxcheck", type: "POST", data: "mode=" + "ChkfranchiseEmail" + "&email=" + email, success: function(result) { if (result == 1) { $("#emerror").html(''); $("#emerror").html('Email already Exists'); $("#email").focus(); $("#email").val(''); } else { $("#emerror").html(''); } } }); } function validateUserName(usname) { var usname = usname; $("#uemerror").html(''); $.ajax({ url: "ajaxcheck", type: "POST", data: "mode=" + "UsrValidate" + "&usname=" + usname, success: function(result) { if (result == 1) { $("#uemerror").html(''); $("#uemerror").html('Username already Exists'); $("#username").focus(); $("#username").val(''); } } }); } function validMobile(val) { var number = $("#phone").val(); var otpsend = $("#otpsend").val(); err2 = 0; $("#phmerror").html(''); $("#rg3").html(''); if ($("#phone").val()== "") { $("#rg3").html(''); $("#rg3").html('Required Field'); err2++; } if ($("#phone").val() != "") { if ($("#phone").val().search(/[^0-9- \s]/) != -1) { $("#rg3").html(''); $("#rg3").html('Special Characters Not Allowed'); $("#phone").focus(); err2++; } } if ($("#phone").val() != "") { if ($("#phone").val().length > 16 || $("#phone").val().length < 10) { $("#rg3").html(''); $("#rg3").html('Allowed only 10-16 Digits'); $("#phone").focus(); err2++; } } if(err2 == 0) { $.ajax({ url: "ajaxcheck", type: "POST", data: "mode=" + "chkfnNumber" + "&number=" + number, success: function(result) { if (result == 1) { $("#phmerror").html(''); $("#phmerror").html('Phone number already Exists'); $("#phone").focus(); $("#phone").val(''); } else { $.ajax({ url: "ajaxcheck", type: "POST", data: "mode=" + "sendopt" + "&number=" + number+"&otpsend="+otpsend, success: function(result) { if (result) { $("#phmerror").html(''); $("#rg3").html('OTP Send Successfully...'); $("#password").focus(); $("#otpsend").val(result); //$("#phmerror").html(''); } else { $("#phmerror").html(''); } } }); } } }); } } <!--Registration Validation End--> </script> <script type='text/javascript'> //~ $(function() { //~ $('.input-group.date').datepicker({ //~ calendarWeeks: true, //~ todayHighlight: true, //~ autoclose: true, //~ format: 'dd-mm-yyyy' //~ }); //~ }); //~ <!--Age calculation--> function ageCalculation() { var day=$("#day").val(); var month=$("#month").val(); var year=$("#year").val(); if(day!='' && month!='' && year!='') { //var from = $("#birthdate").val().split("-"); //var dob = new Date(from[2], from[1] - 1, from[0]); var dob = new Date(year, month-1,day); var today = new Date(); var age = Math.floor((today-dob) / (365.25 * 24 * 60 * 60 * 1000)); $('#age').val(''); $('#age').val(age); } } <!--Age calculation--> <!--date picker--> </script> </body> </html>