<?php
include 'configuration.php';


//query the users table for availabilty
$q = "SELECT username FROM staff";
$r = mysqli_query(dbc(),$q);

if($r)
{
	$existing_users = array();
	while($row = mysqli_fetch_array($r, MYSQLI_ASSOC))
	{
		
		$existing_users[] = $row['username'];
		
		
	}
	
}


// user name availabilty
//this varible contains the array of existing users
//$existing_users=array('roshan','mike','jason'); 
//value got from the get metho
$user_name=$_POST['user_name'];
//checking weather user exists or not in $existing_users array
if (in_array($user_name, $existing_users))
{
	//user name is not availble
	echo "no";
} 
else
{
	//user name is available
	echo "yes";
}

//end of user name availabilty





?>