-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddstolen.php
61 lines (60 loc) · 2.04 KB
/
addstolen.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
<!--==Author (c)frankline_bwire==-->
<?php
include 'connect.php';
$dname='';
$dtype='';
$dmodel='';
$dimei='';
if(isset($_POST['submit'])){
$dname=mysqli_real_escape_string($conn, $_POST['dname']);
$dtype=mysqli_real_escape_string($conn, $_POST['dtype']);
$dmodel=mysqli_real_escape_string($conn, $_POST['dmodel']);
$dimei=mysqli_real_escape_string($conn, $_POST['dimei']);
//Check if user device exist
$user_check = "SELECT * FROM imei_reports WHERE imei='$dimei' LIMIT 1";
$result = mysqli_query($conn, $user_check);
$device = mysqli_fetch_assoc($result);
if ($device) { // if user exists
if ($device['imei'] === $dimei) {
array_push($errors, "device already exists");
}
}
//post to database
$query="insert into imei_reports (name,type,model,imei) values ('$dname','$dtype','$dmodel','$dimei')";
if(!mysqli_query($conn,$query)){
echo "ERROR: Could not execute query. " . mysqli_error($conn);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Report Stolen</title>
</head>
<body>
<h3>This modules allows you to add a stolen or lost device and an alert will be sent to the user once the device is discovered.</h3>
<form method="post" action="addstolen.php">
<?php include('errors.php'); ?>
<div>
<label for="dname">Phone Name</label>
<input type="text" name="dname" placeholder="Samsung">
</div>
<div>
<label for="dtype">Phone Type</label>
<input type="text" name="dtype" placeholder="S8 Edge">
</div>
<div>
<label for="dmodel">Phone Model</label>
<input type="text" name="dmodel" placeholder="S300m">
</div>
<div>
<label for="dimei">Phone IMEI No.</label>
<input type="text" name="dimei" placeholder="33003600">
</div>
<input type="submit" name="submit" value="Add">
</form>
<input type="submit" name="logout" src="logout.php" value="SignOut">
</body>
</html>
<!--==Author (c)frankline_bwire==-->