<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ("includes/function.php");

$zdb = $_SESSION["zdbyear_$dbname"];
mysqli_select_db($conn, $zdb);
$zroot = $_SESSION["zdir"];

if ($_REQUEST["user"]) {
    $user = $_REQUEST["user"];
    $s = 0 ; 
    $getprate = mysqli_query($conn, "SELECT `username` FROM $zroot.`usermain` WHERE username = '$user'  ")or die(mysqli_error($conn));
    $row = mysqli_num_rows($getprate);
    if ($row > 0) { 
        $s = 1;
        $data = array('s' => $s);
        header('Content-Type: application/json');
        echo json_encode($data);
    }
}
?>
