<?php if (!defined("FRAMEWORK_LOADED")) { die("Invalid enter!"); } ?> <div id='main'> <div id="banner"> <img src='img/banner2.jpg' alt="banner"/> </div> <?php /** * User: Aleksandar Kresovic * Email: aleksandar.kresovic3@gmail.com * Date: 11/04/2015 * Time: 10:34 */ $flowers = Flower::getById(1); foreach ($flowers as $flower) { $img_arr = explode(",", $flower->image); echo "<div class='block'><h3>{$flower->name}</h3>\n {$flower->intro(121)}<br />"; Flower::getImage($img_arr, "vrtno"); echo "</div>"; } ?> </div>
<?php include "functions.php"; $db_table = $_POST['db']; $i = $_POST['number']; $flower = new Flower(); $rows = num_of_rows($db_table); $flower->set_fields($db_table, $_POST["color{$i}"], $_POST["height{$i}"], $_POST["width{$i}"], $_POST["description{$i}"], $_POST["price{$i}"], $_FILES["img"]["name"], $_POST["availability{$i}"]); $err_logs = $flower->get_validate_logs(); if ($err_logs['err_color'] == 1) { echo "Цвет менее, чем из 4 букв не существует, также не используйте цифры в названии цвета"; } if ($err_logs['err_float'] == 1) { echo "Указывайте высоту, ширину и цену целым или числом с плавающей точкой, например, 20.5"; } if (!empty($_FILES) and $_FILES['img']['size'] > 4000000) { echo "Администраторы, пожалейте сервер - уменьшите размер файла"; } else { if ($err_logs['err_color'] == 0 and $err_logs['err_float'] == 0) { if ($i != $rows) { $flower->update_bd($i + 1); } if ($i == $rows) { $flower->insert_to_bd(); } if (!empty($_FILES)) { $uploaddir = '../foto/roses/'; $uploadfile = $uploaddir . $_FILES["img"]["name"]; move_uploaded_file($_FILES["img"]['tmp_name'], $uploadfile); } echo "Данные успешно внесены.";
die("Invalid enter!"); } //require "../config.php"; /** * Created by PhpStorm. * User: korisnik * Date: 14/04/2015 * Time: 00:26 */ //ukoliko nije setovan f_id dodeli mu nulu sto znaci da vraca korisnika na index.php $searchId = isset($_GET['f_id']) ? $_GET['f_id'] : 0; if (!filter_var($searchId, FILTER_VALIDATE_INT) || $searchId < 1) { header("Location:./"); } //citamo rekord iz tabele flowers u zavisnosti koji je f_id izabran $getFlower = Flower::get($searchId); //ako ne postoji objekat, odnosno ako je korisnik upisao u url f_id koji ne postoji vrati ga na index.php,koristimo php funkciju property_exists if (isset($getFlower)) { if (property_exists($getFlower, "f_id") == false) { header("Location:./"); } } //svojstvo objekta $flower->image, od stringa pravimo niz,da bi dobili niz img_arr, da bi mogli da pristupimo svakom elementu npr.$img_arr[0] = img10.jpg,$img_arr[1] = img10-mala.jpg $img_arr = explode(",", $getFlower->image); //prikazujemo ime biljke kao naslov h3 i description echo "<div class='block'><h3>{$getFlower->name}</h3>\n {$getFlower->description}<br /><br />"; //koristimo metodu getImage koja petljom prolazi kroz niz img_arr, drugi parametar predstavlja atribut za plugin jquery lightbox galeriju(parametar je ime biljke koja je izabrana) Flower::getImage($img_arr, $getFlower->getName()); echo "</div>"; ?> </div>
include "../parts/menu.html"; ?> </div> <div class="main-content site"> <div class="text-content"> <?php if ($_SESSION['auth'] != 'admin') { echo "Доступ запрещён"; } else { $form_action = 'roses_table.php'; $db_table = 'roses'; echo "\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<td>Цвет</td>\n\t\t\t\t\t\t\t\t<td>Высота</td>\n\t\t\t\t\t\t\t\t<td>Ширина</td>\n\t\t\t\t\t\t\t\t<td>Описание</td>\n\t\t\t\t\t\t\t\t<td>Цена</td>\n\t\t\t\t\t\t\t\t<td>Фото</td>\n\t\t\t\t\t\t\t\t<td>Доступность</td>\n\t\t\t\t\t\t\t\t<td>Поменять доступность</td>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t<form name='bd' enctype='multipart/form-data'>\n\t\t\t\t\t\t"; $i = 0; $rows = num_of_rows($db_table); $flower = new Flower(); while ($i <= $rows) { $flower->extract_from_db($db_table, $i + 1); echo "\n\t\t\t\t\t\t\t<tr>"; if ($i != $rows) { echo "\n\t\t\t\t\t\t\t\t<td><input type='text' id='color" . $i . "' name='color" . $i . "' value='" . $flower->color . "'></input></td>\n\t\t\t\t\t\t\t\t<td><input type='text' id='height" . $i . "' name='height" . $i . "' value='" . $flower->height . "'></input></td>\n\t\t\t\t\t\t\t\t<td><input type='text' id='width" . $i . "' name='width" . $i . "' value='" . $flower->width . "'></input></td>\n\t\t\t\t\t\t\t\t<td><textarea id='description" . $i . "' name='description" . $i . "'>{$flower->description}</textarea></td>\n\t\t\t\t\t\t\t\t<td><input type='text' id='price" . $i . "' name='price" . $i . "' value='" . $flower->price . "'></input></td>\n\t\t\t\t\t\t\t\t<td><input type='file' id='foto" . $i . "' name='foto" . $i . "' value=''>" . $flower->foto . "</input></td>"; if ($flower->availability == "да") { echo "<td><select id='availability" . $i . "' name='availability" . $i . "'>\n\t\t\t\t\t\t\t\t<option value='да' selected>yes</option>\n\t\t\t\t\t\t\t\t<option value='нет'>no</option>\n\t\t\t\t\t\t\t\t</select></td>"; } else { echo "<td><select id='availability" . $i . "' name='availability" . $i . "'>\n\t\t\t\t\t\t\t\t<option value='да'>yes</option>\n\t\t\t\t\t\t\t\t<option value='нет' selected>no</option>\n\t\t\t\t\t\t\t\t</select></td>"; } echo "\n\t\t\t\t\t\t\t\t<td><button id='alt" . $i . "' name='alt" . $i . "' class='button'>Изменить</button></td>\n\t\t\t\t\t\t\t\t<input type='hidden' id='" . $i . "' value='" . $i . "'></input>"; } else { echo "\n\t\t\t\t\t\t\t\t<td><input type='text' id='color" . $i . "' name='color" . $i . "' value=''></input></td>\n\t\t\t\t\t\t\t\t<td><input type='text' id='height" . $i . "' name='height" . $i . "' value=''></input></td>\n\t\t\t\t\t\t\t\t<td><input type='text' id='width" . $i . "' name='width" . $i . "' value=''></input></td>\n\t\t\t\t\t\t\t\t<td><textarea id='description" . $i . "' name='description" . $i . "'></textarea></td>\n\t\t\t\t\t\t\t\t<td><input type='text' id='price" . $i . "' name='price" . $i . "' value=''></input></td>\n\t\t\t\t\t\t\t\t<td><input type='file' id='foto" . $i . "' name='foto" . $i . "'></input></td>\n\t\t\t\t\t\t\t\t<td><select id='availability" . $i . "' name='availability" . $i . "'>\n\t\t\t\t\t\t\t\t<option value='да'>yes</option>\n\t\t\t\t\t\t\t\t<option value='нет'>no</option>\n\t\t\t\t\t\t\t\t</select></td>\n\t\t\t\t\t\t\t\t<td><button id='alt" . $i . "' name='alt" . $i . "' class='button'>Создать</button></td>\n\t\t\t\t\t\t\t\t<input type='hidden' id='alt" . $i . "' value='" . $i . "'></input>"; } echo "</tr>";
?> </div> <div class="menu site"> <?php include "parts/menu.html"; ?> </div> <div class="main-content site"> <div class="text-content"><h2>Розы на продажу или обмен</h2> <?php $db_table = 'roses'; $form_action = 'rose.php'; $flower = new Flower(); $i = 0; $j = 0; $pages = 0; $items; $item[$pages] = ""; while ($i < num_of_rows($db_table)) { if (!$_REQUEST['filter'] and $flower->extract_from_db($db_table, $i + 1) or $_REQUEST['filter'] and $flower->extract_from_db($db_table, $i + 1, array($_REQUEST['min_cost'], $_REQUEST['max_cost']))) { echo $_POST['min_cost']; $items[$pages] = $items[$pages] . ' <div class="item"> <img src=' . 'foto/roses/' . $flower->foto . ' class="zoom" style="width: 300px;"></img> <div class="describe"> <ul> <li><b>Цвет:</b> ' . $flower->color . '</li> <li><b>Размеры:</b> ' . $flower->height . 'см в высоту, ' . $flower->width . 'см ширина</li>