Location: PHPKode > projects > Ptk-forensics > ptk/lib/modal_case.php
<?
/*
PTK  - DFLabs
Copyright (C) 2008 - DFLabs srl - All rights reserved
hide@address.com
*/
include("check_session.php");
include("lib_std.php");
include("sanitize.php");
if (strcmp($_SESSION['user'],"admin")==0){
	$case = case_list();
	$str= '-';
	foreach($case as $case){
		$str .= $case['name']."-";
	}
	echo "<script type='text/javascript'>var case_names = '$str';</script>";
	if (isset($_GET['tk'])){
		$case_token = sanitize(RemoveXSS($_GET['tk']),PARANOID);
	}else{
		$case_token = "notdef";
	}
	?>
	<script type='text/javascript'>
	function check_case_name(){
		var name = "-"+document.getElementById('case_name').value+"-";
		if (case_names.match(name)){		
			return false;
		}else{
			return true;
		}
	}
	</script>
	<b style="float:left">Create new case</b><img style="float:right; cursor: pointer" src="../img/cancel.png" onclick="closeMessage()">
	<br><hr>
	<form method="post" action="new_case.php" name="caseForm" onsubmit="return check_case_name()">
		<input type=hidden name=ptktoken VALUE="<?=$case_token?>"/>
		<table class="form">
			<tr><td>*Case name: </td><td> <input id="case_name" name="name" style="width:220px"></td></tr>
			<tr><td style="vertical-align: top">Description: </td><td> <textarea name="description" class="case"></textarea></td></tr>
			<tr><td></td></tr>
			<tr><td></td></tr>
			<tr><td></td><td style="text-align: right"><input type="submit" value="Create" onclick="if(check_case_name()){closeMessage()}else{alert('Warning: case already exists');}"></td></tr>
		</table>
		<script type="text/javascript">
		document.caseForm.name.focus();
		</script>	
	</form>
<?}?>
Return current item: Ptk-forensics