<?php  

session_start();  
include_once('config/db.php');         

             $today = date("d.m.Y");
             $today = date("Y-m-d", strtotime($today));      //echo"$today";
             date_default_timezone_set('Africa/Nairobi');    //echo"$now";
             $now = date("h:i:s"); 
             
            $uip =  htmlspecialchars( strtoupper($_SERVER['REMOTE_ADDR'])); 
            $ub= htmlspecialchars($_SERVER['HTTP_USER_AGENT'] );
                 

            $sql = 'INSERT INTO sys_logs (user,auth,time,date,uip,ub ) VALUES(:u,:auth,:time,:date,:uip,:ub )';
            $conn->prepare($sql)->execute(['u' => $_SESSION['uid'],'auth' => -1,'time' => $now,'date'=> $today,'uip'=> $uip,'ub'=>$ub  ]); 
           
         // $on=0;
         // $sql = "UPDATE ch_member SET  online=:on ,lastseen=:ls WHERE id=:id "; 
			// $conn->prepare($sql)->execute([ 'on' =>$on ,'ls' =>$today, 'id' => $_SESSION['uid']  ]);

         session_destroy();
         

         header('Location:index.php');
         exit();


?>