$imgPath = "secure/homepage/"; $_id = $_REQUEST['i']; if($_id == 1){ $append = "news1detail"; $itemid1 = $db->executeScalar("Select itemid1 from homepage where id = '1'"); if($itemid1) $db->execute("Update items set click = (click + 1) where id = '$itemid1'"); else $db->execute("Update homepage set click1 = (click1 + 1) where id = '1'"); } elseif($_id == 2){ $append = "news2detail"; $itemid2 = $db->executeScalar("Select itemid2 from homepage where id = '1'"); if($itemid2) $db->execute("Update items set click = (click + 1) where id = '$itemid2'"); else $db->execute("Update homepage set click2 = (click2 + 1) where id = '1'"); } else { header("Location: home.php"); exit; } $fetch = "Select $append from homepage where id = '1'"; if($db->query($fetch) && $db->get_num_rows() > 0){ $row = $db->fetch_row(); $_head22 = $imgPath.$row[0]; if(file_exists($_head22)){ $_head22width = getDimensions($_head22,850); if(empty($_head22width)) $_head22 = ""; } else { $_head22 = ""; } } include_once("libs/Smarty.class.php"); $smarty = new Smarty; $smarty->assign("items",$items); $smarty->assign("items2",$items2); $smarty->assign("head22",$_head22); $smarty->assign("head22w",$_head22width); $smarty->assign("head33",$_head33); $smarty->assign("imgPath",$imgPath); $smarty->display("homedetails.tpl"); function getDimensions($_name,$_width){ $_returnwidth = 0; $_dimensions = @getimagesize($_name); $_imgwidth = $_dimensions[0]; if($_imgwidth > $_width){ $_returnwidth = $_width; } else $_returnwidth = $_imgwidth; return $_returnwidth; } ?>