<form action="" method="post" id="customer-register">
<table align="center">
<div id="container">
<h1>Welcome to Registration Page!</h1>
<td>Full Name:</td>
<td><input type="text" name="fname" placeholder="enter your name">
</td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="uname" placeholder="enter your
username"></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" placeholder="enter your email">
</td>
</tr>
<tr>
<td>Select your Password:</td>
<td><input type="color" name="color1" value="#ff0000"><input
type="color" name="color2" value="#ff0000"><input type="color" name="color3"
value="#ff0000"><input type="color" name="color4" value="#ff0000"><input
type="color" name="color5" value="#ff0000"></td>
</tr>
<td><input type="submit" name="submit" value="Register"></td>
</tr>
</body>
</html>
This is my code for my register.php project. As you can see, I am not using text password, instead im allowing user to pick 5 type of colour to register.My question is there a source code for me to make sure that user do not enter the same color pattern as other user which have entered and saved in the database?
if(isset($_POST['submit'])){
$fname=$_POST['fname'];
$uname=$_POST['uname'];
$email=$_POST['email'];
$pass1=$_POST['color1'];
$pass2=$_POST['color2'];
$pass3=$_POST['color3'];
$pass4=$_POST['color4'];
$pass5=$_POST['color5'];
$register_query = "INSERT INTO `cust`(`fname`, `uname`, `email`,
`color1`, `color2`, `color3`, `color4`, `colo5`) VALUES
('$fname','$uname','$email','$pass1', '$pass2', '$pass3', '$pass4',
'$pass5')";
try{
$register_result = mysqli_query($conn,$register_query);
if($register_result){
if(mysqli_affected_rows($conn)>0){
header("location: success.html");
}else{
echo("error in registeration");
}
}
}catch(Exception $ex){
echo("error" .$ex->getMessage());
}
}else {
}
this is my code for handling the register.