<?php    session_start(); session_id();
          
      include_once('db.php');

 if ( session_id() =='' )
{
         
         header('Location:login.php');
         exit();
}
else
{
    
    // ini_set('display_errors', 1);
    // ini_set('display_startup_errors', 1);
    // error_reporting(E_ALL);

 // global variables , user ip adress ,user  browser , Date  and time
            $uip =   htmlspecialchars( strtoupper($_SERVER['REMOTE_ADDR'])); 
            $ub=     htmlspecialchars($_SERVER['HTTP_USER_AGENT'] );
 
            $today = date("d.m.Y"); 
            $today = date("Y-m-d", strtotime($today));

            date_default_timezone_set('Africa/Nairobi');
            $now = date("h:i:s a"); 
    
            
            $uid =   $_SESSION['uid'] ;

            $stmt = $conn->prepare('SELECT * FROM sys_user WHERE id = ? ');
            $stmt->execute([$uid  ]);
            $ActiveUser = $stmt->fetch(); extract($ActiveUser);
            $fname =          $ActiveUser['fname'];
            $mname =            $ActiveUser['mname'];
            $lname =            $ActiveUser['lname'];
            $phone =          $ActiveUser['phone'];
            $email =           $ActiveUser['email'];
            $Active_onlineuser = $conn->query(" SELECT COUNT(*) FROM sys_user  WHERE lastactivity > DATE_SUB(NOW(),
                                                INTERVAL 120 SECOND) ")->fetchColumn();

            if ($user_image=="") { $avatar = 'def.png' ; }

            //LOAD  COMPANY DETAILS 
             $company  = $conn->query("SELECT * FROM adcompany   ")->fetch();
            $company_name   =      $company['name'] ;                         global $company_name;
            $company_phone   =    $company['phone1'] ;                         global $company_phone; 
            $company_email   =    strtolower( $company['email'])   ;          global $company_email; 
            $company_address   =    ucfirst( $company['address'] );           global $company_address; 
            $company_location   = $company['location'] ;                      global $company_location; 


             // company preferences 

            // $profileTarget = "images/members/";
            // $proofTarget = "images/donations/";
            // $profileTarget = "images/members/";
            // $proofTarget = "images/donations/";
            
            $mycurrentpage1=  basename($_SERVER['PHP_SELF']);
            $mycurrentpage = pathinfo($mycurrentpage1, PATHINFO_FILENAME);

            $allowedFileType = ['application/vnd.ms-excel','text/xls','text/xlsx','text/csv',
                                 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];

    
           $storeID = $_SESSION['storeid'];
           $storeGD = $_SESSION['guard'];
}


   
?>