<?php
include("../../config/database_connection.php");
if( isset($_POST) )
{
$user_name =$_POST['user_name'];
$email = $_POST['email'];
$user_pass_init = $_POST['password'];
$user_pass_conf = $_POST['passconfirm'];
$full_name = $_POST['full_name'];
$gender = $_POST['gender'];
if ($user_name!="" && $email!="" && $full_name!="" && $gender!="") {
if ($_POST['password']!= $_POST['passconfirm']) {
header("location:../index.php?err= password do not match");
}else{
$query = "INSERT into admin_users (user_name,email,user_pass,full_name,gender) VALUES('" . $user_name . "','" . $email . "','" . md5($user_pass_init) . "','" . $full_name . "','" . $gender . "')";
$success = $conn->query($query);
}
if (!$success) {
die("Couldn't enter data: ".$conn->error);
} else{
header("location:../index.php");
}
} else{
header("location:../index.php?err= Enter all the fields");
}
} else{
header("location:../index.php?err= couldnot enter data");
}
?>
this is the code I am trying to execute to check whether two passwords are matching or not... but while entering same passwords I get value of password do not match Whats the issue? Help me solve it
Here is my recommendation, this may not completely solve your issue but it will make your code a bit more secure since your code is susceptible to SQL injection:
I also would recommend using
password_hash()
instead ofmd5()