<?php session_start(); include_once "users_bd.php"; if (isset($_POST['addUser'])) { $_SESSION["ajoutUtilisateur"] = false; if (isset($_POST)) { $userBD = new UsersBD(); $user = new User(-1, $_POST['nom'], $_POST['prenom'], $_POST['login'], $_POST['motdepasse'], 0); $_SESSION["ajoutUtilisateur"] = $userBD->addUser($user); } header('Location: ../signin.php'); } else { if (isset($_POST['connectUser'])) { $_SESSION["utilisateur"] = null; if (isset($_POST)) { $userBD = new UsersBD(); $_SESSION["utilisateur"] = $userBD->getUserConnection($_POST['login'], $_POST['motdepasse']); if (empty($_SESSION["utilisateur"])) { $_SESSION["erreurConnexionUtilisateur"] = true; } } header('Location: ../signin.php'); } } ?>
<?php include_once "movies_bd.php"; include_once "users_bd.php"; session_start(); $userBD = new UsersBD(); $idUser = $_SESSION['utilisateur']->getId(); if (isset($idUser) && $userBD->getUser($idUser) != null) { $movieBD = new MoviesBD(); if (isset($_POST['add'])) { $_SESSION["ajout"] = false; print_r($_POST); if (isset($_POST)) { $movie = new Movie(-1, $idUser, $_POST['titre'], $_POST['resume'], $_POST['synopsis'], $_POST['realisateur'], $_POST['annee'], $_FILES['affiche']['name'], $_POST['categorie']); $_SESSION["ajout"] = $movieBD->addMovie($movie, $_FILES['affiche'], $idUser); } header('Location: ../add.php'); } else { if (isset($_POST['edit'])) { $_SESSION["edit"] = false; if (isset($_POST)) { $movie = $movieBD->getMovie($_POST['id'], $idUser); $movie->setTitle(isset($_POST['titre']) ? $_POST['titre'] : $movie->getTitle()); $movie->setDescriptionShort(isset($_POST['resume']) ? $_POST['resume'] : $movie->getDescriptionShort()); $movie->setDescriptionLong(isset($_POST['synopsis']) ? $_POST['synopsis'] : $movie->getDescriptionLong()); $movie->setDirector(isset($_POST['realisateur']) ? $_POST['realisateur'] : $movie->getDirector()); $movie->setYear(isset($_POST['annee']) ? $_POST['annee'] : $movie->getYear()); $movie->setImage(empty($_FILES['affiche']['name']) ? $movie->getImage() : $_FILES['affiche']['name']); $movie->setCategory(isset($_POST['categorie']) ? $_POST['categorie'] : $movie->getCategory()); print_r($movie); $_SESSION["edit"] = $movieBD->updateMovie($movie, empty($_FILES['affiche']['nom']) ? null : $_FILES['affiche']);
<?php include_once "includes/include.php"; $movies = new MoviesBD(); $users = new UsersBD(); $categories = new CategoriesBD(); ?> <!doctype html> <html> <head> <?php include "includes/head.php"; ?> </head> <body> <?php include_once "includes/navbar.php"; ?> <div class="container"> <h1 class="center">Administration</h1> <ul class="nav nav-tabs nav-center"> <li class="active"><a data-toggle="tab" href="#Film">Films</a></li> <li><a data-toggle="tab" href="#Categorie" >Categories</a></li> <li><a data-toggle="tab" href="#Utilisateur" >Utilisateurs</a></li> </ul> <div class="tab-content"> <div class="tab-pane fade in active" id="Film"> <table class="table table-hover"> <thead>