--- NovaAplikacija.php 2001/04/20 08:25:32 1.1.1.1 +++ NovaAplikacija.php 2002/06/19 18:32:42 1.3 @@ -5,25 +5,18 @@ if (isparam("wb_OK") && $naziv) { include("inc/conn.php"); DBOpen(); - $id = DBQuery("SELECT MAX(sifra) FROM tecajevi"); - $id = $id[0][0] + 1; $naziv = ISO_Win($naziv); - DBQuery("INSERT INTO tecajevi (sifra,naziv,sif_qualification,language) VALUES ($id,'$naziv',4,'$language')"); + DBQuery("INSERT INTO tecajevi (naziv,sif_qualification,language) VALUES ('$naziv',4,'$language')"); + $ret = $DBH->errstr; DBClose(); } - Header("Location: $oldpage"); - exit; + if (!$ret) { + Header("Location: $oldpage"); + exit; + } } - include("inc/Smarty.class.php"); - $tpl = new Smarty; - $tpl->template_dir = "./tpl"; - $tpl->compile_dir = "./tpc"; - $tpl->assign("action", $PHP_SELF.Params(-1, array("q" => $q))); - $tpl->assign("language", $language); - $tpl->assign("sifra", $sifra); + $tpl = new MySmarty(-1, array("q" => $q)); $tpl->assign("oldpage", $HTTP_REFERER); $tpl->assign("naziv", HTML_Escape(Win_ISO($naziv))); - $pg = basename($PHP_SELF); - $pg = eregi_replace("\.php$", "", $pg); - $tpl->display("$pg-$language.tpl"); + $tpl->show(); ?>