Registration.php
=====================================
=====================================
<?php ob_start(); ?> <script type="text/javascript"> function _(x) { return document.getElementById(x); } function validate1() { if (isEmail1() && ispass1()) if (confirm("\n You are about to add new Customer. \n\nPress Ok to submit. Cancel to abort.")) { return true; } else { alert("You have chosen to abort ."); return false; } else return false; } function ispass1() { var pin=_("pass").value; var len=_("pass").value.length; //alert(len); if(pin=="" || len<8 ) { _("errpass1").innerHTML="Enter min 8 digit mobile number"; _("pass").style.borderColor = "red"; return false; } else { _("errpass1").innerHTML=" "; _("pass").style.borderColor = "grey"; return true; } } function isEmail1() { var mail=_("username").value; var regExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if(mail=="" || !regExp.test(mail)) { _("erremail1").innerHTML="Please enter valid E-Mail"; _("username").style.borderColor = "red"; return false; } else { _("erremail1").innerHTML=" "; _("username").style.borderColor = "grey"; return true; } } function validate() { if (isFirstname() && isLastname() && isAddress() && isAddress1() && ispincode() && isEmail() && ispincode() && ispass() && isMobile() && isMobile1() && isCountry() && isst() && isct()) if (confirm("\n You are about to add new Customer. \n\nPress Ok to submit. Cancel to abort.")) { return true; } else { alert("You have chosen to abort ."); return false; } else return false; } function isFirstname() { var firstname=_("fname").value; var regExp = /^[a-z A-Z]*$/; if(firstname=="" || !regExp.test(firstname)) { _("errfirstname").innerHTML="Please enter valid Firstname"; _("fname").style.borderColor = "red"; return false; } else { _("errfirstname").innerHTML=" "; _("fname").style.borderColor = "grey"; return true; } } function isLastname() { var lastname=_("lname").value; var regExp = /^[a-z A-Z]*$/; if(lastname=="" || !regExp.test(lastname)) { _("errlastname").innerHTML="Please enter valid Lastname"; _("lname").style.borderColor = "red"; return false; } else { _("errlastname").innerHTML=" "; _("lname").style.borderColor = "grey"; return true; } } function isAddress() { var address=_("addr").value; if(address=="") { _("erraddress").innerHTML="Please enter address"; _("addr").style.borderColor = "red"; return false; } else { _("erraddress").innerHTML=" "; _("addr").style.borderColor = "grey"; return true; } } function isAddress1() { var address=_("addr1").value; if(address=="") { _("errshipadd").innerHTML="Please Enter Shipping Address"; _("addr1").style.borderColor = "red"; return false; } else { _("errshipadd").innerHTML=" "; _("addr1").style.borderColor = "grey"; return true; } } function ispincode() { var pin=_("txtzip").value; var regExp =/^[0-9]*$/; var len=_("txtzip").value.length; //alert(len); if(pin=="" || !regExp.test(pin) || len!=6 ) { _("errpin").innerHTML="Enter 6 digit mobile number"; _("txtzip").style.borderColor = "red"; return false; } else { _("errpin").innerHTML=" "; _("txtzip").style.borderColor = "grey"; return true; } } function isEmail() { var mail=_("email").value; var regExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if(mail=="" || !regExp.test(mail)) { _("erremail").innerHTML="Please enter valid E-Mail"; _("email").style.borderColor = "red"; return false; } else { _("erremail").innerHTML=" "; _("email").style.borderColor = "grey"; return true; } } function ispass() { var pin=_("pass").value; var len=_("pass").value.length; //alert(len); if(pin=="" || len<8 ) { _("errpass").innerHTML="Enter min 8 digit mobile number"; _("txtpass").style.borderColor = "red"; return false; } else { _("errpass").innerHTML=" "; _("pass").style.borderColor = "grey"; return true; } } function isMobile() { var mobile=_("txtmo").value; var regExp =/^[0-9]*$/; var len=_("txtmo").value.length; //alert(len); if(mobile=="" || !regExp.test(mobile) || len!=10 ) { _("errmo").innerHTML="Enter 10 digit mobile number"; _("txtmo").style.borderColor = "red"; return false; } else { _("errmo").innerHTML=" "; _("txt_mo").style.borderColor = "grey"; return true; } } function isMobile1() { var mobile=_("txtpho").value; var regExp =/^[0-9]*$/; var len=_("txtpho").value.length; //alert(len); if(mobile=="" || !regExp.test(mobile) || len!=10 ) { _("errpho").innerHTML="Enter 10 digit mobile number"; _("txtpho").style.borderColor = "red"; return false; } else { _("errpho").innerHTML=" "; _("txtpho").style.borderColor = "grey"; return true; } } function isCountry() { var country=_("co").value; if(country=="") { _("errcountry").innerHTML="Please select Country"; _("co").style.borderColor = "red"; return false; } else { _("errcountry").innerHTML=" "; _("co").style.borderColor = "grey"; return true; } } function isst() { var state=_("st").value; if(state=="") { _("errst").innerHTML="Please select State"; _("st").style.borderColor = "red"; return false; } else { _("errst").innerHTML=" "; _("st").style.borderColor = "grey"; return true; } } function isct() { var city=_("ct").value; if(city=="") { _("errct").innerHTML="Please select City"; _("ct").style.borderColor = "red"; return false; } else { _("errct").innerHTML=" "; _("ct").style.borderColor = "grey"; return true; } } </script> <?php session_start(); if(isset($_SESSION['username'])) { header("Location:ordersummery.php"); } include 'header.php';?> <section id="form"><!--form--> <div class="container" style="margin-top:-20px;"> <div class="row"> <div class="col-sm-4 col-sm-offset-1"> <div class="login-form"><!--login form--> <h2>Login to your account</h2> <form method="post" name="f1" onsubmit="return(validate1());"> <input type="text" name="username" id="username" placeholder="Email" onblur="isEmail1()"/> <label name="erremail1" id="erremail1" style="float:right;padding-right:150px;color:red;"></label> <input type="password" name="pass" id="pass" placeholder="password" onblur="ispass1()"/> <label name="errpass1" id="errpass1" style="float:right;padding-right:150px;color:red;"></label> <span> <input type="checkbox" class="checkbox"> Keep me signed in </span> <button type="submit" name="login" class="btn btn-default">Login</button> <button type="submit" name="fgpass" class="btn btn-default">Forget Password</button> </form> <?php include 'connection.php'; if(isset($_POST['login'])){$username=$_POST["username"]; $pass=$_POST["pass"]; $selquery=mysql_query("SELECT email,pass,registration_id FROM registration WHERE email='$username' AND pass='$pass'"); $fetch_data=mysql_fetch_array($selquery); $n=mysql_num_rows($selquery); echo $n; if($n==1) { $_SESSION["username"]=$fetch_data["email"]; $_SESSION["id"]=$fetch_data["id"]; header("Location:ordersummery.php"); die(); }}if(isset($_POST['fgpass'])){ header("location:fgpass.php"); } ?> </div><!--/login form--> </div> <div class="col-sm-1"> <h2 class="or">OR</h2> </div> <div class="col-sm-4"> <div class="signup-form"><!--sign up form--> <h2>New User Signup!</h2> <form method="post" onsubmit="return(validate());"> <input type="text" name="fname" id="fname" placeholder="First Name" onblur="isFirstname()"/> <label name="errfirstname" id="errfirstname" style="float:right;padding-right:150px;color:red;"></label> <input type="text" name="lname" id="lname" placeholder="Last Name" onblur="isLastname()"/> <label name="errlastname" id="errlastname" style="float:right;padding-right:150px;color:red;"></label> <input type="textarea" name="addr" id="addr" placeholder="address" onblur="isAddress()"/> <label name="erraddress" id="erraddress" style="float:right;padding-right:150px;color:red;"></label> <input type="textarea" name="addr1" id="addr1" placeholder="Shipping Address" onblur="isAddress1()"/> <label name="errshipadd" id="errshipadd" style="float:right;padding-right:150px;color:red;"></label> <input type="text" name="txtzip" id="txtzip" placeholder="Pincode" onblur="ispincode()"/> <label name="errpin" id="errpin" style="float:right;padding-right:150px;color:red;"></label> <input type="email" name="email" id="email" placeholder="email" onblur="isEmail()"/> <label name="erremail" id="erremail" style="float:right;padding-right:150px;color:red;"></label> <input type="password" name="pass" id="pass" placeholder="password" onblur="ispass()"/> <label name="errpass" id="errpass" style="float:right;padding-right:150px;color:red;"></label> <input type="text" name="txtmo" id="txtmo" placeholder="mobile" onblur="isMobile()"/> <label name="errmo" id="errmo" style="float:right;padding-right:150px;color:red;"></label> <input type="text" name="txtpho" id="txtpho" placeholder="Phone number" onblur="isMobile1()"/> <label name="errpho" id="errpho" style="float:right;padding-right:150px;color:red;"></label> <select name="co" id="co" onblur="isCountry()"> <option selected value="">------Select Your Country------</option> <?php $sql=mysql_query("select * from country"); while($row=mysql_fetch_array($sql)) { ?> <option value="<?php echo $row[0]; ?>"><?php echo $row[1]; ?></option> <?php } ?> </select> <label name="errcountry" id="errcountry" style="float:right;padding-right:150px;color:red;"></label> <select name="st" id="st" onblur="isst()"> <option selected value="">------Select Your State------</option> <?php $sql1=mysql_query("select * from state"); while($row1=mysql_fetch_array($sql1)) { ?> <option value="<?php echo $row1[0]; ?>"><?php echo $row1[1]; ?></option> <?php } ?> </select> <label name="errst" id="errst" style="float:right;padding-right:150px;color:red;"></label> <select name="ct" id="ct" onblur="isct()"> <option selected value="">------Select Your City------</option> <?php $sql2=mysql_query("select * from city"); while($row2=mysql_fetch_array($sql2)) { ?> <option value="<?php echo $row2[0]; ?>"><?php echo $row2[1]; ?></option> <?php } ?> </select> <label name="errct" id="errct" style="float:right;padding-right:150px;color:red;"></label> <label></label> <button type="submit" name="sbt" class="btn btn-default">Signup</button> </form> <?php include 'connection.php'; if(isset($_POST['sbt'])) { $name=$_POST['fname']; $lname=$_POST['lname']; $add=$_POST['addr']; $add1=$_POST['addr1']; $txtzip=$_POST['txtzip']; $email=$_POST['email']; $pass=$_POST['pass']; $txtmo=$_POST['txtmo']; $txtpho=$_POST['txtpho']; $co=$_POST['co']; $st=$_POST['st']; $ct=$_POST['ct']; $qu=mysql_query("insert into registration values('','$name','$lname','$add','$add1',$txtzip,'$email', '$pass',$txtmo,$txtpho,$co,$st,$ct)"); if (!$qu) { //echo "insetr"; echo mysql_error(); } } ?> </div><!--/sign up form--> </div> </div> </div> </section><!--/form--> <?php include 'footer.php';?> <script src="js/jquery.js"></script> <script src="js/price-range.js"></script> <script src="js/jquery.scrollUp.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/jquery.prettyPhoto.js"></script> <script src="js/main.js"></script> </body> </html>
No comments:
Post a Comment