debugging = FALSE; $smarty->caching = FALSE; $smarty->cache_lifetime = 120; $smarty->assign("DOMENA","http://www.taniolek.pl/"); if($_GET['action'] == null) { $smarty->assign("Name","Taniolek.pl",true); $smarty->display('index.tpl'); } elseif($_GET['action'] == 'search') { if($_GET['m'] == 1) $wynik = $szukaj->search($_GET['q'],"",1); else $wynik = $szukaj->search($_GET['q']); if(is_integer($wynik) and !is_array($wynik) and $wynik != FALSE) header("Location: index.php?action=lek&id=".$wynik); elseif(!is_integer($wynik) and !is_array($wynik) and $wynik != FALSE ) { $smarty->assign("Name","Taniolek.pl",true); $smarty->assign("wynik",$wynik); $smarty->display('index.tpl'); } elseif(!is_integer($wynik) and is_array($wynik) and $wynik != FALSE ) { $smarty->assign("wyniki",$wynik); $smarty->display("czychodzilocio.tpl"); } else { $smarty->assign("Name","Taniolek.pl",true); $smarty->display('index.tpl'); } } elseif($_GET['action'] == 'lek') { function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } $smarty->assign("selfurl",selfURL()); $compare = new compareClass; $leki = $compare->CompareLek($_GET['id']); for($i=0;$i<= count($leki);$i++) { if($leki[$i]['id'] == $_GET['id']) $smarty->assign("lek",$leki[$i]); } $smarty->assign("leki",$leki); $smarty->assign("Name","Taniolek.pl",true); $smarty->display('lek.tpl'); } } ?>