<?php
include '../connection.php';
if(isset($_POST['submit'])){
$username = $_POST['name'];
$father_name = $_POST['faname'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$password = $_POST['pass'];
$cpassword = $_POST['cpass'];
}
// $pass = password_hash($password, PASSWORD_BCRYPT);
// $cpass = password_hash($cpassword, PASSWORD_BCRYPT);
$emailquery = "select * from registration where email='$email'";
$query = mysqli_query($con,$emailquery);
$emailcount = mysqli_num_rows($query);
if($emailcount>0)
{
?>
<script>
alert("Email Already Exists. Please Use Diffrent Email Id");
window.location.replace('../register.php');
</script>
<?php
}
else{
if($password === $cpassword)
{
$insertquery = "insert into registration(name,faname,gender,email,mobile,password,cpassword)value('$username','$father_name','$gender','$email','$mobile','$password','$cpassword')";
$res = mysqli_query($con,$insertquery);
if($res){
?>
<script>
alert("Registration Successfully");
window.location.replace('../register.php');
</script>
<?php
}
else{
?>
<script>
alert("No Registration.");
window.location.replace('../register.php');
</script>
<?php
}
}
else{
?>
<script>
alert("password are not matches");
window.location.replace('../register.php');
</script>
<?php
}
}
?>
0 Comments