<?php
	include_once('../config.php');   
    
     if(!isset($_SESSION['userId']))
    { 
         header("Location: ../");
         die;
    }
    
    
                if(date("D")!="Sun")   
                {
                    $stmt=$conn->prepare("select *   from UI__DailyROIGene   where AddView=:AddView and custId=:custId  and Tdate=:Tdate");   
                    $stmt->bindValue(':custId',  $_SESSION['userId'] , PDO::PARAM_STR);  
                    $stmt->bindValue(':AddView', $_REQUEST['AddId'], PDO::PARAM_INT);  
                    $stmt->bindValue(':Tdate',  date("d-M-Y") , PDO::PARAM_STR); 
                    $stmt->execute();
                    
                    if($stmt->rowCount() < 1)
                    { 
                    $stmt=$conn->prepare("insert into  UI__DailyROIGene  (custId,amount,Tdate,AddView)  values(:custId,:amount,:Tdate,:AddView) ");   
                    $stmt->bindValue(':custId',  $_SESSION['userId'] , PDO::PARAM_STR);  
                    $stmt->bindValue(':amount', 10, PDO::PARAM_INT);  
                    $stmt->bindValue(':Tdate', date("d-M-Y"), PDO::PARAM_INT);  
                    $stmt->bindValue(':AddView', $_REQUEST['AddId'], PDO::PARAM_INT);    
                    $stmt->execute(); 
                    }     
                }
include_once("../view/dashboard/ViewAd.php"); 
?>