Location: PHPKode > projects > Ptk-forensics > ptk/lib/lock_investigator.php
<?
/*
PTK  - DFLabs
Copyright (C) 2008 - DFLabs srl - All rights reserved
hide@address.com
*/
include("check_session.php");
include("../config/config.inc.php");
include ("sanitize.php");
include ("loggerClass.php");
include ("lib_std.php");
session_start();
$token_age = time() - $_SESSION['inv_token_time'];
if (!isset($_SESSION['inv_token']) or strcmp($_SESSION['user'],"admin")!=0 or strcmp($_SESSION['inv_token'],$_GET['tk'])!=0 or $token_age > 300){
	new AuditLog('Unauthorized access to lock_investigator ');
        header("location: goto_home.php");
}else{
	$conn = mysql_connect($db_host, $db_user, $db_password)
	or die ("Error connecting to database");
	mysql_select_db($db_name);

	$id = sanitize($_GET['id'],INT);
	$user = user_info($id);
	$username = $user['username'];

	if($user['is_locked']=='0'){
		$query = mysql_query("UPDATE users SET is_locked=1 WHERE id='$id'");
		$_SESSION['message'] = "Investigator $username locked";
		new Log($_SESSION['ip'], $_SESSION['user'], 'Investigator '.$username.' locked');	
	}else{
		$query = mysql_query("UPDATE users SET is_locked=0 WHERE id='$id'");
		$_SESSION['message'] = "Investigator $username unlocked";
		new Log($_SESSION['ip'], $_SESSION['user'], 'Investigator '.$username.' unlocked');	
	}
	mysql_close();

	header("location: settings.php");
}
?>
Return current item: Ptk-forensics