Exemple #1
0
    $db = Singleton::getInstance();
    $conn = $db->conn;
    $id = $_POST["id"];
    $prep = $conn->prepare("delete from motivation_quote where id={$id}");
    $prep->execute();
    header("Location: admin.php?id=2&cat=dodaj_motivaciju.php");
}
//dodavanje teretane
if (isset($_POST['teretana'])) {
    $ter = new Teretana();
    $ter->naziv = $_POST['naziv'];
    $ter->adresa = $_POST['adresa'];
    $ter->lat = $_POST['lat'];
    $ter->lon = $_POST['lon'];
    $ter->opis = $_POST['opis'];
    $ter->insert();
    header("Location: admin.php?id=2&cat=dodaj_teretanu.php");
}
//dodavanje vezbe
if (isset($_POST['dodaj_vezbu'])) {
    $vezba = new Vezbe();
    $naziv = $_POST['naziv'];
    $search = array("?", ":", "ć", "Ć");
    $replace = array("", "-", "c", "C");
    $naziv = str_replace($search, $replace, $naziv);
    $output = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $naziv);
    $file_tmp = $_FILES['img']['tmp_name'];
    $img = new abeautifulsite\SimpleImage($file_tmp);
    $img->best_fit(500, 400)->mean_remove()->save("../images/vezbe/" . $output . ".jpg");
    $vezba->naziv = $naziv;
    $vezba->tekst = $_POST['tekst'];