Check user idle time and destroy session in php

In document ready we need to call a setinterval function and inside that function check the variable with the timeout value and destroy the session.

Code :

var idleMax = 1;// Logout after 1 minutes of IDLE
var idleTime = 0;

function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > idleMax) {
alert(“session expired”);
location.href =”logout.php”;
$(document).ready(function ($) {

var idleInterval = setInterval(“timerIncrement()”, 60000);
$(this).mousemove(function (e) {
idleTime = 0;
$(this).keypress(function (e) {
idleTime = 0;



Check Multiple array values inside in_array function PHP

function in_array_any($argss) {
‘static_category’ => $static_category,
‘dynamic_category’ => $dynamic_category
), $argss));

$req_arg = array(
‘static_category’ => $static_category,
‘dynamic_category’ => $dynamic_category
$dynamic = explode(‘,’,$req_arg[‘dynamic_category’]);
$static = explode(‘,’,$req_arg[‘static_category’]);
return (bool)array_intersect($dynamic, $static);

The above function is not actually using in_array but when you need to check for multiple values exist inside an array you can make use of this function and you can return the boolean values of it.

Error: MySQL shutdown unexpectedly Xampp server

Error: MySQL shutdown unexpectedly.This may be due to a blocked port, missing dependencies,
12:23:06 PM [mysql] improper privileges, a crash, or a shutdown by another method.
12:23:06 PM [mysql] Press the Logs button to view error logs and check
12:23:06 PM [mysql] the Windows Event Viewer for more clues
12:23:06 PM [mysql] If you need more help, copy and post this
12:23:06 PM [mysql] entire log window on the forums

  1. You can change the port number of Mysql from xampp from 3306 to 3307 or 3308 as you wish, if it still didn’t work out then use the below steps.
  2. Go to Task Manager , Process and then End process the current mysql process and then now you can start the mysql again from xampp it will workout