<?php
   
    
   function getid2($fname)
   {
    include('db/connect_db.php');
       
   $select1 = $pdo->prepare("SELECT id FROM form where name='$fname'");
   $select1->execute();
   $row = $select1->fetch(PDO::FETCH_ASSOC);
        
      if($select1->rowCount() > 0 ){
          
        $sr11 = $row['id'];
           
      }else {
          
          $sr11='0';
          
      }
      return $sr11;
   }
   
 function frmAcc($fname,$userid)
   {
    include('db/connect_db.php');
       $frmid=  getid2($fname);
       $select2 = $pdo->prepare("SELECT formid,userid FROM formaccess WHERE formid='$frmid' and userid='$userid'");
       $select2->execute();
       $row = $select2->fetch(PDO::FETCH_ASSOC);
        
      if($select2->rowCount() > 0 ){
          
        $sr11 = TRUE;
           
      }else {
          
          $sr11=FALSE;
          
      }
      return $sr11;
   }
   
   
   
    function employeesite($sid,$userid)
   {
    include('db/connect_db.php');
       
       $select2 = $pdo->prepare("SELECT sid FROM empworks WHERE sid='$sid' and usrid='$userid'");
       $select2->execute();
       $row = $select2->fetch(PDO::FETCH_ASSOC);
        
      if($select2->rowCount() > 0 ){
          
        $sr11 = TRUE;
           
      }else {
          
          $sr11=FALSE;
          
      }
      return $sr11;
   }
   
   
   
   

      
           
?>
