-
Notifications
You must be signed in to change notification settings - Fork 3
/
new_album.php
34 lines (28 loc) · 1.13 KB
/
new_album.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
<?php if(!empty($_SESSION['login_admin'])):?>
<?php
include "database.php";
if((isset($_POST["album_name"]) && $_POST["singer_id"] != 0))
{
echo $_POST["singer_id"];
$name = $_POST["album_name"];
$singer_id = $_POST["singer_id"];
if($_FILES["image"]['name'] != "")
{
$date = date('Y-m-d H:i:s');
$date = str_replace(':','-',$date);
$img_name = "img/singers/".$date.$_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'],$img_name);
}
else
$img_name = "";
$db->query("INSERT INTO `albums`(name, image,singers_id) VALUES('$name','$img_name','$singer_id')");
header("Location:admin_albums.php");
}
else
{
echo"else";
header("Location:admin_albums.php");
}
?>
<?php else:{header("Location: index.php");} ?>
<?php endif; ?>