I want to make the code really secure for the users. The code below shows the php code that
I have used it for my website. Right now I have used some validation such as password and repeatPassword has to match and the users has to input all the fields.
To make it more secure, I want to insert secure command such as PDO, mysqli, crypto or MD5
But I do not know how to since I have new to php.
How can i do this ?
My Code is here :
 <?php       
      include"config.php";
  if (isset($_POST['submit']))
{
    $user_name = $_POST['name']; 
    $user_surname = $_POST['surname']; 
    $user_email = $_POST['email']; 
    $user_academic = $_POST['academic_institute']; 
    $user_username = $_POST['username']; 
    $user_pass = ($_POST['password']); 
    $user_pass2 = ($_POST['repeatPassword']); 
    if($user_name && $user_username)
        {
    if($user_pass==$user_pass2)
    {
  $query = mysql_query("INSERT INTO members (name, surname, email, academic_institute,   username, password, repeatPassword) 
   VALUES ('$user_name', '$user_surname', '$user_email', '$user_academic',     '$user_username', '$user_pass', '$user_pass2')");
   mysql_query($query); 
 echo '<script type="text/javascript">alert("You have been registered");</script>';
    }
    else
    {
        echo '<script type="text/javascript">alert("Password must match");</script>';
    }
}
else {
        echo '<script type="text/javascript">alert("All fields required");</script>';
}
  }
   ?>
 
     
     
    