<?php
session_start();
include_once 'config.php';
date_default_timezone_set('Asia/Kolkata');
$date = date ('Y-m-d H:i:s');
$name = $_SESSION['name'];
$diff = $_SESSION['DIF'];
$sql2 = mysqli_query($con,"INSERT INTO login_time(NAME,DATE,TOTAL_TIME) values ('$name','$date','$diff')") or die(mysqli_error($con));

$sql="UPDATE user_reg_tbl SET logout_time = '$date',state='0' WHERE name = '$_SESSION[name]' ";
$query = mysqli_query($con,$sql) or die(mysqli_error($con));
$_SESSION=NULL;
$_SESSION = [];
session_unset();
session_destroy();
header("Location:index.php");

?>