error_reporting(0); session_start(); if (isset($_SESSION['username']) && !empty($_SESSION['username'])) { $session = $_SESSION['username']; } else { header('Location: index.php?error=login'); } require_once 'inc/functions.php'; require_once 'inc/config.php'; if (!file_exists('sc_projects') || empty($dbName) || !tablesExist($pdo)) { header('Location: install.php'); exit; } $sectionsInUse = getSectionsInUse($pdo); $allSections = getAllSections($pdo); $sectionsNotInUse = []; foreach ($allSections as $section) { $inUse = false; foreach ($sectionsInUse as $sec) { if ($sec['section_name'] === $section['section_name']) { $inUse = true; } } if (!$inUse) { array_push($sectionsNotInUse, $section); } } $projectsWithoutSections = getProjectsWithoutSections($pdo); ?>
$bdd = new PDO('mysql:host=localhost;dbname=veloco;charset=utf8', 'root', ''); } catch (Exception $e) { die('Erreur : ' . $e->getMessage()); } if (isset($_POST["query"])) { if ($_POST["query"] == "download") { download(); } else { if ($_POST["query"] == "upload") { upload(); } else { if ($_POST["query"] == "uploadSections") { uploadSections(); } else { if ($_POST["query"] == "getAllSections") { getAllSections(); } else { if ($_POST["query"] == "affichageTrace") { affichageTrace(); } else { echo "erreur"; } } } } } } // upload file function upload() { global $bdd;
<?php if (isset($_REQUEST["category_saved"])) { ?> <p>Category has been successfully saved</p> <?php } ?> <form class="front-end-form"> <input type="text" name="category" id="category_name" placeholder="Enter category:"> <input type="text" name="category-translation" id="category_fr_name" placeholder="Enter french category translation:"> <select data-placeholder="Choose a section" name="section" id="section" class="chosen-select"> <option value="0"></option> <?php $sections = getAllSections(); foreach ($sections as $section) { ?> <option value="<?php echo $section["id"]; ?> "><?php echo $section["name"]; ?> </option> <?php } ?> </select> <select data-placeholder="Is category a parent category?" name="isparent" id="isparent" class="chosen-select">