-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathuploaded_songs.php
475 lines (430 loc) · 15.4 KB
/
uploaded_songs.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<?php
session_start();
if(!isset($_SESSION['email_address']))
header('location:index.php');
include('connection.php');
if(isset($_POST['upload'])){
$audio_file = $_FILES['audio_file']['name'];
$song_name = mysqli_real_escape_string($conn,$_POST['song_name']);
$song_format = mysqli_real_escape_string($conn,$_POST['song_format']);
if(isset($_FILES['audio_file'])){
$file_name = $_FILES['audio_file']['name'];
$file_size = $_FILES['audio_file']['size'];
$file_tmp = $_FILES['audio_file']['tmp_name'];
$file_type = $_FILES['audio_file']['type'];
move_uploaded_file($file_tmp,"songs/uploaded_songs/".$file_name);
}
$email_address = $_SESSION['email_address'];
$sql = "SELECT * FROM user WHERE email_address = '$email_address' ";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result);
$singer_id = $row['user_id'];
$singer_name = $row['username'];
$song_image = 'musical-world.jpg';
$sql="CALL uploadsongs('$singer_id','$song_name','$song_format','$singer_name','$song_image','$audio_file')";
// $sql = "INSERT INTO upload_albums(`singer_id`,`song_name`,`song_format`,`singer_name`,`song_image`,`audio_file`) VALUES('$singer_id','$song_name','$song_format','$singer_name','$song_image','$audio_file')";
$result = mysqli_query($conn,$sql);
if($result){
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Uploaded"," <b>You have successfully uploaded your song '.$song_name.'</b>","success");';
echo '}, 500);</script>';
}else{
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Oops..."," Error while uploading.Please check your internet coonection!","error");';
echo '}, 500);</script>';
}
}
$username = $_SESSION['username'];
$sql = "SELECT * FROM user WHERE username = '$username' ";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($result);
$user_id = $row['user_id'];
$sql = "SELECT * FROM upload_albums ORDER BY song_id ASC";
$result = mysqli_query($conn,$sql);
while($rows = mysqli_fetch_array($result)){
$song_id = $rows['song_id'];
if(isset($_POST[$song_id])){
$sql = "SELECT * FROM favorite_songs WHERE song_id = '$song_id' AND cat_id = '4' AND user_id = '$user_id' ";
$results = mysqli_query($conn,$sql);
if(mysqli_num_rows($results)>0){
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Warning","<b> You have already added this song to your favorite list!!...</b>","error");';
echo '}, 500);</script>';
}else{
$sql = "SELECT * FROM upload_albums WHERE song_id = '$song_id' ";
$results = mysqli_query($conn,$sql);
$row = mysqli_fetch_array($results);
$song_id = $row['song_id'];
$song_name = $row['song_name'];
$singer_name = $row['singer_name'];
$song_image = $row['song_image'];
$audio_file = $row['audio_file'];
$sql = "INSERT INTO favorite_songs(`cat_id`,`song_id`,`user_id`,`song_name`,`singer_name`,`song_image`,`audio_file`) VALUES('4','$song_id','$user_id','$song_name','$singer_name','$song_image','$audio_file') ";
$results = mysqli_query($conn,$sql);
if($results){
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Added"," <b>Song '.$song_name.' is successfully added to your favorite songs</b>","success");';
echo '}, 500);</script>';
}else{
echo '<script type="text/javascript">';
echo 'setTimeout(function () { sweetAlert("Oops...","<b> Error while adding.Please check your internet coonection!</b>","error");';
echo '}, 500);</script>';
}
}
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Musical World | Uploaded Songs</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<link rel="icon" href="images/i1.png" />
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.5.14/css/mdb.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- font-awesome icons -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- //Custom Theme files -->
<!--webfonts-->
<link href="//fonts.googleapis.com/css?family=Ubuntu:300,300i,400,400i,500,500i,700,700i" rel="stylesheet">
<!--//webfonts-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.min.css">
<style>
/* card details start */
@import url('https://fonts.googleapis.com/css?family=Raleway:400,400i,500,500i,600,600i,700,700i,800,800i,900,900i|Roboto+Condensed:400,400i,700,700i');
section{
padding: 100px 0;
}
.details-card {
background: #ecf0f1;
}
.card-content {
background: #ffffff;
border: 4px;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);
}
.card-img {
position: relative;
overflow: hidden;
border-radius: 0;
z-index: 1;
}
.card-img img {
width: 100%;
height: auto;
display: block;
}
.card-img span {
position: absolute;
top: 15%;
left: 12%;
background: #1ABC9C;
padding: 6px;
color: #fff;
font-size: 12px;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
transform: translate(-50%,-50%);
}
.card-img span h4{
font-size: 12px;
margin:0;
padding:10px 5px;
line-height: 0;
}
.card-desc {
padding: 1.25rem;
}
.card-desc h3 {
color: #000000;
font-weight: 600;
font-size: 1.0em;
line-height: 1.3em;
margin-top: 0;
margin-bottom: 5px;
padding: 0;
}
.card-desc p {
color: #747373;
font-size: 14px;
font-weight: 400;
font-size: 1em;
line-height: 1.5;
margin: 0px;
margin-bottom: 20px;
padding: 0;
font-family: 'Raleway', sans-serif;
}
.btn-card{
background-color: #1ABC9C;
color: #fff;
box-shadow: 0 2px 5px 0 rgba(0,0,0,.16), 0 2px 10px 0 rgba(0,0,0,.12);
padding: .84rem 2.14rem;
font-size: .81rem;
-webkit-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
-o-transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
margin: 0;
border: 0;
-webkit-border-radius: .125rem;
border-radius: .125rem;
cursor: pointer;
text-transform: uppercase;
white-space: normal;
word-wrap: break-word;
color: #fff;
}
.btn-card:hover {
background: orange;
}
a.btn-card {
text-decoration: none;
color: #fff;
}
.col-md-3{
padding-bottom:30px;
padding-left:30px;
}
/* End card section */
</style>
</head>
<body>
<!-- header -->
<header>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light">
<a class="navbar-brand" href="index.html">
Musical World
</a>
<pre> </pre>
<li class="nav-item">
<b style="font-size:20px;"><p style="color:blue;"><?php echo "Logged in as ".$_SESSION['username'];?></p></b>
<p style="color:blue;">| Uploaded Songs |</p>
</li>
<button class="navbar-toggler ml-lg-auto ml-sm-5" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav text-center ml-auto">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">Track</button>
<div class="dropdown-menu dropdown-primary">
<a class="dropdown-item" href="kannada_songs.php"><b>Kannada Songs</b></a>
<a class="dropdown-item" href="hindi_songs.php"><b>Hindi Songs</b></a>
<a class="dropdown-item" href="english_songs.php"><b>English Songs</b></a>
<a class="dropdown-item" href="uploaded_songs.php"><b>Uploaded Songs</b></a>
</div>
</div>
<li class="nav-item">
<a class="nav-link scroll" href="favorite_list.php"><i class='fa fa-heart' style='font-size:40px;color:red'></i></a>
</li>
<li class="nav-item">
<a class="nav-link scroll" href="#contact">contact</a>
</li>
<li class="nav-item">
<a class="nav-link scroll" href="logout.php">logout</a>
</li>
</ul>
</div>
</nav>
</div>
</header>
<!-- //header -->
<center><br><b><div class="alert alert-primary" role="alert">
Are you a singer?...<a href="#" class="alert-link">Upload your songs below</a>. And get featured.
</div><b><center>
<form method="post" action="uploaded_songs.php" enctype="multipart/form-data">
<div class="form-row">
<div class="col">
<div class="form-group btn btn-primary">
<input type="file" class="form-control-file" id="exampleInputFile" aria-describedby="fileHelp" name="audio_file" required>
</div>
</div>
<div class="col">
<div class="md-form mb-4">
<input type="text" id="form1" class="form-control validate" name="song_name" required>
<label data-error="wrong" data-success="right" for="form1">Song Name</label>
</div>
</div>
<div class="col">
<div class="md-form mb-4">
<input type="text" id="form2" class="form-control validate" name="song_format" required>
<label data-error="wrong" data-success="right" for="form2">Song Format</label>
</div>
</div>
<div class="col">
<div class="text-center">
<button type="submit" name="upload" class="btn btn-default btn-rounded mb-4">Upload <i class="fa fa-upload"></i></button>
</div>
</div>
</div>
</form>
<center><b><div class="alert alert-primary" role="alert">
Most featured songs...<a href="#" class="alert-link">Listen to music </a>. And have fun.
</div><b><center>
<?php
include('connection.php');
$sql = "SELECT * FROM upload_albums ORDER BY song_id ASC";
$result = mysqli_query($conn,$sql);
echo "<section class='details-card'>
<div class='container'>
<div class='row'>
";
if(mysqli_num_rows($result)>0){
while($row = mysqli_fetch_array($result)){
$song_id = $row['song_id'];
$song_name = $row['song_name'];
$singer_name = $row['singer_name'];
$song_image = $row['song_image'];
$audio_file = $row['audio_file'];
echo "
<div class='col-md-3'>
<form method='post' action='uploaded_songs.php'>
<div class='card-deck'>
<div class='card-img'>
<img src='songs/uploaded_songs/img/$song_image' style='width:350px;height:250px;' alt=''>
</div>
<div class='card-desc'>
<h3>$song_name | $singer_name</h3>
<audio class='embed-responsive-item' controls='' preload='none'> <source src='songs/uploaded_songs/$audio_file' type='audio/mp3'></audio><br>
<div class='row'><button type='submit' class='btn-card' style='color:red'; name='$song_id'><i class='fa fa-heart'></i></button><br></div><br>
</div>
</div>
</form>
</div>
";
echo "<br><br>";
}
}
echo "</div>
</div>
</section>
";
?>
<!-- contact top -->
<div class="contact-top text-center" id="more_info">
<div class="content-contact-top">
<h3 class="stat-title text-white">for more information</h3>
<h2 class="stat-title text-white">stay in touch</h2>
<p class="text-white w-75 mx-auto">Musical World a unique platform for upcoming singers.
</p>
</div>
</div>
<!-- //contact top -->
<!-- contact -->
<div class="w3-contact py-5" id="contact">
<div class="container">
<div class="row contact-form pt-md-5">
<!-- contact details -->
<div class="col-lg-6 contact-bottom d-flex flex-column contact-right-w3ls">
<h5>get in touch</h5>
<div class="fv3-contact">
<div class="row">
<div class="col-2">
<span class="fas fa-envelope-open"></span>
</div>
<div class="col-10">
<h6>email</h6>
<p>
<a href="mailto:[email protected]" class="text-dark">[email protected]</a>
</p>
</div>
</div>
</div>
<div class="fv3-contact my-4">
<div class="row">
<div class="col-2">
<span class="fas fa-phone-volume"></span>
</div>
<div class="col-10">
<h6>phone</h6>
<p>+91 7899496873</p>
</div>
</div>
</div>
<div class="fv3-contact">
<div class="row">
<div class="col-2">
<span class="fas fa-home"></span>
</div>
<div class="col-10">
<h6>address</h6>
<p>DSI Labz | Adyar Mangalore</p>
</div>
</div>
</div>
</div>
<div class="col-lg-6 wthree-form-left my-lg-0 mt-5">
<h5>send us a mail</h5>
<!-- contact form grid -->
<div class="contact-top1">
<form action="#" method="get" class="contact-wthree">
<div class="form-group d-flex">
<label>
Name
</label>
<input class="form-control" type="text" placeholder="Name" name="email" required="">
</div>
<div class="form-group d-flex">
<label>
Email
</label>
<input class="form-control" type="email" placeholder="email" name="email" required="">
</div>
<div class="form-group d-flex">
<label>
Phone
</label>
<input class="form-control" type="text" placeholder="phone number" name="email" required="">
</div>
<div class="form-group d-flex">
<label>
Message
</label>
<textarea class="form-control" rows="5" id="contactcomment" placeholder="Your message" required></textarea>
</div>
<div class="d-flex justify-content-end">
<button type="submit" class="btn btn-agile btn-block w-50">Submit</button>
</div>
</form>
</div>
<!-- //contact form grid ends here -->
</div>
</div>
<!-- //contact details container -->
</div>
</div>
<!-- //contact -->
<!-- copyright -->
<div class="cpy-right text-center">
<p>© 2018 Musical World. All rights reserved</p>
</div>
<!-- //copyright -->
<!-- js-->
<script src="js/jquery-2.2.3.min.js"></script>
<!-- js-->
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.5.14/js/mdb.min.js"></script>
<!-- start-smooth-scrolling -->
<script src="js/move-top.js "></script>
<script src="js/easing.js "></script>
<script src="js/SmoothScroll.min.js "></script>
<!-- //smooth-scrolling-of-move-up -->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.js"></script>
<!-- //Bootstrap Core JavaScript -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.min.js"></script>
</body>
</html>