-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfound.php
58 lines (58 loc) · 1.18 KB
/
found.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
<?php
$user=$_POST['pId'];
$conn=mysqli_connect("localhost","root","","pdept");
if(!$conn)
die("connection with database failed");
$query="select count(*) as num from police where pid='$user'";
$result=mysqli_query($conn,$query);
if(!$result)
{
die("database connection error");
}
if($result->fetch_assoc()["num"]<=0)
{
die("user does not exist");
}
if(isset($_POST['add'])==TRUE)
{
if(strlen($_POST['found'])>0)
{
$a=$_POST['found'];
$query="insert into found values('$a')";
$result=mysqli_query($conn,$query);
if(!$result)
{
die("Announcement could not be inserted");
}
header("location: plogin.php?pId=$user");
}
}
?>
<html>
<body>
<style>
fieldset
{
border:0;
margin-top:100;
margin-left:200;
}
</style>
<script>
function space(n)
{
for(var i=0;i<n;++i)
{
document.write(" ");
}
}
</script>
<form method="post">
<fieldset>
<input type="hidden" name="pId" value="<?php echo $user; ?>">
<script>space(20);</script>Enter the Item found :    <input type="text" name="found" size="50" maxlength="30"><br><br>
<script>space(95);</script><input type="submit" name="add">
</fieldset>
</form>
</body>
</html>