<?php
//aktifkan session
if(!isset($_SESSION)){session_start();}

//cek jika ada inputan variable "exit" (tonerFunc.php) di set 1 maka akan simpan alamat terakhir sblm ganti halaman kesini atau langsung ke index.php(menuutama)
if ( (isset($_GET['exit']) ? $_GET['exit'] : 0)=='1' ){
  $temp=$_SESSION['actual_link'];
}else{
	$temp="index.php";
}

//20170816, tambahan utk program buku pesan 
//$findme   = 'bukupesanx';
//if (strpos("bukupesanx.php", $findme)===0 || strpos($_SESSION['actual_link'], $findme)>0 || strpos($nameprog, $findme)>0){
//	$temp=$_SESSION['actual_link'];
//}else{
//	$temp="index.php";
//}

//simpan info variable yang terkirim dari page, post, session sebelumnya
$upuserx	=isset($_SESSION['f_user'])		?$_SESSION['f_user']:null;
$nameprog=basename($_SERVER['PHP_SELF']);

//$wherex=$temp;
//include("LogCekVar.php");

$_SESSION["f_user"]="";
$_SESSION["f_pass"]="";

session_destroy();
setcookie("f_user","",time()+0);
setcookie("f_pass","",time()+0);
setcookie("f_fullname","",time()+0);
setcookie("f_email","",time()+0);
setcookie("f_pakai","",time()+0);
setcookie("f_level","",time()+0);
setcookie("f_digitke2","",time()+0);
setcookie("f_keterangan","",time()+0);
setcookie("kunci","",time()+0);

//paksa membuat session baru
session_start();
$_SESSION['actual_link']=$temp;

//setcookie("conn_mysql","",time()+0);

/*
setcookie("user","",time()+0);
setcookie("nama","",time()+0);
setcookie("layout","",time()+0);
setcookie("warna","",time()+0);
for ($i = 1;$i <= 5;$i++) 
{   
setcookie("name[$i]","",time()+0);
setcookie("menu[$i]","",time()+0);
}
setcookie("pilihan","",time()+0);
*/

header("location:index.php");
die();
?>