Every time i refresh page it inserts same user into database

By Kolibrok

Here is PHP code

<?php
if(isset($_POST['Murad'])){
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$userName=$_POST['username'];
$password=$_POST['pwd1'];
$userName = stripslashes($userName);
$password = stripslashes($password);
$email=$_POST['email'];
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "123";
$mysql_databse = "websiteusers";
$prefix = "";
$bd = mysqli_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
$sql = "INSERT INTO websiteusers
       (fullname,lastname,userName,email,pass)
       VALUES ( '$firstname', '$lastname','$userName', '$email','$password')";
        mysqli_select_db($bd,'websiteusers');
$retval = mysqli_query($bd,$sql );
if(! $retval )
{
  die('Could not enter data: ');
  return false;
}
else {echo "Entered data successfullyn";
   }
   $usernamecheck=mysqli_query($bd,"SELECT `userName` FROM `websiteusers`
                             WHERE userName='$userName'");
if(mysqli_num_rows($usernamecheck)>=1){
   echo $userName." is already taken";
 return false;
 }header("Location: Main.php");}
?>

User registers then when he is in his profile page as soon as he refreshes it inserts same username again.And also username and email are unique in my dt it cant insert it and gives an error

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273