load("burza"); $mysql = $lm->load ('mysql'); $defaultW = 180; $defaultH = 50; $minW = 50; $minH = 50; $maxW = 1000; $maxH = 1000; $w = isset($_GET['w']) ? (integer) $_GET['w'] : $defaultW; $h = isset($_GET['h']) ? (integer) $_GET['h'] : $defaultH; if ($w < $minW) $w = $minW; if ($h < $minH) $h = $minH; if ($w > $maxW) $w = $maxW; if ($h > $maxH) $h = $maxH; $hashit = isset($_GET['id']) ? strtolower(trim($_GET['id'])) : ''; $userId = $mysql->eag1("SELECT `id` FROM `".DB_PREFIX."user` WHERE `hashit` = '$hashit'"); $sites = $b->get_sites($userId); if ($sites === false) { $sites = array(); } $ref = isset ($_SERVER['HTTP_REFERER']) ? $b->trimUrl($_SERVER['HTTP_REFERER']) : ''; $siteId = -1; foreach ($sites as $site) { if ($b->trimUrl($site['www'])==$ref) { $siteId = $site['id']; break; } } if ($siteId == -1) { if (!empty($sites)) { $siteId = $sites[mt_rand(0,count($sites)-1)]['id']; } } echo "document.write('rootDir}/iframegen.php?id=$hashit&site=$siteId&w=$w&h=$h\">"; echo "');"; ?>