<?php 

if(isset($_COOKIE['email']) && isset($_COOKIE['password'])){

    $email = filter_var($_COOKIE['email'], FILTER_SANITIZE_EMAIL);
    $password = filter_var($_COOKIE['password'], FILTER_SANITIZE_STRING);

    $sql = "SELECT * FROM users WHERE email = '{$email}' AND password = '{$password}' LIMIT 1";

    if(fetch_rows($sql)){

        $u = fetch_records($sql);

        $user_id = $u['id'];

        if($u['this_day'] == 0){

            query("UPDATE users SET this_day = 1, visits = visits + 1, points = points + '{$set['daily_points']}', last_seen = '{$t}' WHERE id = '{$u['id']}' LIMIT 1");
            query("UPDATE _stats SET visits = visits + 1 ORDER BY id DESC LIMIT 1");

        }

    }

}

?>