I have encrypted and store password. Once user login I want to decrypt and validate .But following code is not able to do that. Can any body help with this?
<?php
include("config.php");
if($_SERVER["REQUEST_METHOD"] == "POST") {
$myusername = mysqli_real_escape_string($con,$_POST['username']);
$mypassword =md5(mysqli_real_escape_string($con,$_POST['password']));
$sql = "SELECT id FROM services WHERE user_name = '$myusername' and password = '$mypassword'";
$result = mysqli_query($con,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if($count == 1) {
echo "success";
}else {
echo "fail";
}
}
?>