-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-for.php
164 lines (130 loc) · 5.04 KB
/
post-for.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="materialize/css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="materialize/material-icon/material-icon.css" media="screen,projection"/>
<script src="materialize/js/jquery-3.3.1.min.js"></script>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Post for Adoption</title>
</head>
<body>
<nav>
<div class="nav-wrapper blue-grey darken-1">
<a href="Main-Page.php" class="brand-logo"> <img src="photos/Untitled-2.png" style="height: 100px; width: 150px;"> </a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="adopt.php">Adopt a Pet</a></li>
<li><a href="rescue.php">Rescue Mission</a></li>
<li><a href="post-for.php">Post for Adoption</a></li>
<li><a href="log-in.php">Sign in</a></li>
<li><a href="register.php">Register</a></li>
</ul>
</div>
</nav>
<br>
<div class="row valign-wrapper">
<div class="col s6 offset-s3 valign">
<div class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title">Post for Adoption</span>
<div class="row">
<form class="col s12 white">
<div class="row">
<div class="input-field col s5 offset-2">
<input name="group1" type="radio" id="test1" />
<label for="test1">Cat</label>
</div>
<div class="input-field col s6">
<input name="group1" type="radio" id="test2" />
<label for="test2">Dog</label>
</div>
<div class="input-field col s8 offset-s2">
<input name="breed" id="breed" type="text" class="validate">
<label for="breed">Breed</label>
</div>
<div class="input-field col s8 offset-s2">
<input id="loc" type="text" class="validate">
<label for="loc">Condition</label>
</div>
<form action="#">
<div class="file-field input-field col s8 offset-s2">
<div class="btn blue-grey darken-1">
<span>File</span>
<input name="fileToUpload" type="file">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
</form>
<div class="input-field col s5 offset-2">
<input name="group2" type="radio" id="test3" />
<label for="test3">For Adoption</label>
</div>
<div class="input-field col s6">
<input name="group2" type="radio" id="test4" />
<label for="test4">For Rescue</label>
</div>
<div class="input-field col s6 offset-s4">
<a class="waves-effect waves-light btn blue-grey lighten-5 blue-grey-text text-darken-1" id="signin" name="signin" style="font-weight: bolder;">Submit</a>
<a class="waves-effect waves-light btn blue-grey darken-1" id="signin" style="font-weight: bolder;">Submit</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script>
</script>
<form name="form1" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
Animal Type<input type="text" name="dog" id="dog">
Status<input type="text" name="status" id="status">
Availability<input type="text" name="availability" id="availability">
Location<input type="text" name="location" id="location">
<input type="submit" value="Upload Image" name="submit">
</form>
<?php
$target_dir = "photos/";
$target_file = $target_dir. basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check != false) {
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
if($uploadOk)
{
}
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);
$conn=new mysqli("localhost", "root", "", "adoptors");
$sql="INSERT INTO dogandpussy(dogcat, status, availability, location, images) values('','','','','$target_file')";
if ($conn->query($sql)) {
# code...
echo "<img src='$target_file'>";
}
else{
$conn->error;
}
}
?>
<?php
$sql="SELECT * FROM dogandpussy";
$result_set=mysql_query($sql);
?>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="materialize/js/materialize.min.js"></script>
<script type="text/javascript" src="materialize/js/materialize.js"></script>
</body>
</html>