-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
55 lines (48 loc) · 1.62 KB
/
admin.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
<html>
<head>
<title>Admin</title>
</head>
<body>
<?php
$host="localhost";
$user="root";
$pass="password";
$db="songify";
$conn=mysqli_connect($host,$user,$pass,$db);
$name = $artist = $album = $duration = $songUrl = $albumArt = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["songName"];
$artist = $_POST["artist"];
$album = $_POST["album"];
$duration = $_POST["duration"];
$songUrl = 'songs/'.$_POST["songUrl"];
$albumArt = 'img/'.$_POST["albumArt"];
$query=$conn->query("INSERT INTO `featsong` (`name`,`artist`,`album`,`duration`,`fileName`,`albumArt`) VALUES ('$name','$artist','$album','$duration','$songUrl','$albumArt')");
if($query)
{
header("location:admin.php");
}
else
{
echo "no";
echo mysqli_error("$conn");
}
}
?>
<form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<label>Song Name</label>
<input type="text" name="songName" required=""><br>
<label>Artist</label>
<input type="text" name="artist" required=""><br>
<label>Album Name</label>
<input type="text" name="album" required=""><br>
<label>Duration</label>
<input type="text" name="duration" required=""><br>
<label>Song Url</label>
<input type="file" name="songUrl" required=""><br>
<label>Album Art</label>
<input type="file" name="albumArt" required=""><br>
<input type="submit" value="Submit">
</form>
</body>
</html>