function dir_header($title) { echo common_header($title); echo <<<_END <link rel="stylesheet" href="/css/styles.css"> _END; begin_body(); }
session_start(); if (!isset($_SESSION['user_id'])) { header('Location: index.php'); } $images = getImagesByUser('slike.txt'); $imgGallery = getGalleriesIds(array_keys($images), 'slike.txt'); $galleries = getGalleriesNames(array_values($imgGallery), 'galerije.txt'); $brElement = create_element("br", false, null); create_doctype(); begin_html(); begin_head(); echo create_element("a", true, ["href" => "index.php", "contents" => "Home page"]), $brElement; echo create_element("a", true, ["href" => "upload.php", "contents" => "Upload a new photo"]), $brElement; echo create_element("a", true, ["href" => "new_gallery.php", "contents" => "Create a new gallery"]), $brElement; echo create_element("h1", true, ["contents" => "Your photos:"]); end_head(); begin_body(); $listElements = array(); foreach ($images as $key => $value) { $imgContent = create_element("img", false, ["src" => "picture.php?id={$key}&size=small"]); $imgTitle = create_element("h3", true, ['contents' => $value]); $galleryTitle = create_element("h5", true, ['contents' => $galleries[$imgGallery[$key]]]); $editLink = create_element("a", true, ['href' => "editphoto.php?id={$key}", 'contents' => 'Edit photo']); $elementContent = $imgTitle . $brElement . $imgContent . $brElement . $galleryTitle . $brElement; $elementContent .= $editLink . $brElement; $listElement = create_element("li", true, ["contents" => $elementContent]); array_push($listElements, $listElement); } echo create_element("ul", true, ["contents" => $listElements]); end_body(); end_html();
} if ($category == 3) { $categoryThreeCounter++; $categoryThree[$question] = substr($answer, 1); } } fclose($handle); } else { // error opening the file. } create_doctype(); begin_html(); begin_head(); echo create_element("h1", true, ["contents" => "Kviz"]); end_head(); begin_body(null); start_form("rezultati.php", "POST"); create_table(["border" => "1px"]); $questionId = 0; $_SESSION['cat1counter'] = $categoryOneCounter; $_SESSION['cat2counter'] = $categoryTwoCounter; $_SESSION['cat3counter'] = $categoryThreeCounter; foreach ($categoryOne as $key => $value) { $cell1 = $key; $options = array(); for ($i = 0; $i < count($value) - 1; $i++) { array_push($options, create_element("option", true, ["contents" => $value[$i]])); } $_SESSION["1_.{$questionId}._answer"] = $value[count($value) - 1]; $cell2 = create_select(["name" => '1_' . $questionId, "contents" => $options]); echo create_table_row(["contents" => array(create_table_cell(["contents" => $cell1]), create_table_cell(["contents" => $cell2]))]);