<?php
	include($_SERVER['DOCUMENT_ROOT'] ."/_ps2020/config/connect.php");

	session_start();


	$username = $_SESSION['user'];
	$username_new = $_GET['username'];
	// echo "no code is found";

	$result = $conn->query("SELECT * FROM user_account");
		
		if($result) {
			
			$existed = false;

			while ( $row = $result->fetch_assoc() ){
				if ( $row['username'] == $username_new && $row['username'] != $username  ){
					$existed = true;
					echo 0;
					exit();
				}
			}

			if ($existed == false){
				echo 1;
			}
		}
	   
	$conn->close();
?>