<?php

session_start();
error_reporting(1);
include_once('../includes/config.php');

if (!isset($_SESSION['alogin'])) {
    header('location:../login.php');
    die();
}

if(isset($_REQUEST['email'])){
    $sql = "SELECT * from sign where user = (:email) AND status = 2 AND total_download = 0";
    $query = $dbh->prepare($sql);
    $query->bindParam(':email', $_REQUEST['email'], PDO::PARAM_STR);
    $query->execute();
    
    $signCount = $query->rowCount();

    $sql = "SELECT * from server_copy where user = (:email) AND status = 2 AND total_download = 0";
    $query = $dbh->prepare($sql);
    $query->bindParam(':email', $_REQUEST['email'], PDO::PARAM_STR);
    $query->execute();
    $serverCount = $query->rowCount();

    $notification = ["sign"=>$signCount,"server"=>$serverCount];

    echo json_encode($notification);


}