/
audit_Truncate.php
95 lines (76 loc) · 2.18 KB
/
audit_Truncate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?PHP
/*
* Practical Agile Scrum tool
*
* Copyright 2013-2017, P.P. Labuschagne
* Released under the MIT license.
* https://github.com/paul-lab/practical-agile/blob/master/_Licence.txt
*
* Homepage:
* http://practicalagile.co.uk
* http://practicalagile.uk
*
*/
include 'include/header.inc.php';
?>
<script>
$(function() {
var date = new Date();
date.setMonth(date.getMonth() - 12);
$('.date').datepicker({
numberOfMonths: 1,
dateFormat: "yy-mm-dd",
showButtonPanel: true
});
});
$(document).ready(function(){
var date = new Date();
date.setMonth(date.getMonth() - 12);
$("#Start_Date").datepicker( "setDate" , date );
});
</script>
<?PHP
$showForm = true;
if (isset($_POST['ok'])) header('Location: project_List.php');
if (isset($_POST['truncateit'])){
$sql = 'TRUNCATE TABLE audit';
$DBConn->directsql($sql);
auditit(0,0,$_SESSION['Email'],'Audit log truncated','All records deleted and index reset');
echo '<center><P><B>All Audit records Deleted.</B><P>';
$showForm = false;
}
if (isset($_POST['beforedate'])){
$sql = "DELETE FROM audit where audit.When<'".$_REQUEST['Start_Date']."'";
$DBConn->directsql($sql);
auditit(0,0,$_SESSION['Email'],'Audit log truncated','All records before '.$_REQUEST['Start_Date'].' deleted');
echo '<center><P><B>All records before '.$_REQUEST['Start_Date'].' deleted</B><P>';
$showForm = false;
}
if ($showForm==false)
{
echo '<center><p><p><form enctype="multipart/form-data" method="post" action="?">';
echo ' <br><input class="btn" type="submit" name="ok" value="OK">';
echo ' </form></center>';
}
if ($showForm)
{
if ($Usr['Admin_User']==1 )
{
?>
<center><P>
<form enctype="multipart/form-data" method="post" action="?">
<table>
<tr><td><td><p>
<tr><td><input class="btn" type="submit" name="beforedate" value="Delete">
</td><td> all audit history for <b>all</b> projects before <input type="text" class="date" id="Start_Date" name="Start_Date"></td></tr>
<tr><td><td><p>
<tr><td><input class="btn" type="submit" name="truncateit" value="Delete">
</td><td> <b>all</b> Audit history for <b>all</b> projects and reset the log</td></tr>
</table>
</form>
</center>
<?php
}
}
include 'include/footer.inc.php';
?>