Location: PHPKode > projects > Ptk-forensics > ptk/lib/get_search.php
<?
/*
PTK  - DFLabs
Copyright (C) 2008 - DFLabs srl - All rights reserved
hide@address.com
*/
include("check_session.php");
include("check_session_image.php");
include("lib_commands.php");
include("loggerClass.php");
include("lib_std.php");

if (isset($_SESSION['key_token']) && strcmp($_SESSION['key_token'],$_GET['tk']) == 0){

$str = time().md5($_GET['string']);

$string = mysql_real_escape_string($_GET['string']);
$regexp = $_GET['regexp'];
for($i=0;$i<$_SESSION['len_partitions'];$i++){
	$part_id .= $_SESSION["partition".$i."_id"].",";
}
$part_id = preg_replace("/\,$/", "", $part_id);
$arr = get_indexed_search($string, $part_id, $regexp);
?>
<p style="font-size:8pt; margin-bottom:0px; margin-left:30px">
<!--<img src="../img/select_all.png" style="vertical-align: middle">&nbsp;If selected: <u style="cursor:pointer" onclick="goto_multiple_bookmarks_kw('<?=$str?>', 2, '<?=$part_id?>')">bookmark all</u><!-- |  <u style="cursor:pointer">export all</u>-->
</p>
<table class="keyword" id="result_table">
	<th><input type='checkbox' id='bookmark_all<?=$str?>' onclick="check_uncheck_all_kw('<?=$str?>')"></th><th><img title="bookmark selected files" id='starall' style="cursor:pointer" onclick="goto_multiple_bookmarks_kw('<?=$str?>', 2, '<?=$part_id?>')" src='../img/star.png'/></th><th>File name</th><th>Meta</th><th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
	<?for($i=0;$i<sizeof($arr);$i++){
			$offset = get_partition_offset_from_id($arr[$i]['id_partition']);
			$filename = $arr[$i]['file_name'];
			
			$filename = htmlspecialchars($filename);

			$bn = basename($filename)." *** Keyword: ".sanitize(RemoveXSS($string),PARANOID);
			$name = preg_replace("/\//", "_", $filename);
			$name = preg_replace("/^_/", "", $name); 
   			$n = preg_replace("/\//", "", $filename);  
   			$n = preg_replace("/\(deleted\)/", "", $n); 
	   		$n = urlencode($n);

   			$nm = preg_replace("/\(deleted\)/", "", $filename);
   			$nm = urlencode($nm);
			
			$is_bookmark = check_bookmark($_SESSION['user'], $_SESSION['case_id'], $part_id, $arr[$i]['inode'], 2, $bn);
			if($arr[$i]['is_deleted']){
				$color = "FF0000";
			}else{
				$color = "000000";
			}
		if($odd){
		?>
		<tr style="color:<?=$color;?>" class="odd" onmouseover="showPanel('<?=$str.$i;?>')" onmouseout="hidePanel('<?=$str.$i;?>')">		
		<?}else{?>
		<tr style="color:<?=$color;?>" onmouseover="showPanel('<?=$str.$i;?>')" onmouseout="hidePanel('<?=$str.$i;?>')">
		<?}?>	
			<td style='text-align: center'><input type='checkbox' name='bookmark_it<?=$str?>' value='<?=$arr[$i]['inode']?>|<?=$bn?>'></td>
			<?if($is_bookmark==0){?>
				<td style='text-align: center'><img id='star<?=$arr[$i]['inode'].$bn?>' src='../img/star_empty.png' style='cursor:pointer' onclick="displayMessage('modal_bookmark.php?arg1=2&arg2=<?=$arr[$i]['inode']?>&arg3=<?=$part_id?>&arg4=<?=$bn?>', '340', '250');return false"></td>
			<?}else{?>
				<td style='text-align: center'><img id='star<?=$arr[$i]['inode'].$bn?>' src='../img/star.png' style='cursor:pointer' onclick="delete_bookmark('2', '<?=$arr[$i]['inode']?>', '<?=$part_id?>', '<?=$bn?>');"></td>
			<?}?>
			<td><?=htmlspecialchars($arr[$i]['file_name']);?></td>
			<td><?=$arr[$i]['inode'];?></td>
			<td style='text-align: center; width: 60px'>
				<div id='panel<?=$str.$i;?>' style='display:none'>
				<img style='cursor:pointer' src='../img/file_info.png' title='Show file details' onclick="displayMessage('modal_search_info.php?arg1=<?=$arr[$i]['id'];?>', '600', '250');return false">
				<img style='cursor:pointer' src='../img/view_file.png' title='Show file content' onclick="displayMessage('modal_file_content.php?arg1=<?=$offset;?>&arg2=<?=$arr[$i]['inode'];?>&arg3=<?=urlencode($filename);?>', '800', '500'); return false">
				<img style='cursor:pointer' src='../img/export.png' title='Export' onclick="window.location = 'export_file.php?arg1=<?=$offset;?>&arg2=<?=$arr[$i]['inode'];?>&arg3=<?=$nm;?>'">&nbsp;					
				</div>
			</td>			
		</tr>
	<?}?>
</table>
<?}else{
	new AuditLog('Unauthorized access to get_search ');
        header("location: goto_home.php");
}
?>
Return current item: Ptk-forensics