This repository was archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecEvidence.php
More file actions
55 lines (46 loc) · 1.64 KB
/
RecEvidence.php
File metadata and controls
55 lines (46 loc) · 1.64 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
<?PHP
include('SQLFunctions.php');
session_start();
$table = 'evidenceType';
echo '<br>display full contents of the _POST: <br>';
var_dump($_POST);
$link = f_sqlConnect();
$check = "SELECT * FROM $table WHERE eviTypeName = '".$_POST['EviTypeName']."'";
$UserID = $_SESSION['userID'];
$user = "SELECT username FROM users_enc WHERE UserID = ".$UserID;
if($result=mysqli_query($link,$user))
{
/*from the sql results, assign the username that returned to the $username variable*/
while($row = mysqli_fetch_assoc($result)) {
$Username = $row['username'];
}
}
$keys = implode(", ", (array_keys($_POST)));
echo '<br>Parsed Key: ' .$keys;
$values = implode("', '", (array_values($_POST)));
echo '<br>Parsed Values: ' .$values;
if(!f_tableExists($link, $table, DB_NAME)) {
die('<br>Destination table does not exist:'.$table);
}
$result = mysqli_query($link,$check);
$num_rows = mysqli_num_rows($result);
if ($num_rows > 0) {
header("location: $duplicate?msg=1");
}
else {
$sql = "INSERT INTO $table($keys, lastUpdated, updatedBy) VALUES ('$values', NOW(), '$UserID')";
//echo '<br>sql: ' .$sql;
//echo '<br>Num_rows: ' .$num_rows;
if (!mysqli_query($link,$sql)) {
echo '<br>Error: ' .mysqli_error($link);
if(!empty($rejectredirecturl)) {
//header("location: $rejectredirecturl?msg=1");
echo $sql;
}
}else if(!empty ($rejectredirecturl)) {
header("location: DisplayEviType.php");
//echo "Success";
}
}
mysqli_close($link);
?>