* @author Antoine De Gieter * */ if (isset($_POST['add_artist']) && isset($_POST['name']) && isset($_POST['biography']) && isset($_SESSION['online']) && $_SESSION['online']) { $picture = htmlspecialchars($_POST['picture']); $name = utf8_decode(htmlspecialchars($_POST['name'])); $biography = utf8_decode(trim(htmlspecialchars($_POST['biography']))); $picture_name = explode(".", $_FILES["picture"]["name"]); $extension = end($picture_name); if (is_uploaded_file($_FILES["picture"]["tmp_name"]) && isset($_FILES["picture"]) && $_FILES["picture"]['error'] === 0 && in_array($extension, $allowed_extensions)) { $picture_name = strtolower(normalize(preg_replace("/[ '\"\\/]/", "", $name))) . '.' . $extension; $tmp_name = $_FILES["picture"]["tmp_name"]; $path = "./img/artists/" . $picture_name; move_uploaded_file($tmp_name, $path); $_SESSION['artistAdded'] = true; Page::goArtist(Artist::create($name, $biography, $_SESSION['user']->getId(), $picture_name)); } else { $_SESSION['error'] = true; } } #Process add album /** * * @author Antoine De Gieter * * */ if (isset($_POST['album_name']) && isset($_POST['disc']) && isset($_POST['release_date']) && isset($_POST['type'])) { $db = $_SESSION['db']; $album_name = utf8_decode(trim(htmlspecialchars($_POST['album_name']))); $disc = utf8_decode(trim(htmlspecialchars($_POST['disc'])));