<?php
$con=mysqli_connect("localhost","menahotel","GN%3{3HX1yie","menahotel");
$username = mysqli_real_escape_string($con,$_POST['username']);
if(!empty($username)) {
	$email = $username;
$domain_name = substr(strrchr($email, "@"), 1);

	$sql = "SELECT * FROM tbl_users WHERE email like '%$domain_name%'";
	$result = mysqli_query($con,$sql);
	$count = mysqli_num_rows($result);
	

  if($count>0) {
      echo "<span class='status-not-available' style='color:#f10909'> The domain was already used once.</span>";
  }else{
      echo "<span class='status-available' style='color:#07801b'> Email Available.</span>";
  }
}
?>