<?php
require_once("../includes/database.php");
if (!empty($_POST["username"])) {
    $username = $_POST["username"];

    $result = mysqli_query($con, "SELECT username FROM accounts WHERE username='$username'");
    $count = mysqli_num_rows($result);
    if ($count > 0) {
        echo "<span style='color:red'> Username already exists .</span>";
        echo "<script>$('#finish').prop('disabled',true);</script>";
    } else {

        echo "<span style='color:green'> Username available for Registration .</span>";
        echo "<script>$('#finish').prop('disabled',false);</script>";
    }
}
