<?php

    //--------- event logging --------------------
    function logEvent($db,$eventtype,$event,$employeelogid = NULL){

    $username = $_SESSION['login_user'];

    $eventtype1 = $eventtype;

    $event1 = $event;

    if(isset($employeelogid)) {
        $employeeid = $employeelogid;
    } else $employeeid = "";

    $logevent = "INSERT INTO eventlog (eventuser,eventtype,eventname,employeeid) 
    VALUES ('" . $username . "','" . $eventtype1 . "','" . $event1 . "','" . $employeeid ."')";

    if (mysqli_query($db, $logevent)) {
        echo "event was logged";
        return true;
      } else {
        echo "event was NOT logged";
      }

    }
   
    //-------------------------------------------

?>