Esempio n. 1
0
    $naslov = $_POST['naslov'];
    $search = array("?", ":", "ć", "Ć");
    $replace = array("", "-", "c", "C");
    $naslov = str_replace($search, $replace, $naslov);
    $article->naslov = ucfirst($naslov);
    $article->id = $_POST['id'];
    $article->tekst = addslashes($_POST['text']);
    $article->datum = $_POST['datum'];
    $article->kategorija = $_POST['selCategory'];
    $output = iconv("UTF-8", "ISO-8859-1//TRANSLIT", $naslov);
    if (!file_exists("../images/main/" . $output . ".jpeg")) {
        $img = new abeautifulsite\SimpleImage($file_tmp);
        $img->best_fit(1000, 450)->mean_remove()->save("../images/main/" . $output . ".jpeg");
        $img->best_fit(130, 90)->mean_remove()->save("../images/small/" . $output . ".jpeg");
    }
    $article->update();
    header("Location: admin.php?id=3");
}
//dodavanje takmicara
if (isset($_POST['dodaj_takmicara'])) {
    $article = new Takmicar();
    $article->ime = ucfirst($_POST['ime']);
    $article->tekst = addslashes($_POST['text']);
    $article->rodjen = $_POST['rodjen'];
    $article->visina = $_POST['visina'];
    $article->tezina = $_POST['tezina'];
    $article->titule = $_POST['titule'];
    $article->mesto = $_POST['mesto'];
    $file_tmp = $_FILES['img']['tmp_name'];
    $file_type_explode = explode("/", $_FILES['img']['type']);
    $file_type = "." . $file_type_explode[1];