-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriteData.php.bak
More file actions
executable file
·58 lines (42 loc) · 1.31 KB
/
writeData.php.bak
File metadata and controls
executable file
·58 lines (42 loc) · 1.31 KB
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
<?php
include("include/headerscript.php");
if(!empty($_POST)) {
$inputVars = $_POST;
} else {
$inputVars = $_GET;
}
if(@$inputVars['process_name'] == NULL) {
$inputVars['process_name'] = '';
}
if(@$inputVars['allow_duplicates'] != 1
&& @$inputVars['allow_cleared_duplicates'] != 1) {
if(@$inputVars['allow_duplicates'] != 1) {
$sql = 'SELECT * FROM Events WHERE Repo = ?
AND Node = ?
AND Data = ?
AND (Cleared_By IS NULL
OR Cleared_By = "")';
} elseif(@$inputVars['allow_cleared_duplicates'] != 1) {
$sql = 'SELECT * FROM Events WHERE Repo = ?
AND Node = ?
AND Data = ?';
}
$stmt = $conn->prepare($sql);
$stmt->bind_param("sss", $inputVars['repo'], $inputVars['node'], $inputVars['data']);
$stmt->execute();
$rows = $stmt->get_result();
$is_duplicate = ($rows->num_rows > 0 ? true : false);
}
if(!$is_duplicate || @$inputVars['allow_duplicates']) {
$stmt = $conn->prepare('INSERT INTO Events (Repo, User, Node, Data, DataSetIndex, Process_Name) VALUES (?,?,?,?,?,?)');
$stmt->bind_param("ssssis", $inputVars['repo'], $inputVars['user'], $inputVars['node'], $inputVars['data'], $inputVars['dataset'], $inputVars['process_name']);
$success = $stmt->execute();
if($success) {
echo('success');
} else {
echo('failure');
}
} else {
echo('failure: is duplicate');
}
?>