1 AND start_count > 0 AND current_count < start_count AND UNIX_TIMESTAMP(NOW()) > (UNIX_TIMESTAMP(mod_time) + delay) AND begintime < NOW() AND url_categories LIKE '%:$cat:%' AND ai_flag != 'I'"; $query = "SELECT sell_url_idx, url, MIN((((UNIX_timestamp(NOW())-unix_timestamp(begintime))/(start_count-current_count))/ ((UNIX_timestamp(expiretime)-unix_timestamp(begintime))/(start_count)))) AS min FROM sell_url where (((UNIX_timestamp(NOW())-unix_timestamp(begintime))/(start_count-current_count))/ ((UNIX_timestamp(expiretime)-unix_timestamp(begintime))/(start_count))) < 1 and start_count > 0 and current_count < start_count and UNIX_timestamp(NOW()) > (unix_timestamp(mod_time) + delay) and begintime < NOW() AND url_categories LIKE '%:$cat:%' AND ai_flag != 'I' GROUP BY sell_url_idx LIMIT 0,1"; if ($rec = getOneRec($query)) { $link = $rec[1]; log_sell_link($rec[0]); update_credits($id,"2"); } else { $cat=$_GET["cat"]; $id = $_GET["id"]; update_credits($id,"1"); //$link = "client40.m29i.com/surf2.html?cat=$cat&id=$id"; $link = "$base_URL/surf2.html?cat=$cat&id=$id&popunder=true"; } //begin javascript code... ?> function get_cookie(Name) { var search = Name + "=" var returnvalue = "" if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset) if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } function setCookie (cookieName, cookieValue, expires, path, domain, secure) { document.cookie = escape(cookieName) + '=' + escape(cookieValue) + (expires ? '; EXPIRES=' + expires.toGMTString() : '') + (path ? '; PATH=' + path : '') + (domain ? '; DOMAIN=' + domain : '') + (secure ? '; SECURE' : ''); } function popunder() { var popurl = '' if(1) if (get_cookie("viewedpopunder")=="") { // set a cookie which expires after 12 hours var now = new Date(); var tomorrow = new Date(now.getTime() + 1000 * 60 * 60 * 12) setCookie ('viewedpopunder', 'yes', tomorrow); exit = window.open(popurl,'WebTrafficGenie','width=750,height=550,left=1,right=1,top=0,toolbar=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes,status=yes,location=yes'); exit.blur(); self.focus(); return true; } } document.onload=popunder; window.onload=popunder;