All pastes #204114 Raw Edit

Stuff

public text v1 · immutable
#204114 ·published 2006-10-15 17:55 UTC
rendered paste body
<?php
$filename = "offerlist.php";
require("./global.php");

	if($_GET['action']=="do"&&!empty($_GET['id'])){
		$offer = $db->qfetch("SELECT * FROM ".$pfx."_offers WHERE id=$_GET[id] AND `show`=1 AND pid='$pid'");
		if(!empty($offer['id'])){
			$redirlink = str_replace("[userid]", $userdata['id'], $offer['link']);
			header("location: $redirlink");
		}
		else access_error();
		exit();
	}
	if(isset($_POST['submit']) && $_POST['u_searchby'] != ""){
		$result = $db->query("SELECT * FROM ".$pfx."_offers WHERE `show`='1' AND pid='$pid' ORDER by $_POST[u_searchby] $_POST[u_orderby] ");
		$matches = $db->num_rows($result);
	}
	else $result = $db->query("SELECT * FROM ".$pfx."_offers WHERE `show`=1 AND pid='$pid' ORDER by weight ASC");
	$offersrows = 3;
	$offerscount = 0;
	while($offers = $db->fetch($result)){
		if($offerscount==$offersrows){
			$divtag = "<div class=\"maindiv\" style=\"float: left; display: inline; margin-right: 7px;  width:240px; \">";
			$offersrows = $offerscount + $offersrows;
		}
		else{ 
			$divtag = "<div class=\"maindiv\" style=\"float: left; display: inline; width:240px;  margin-right: 7px; margin-bottom: 6px; \">";
		}
		eval ("\$offers_viewbit .= \"".gettemplate($tplfolder . "o_offers_viewbit")."\";");
		$offerscount ++;
	}
	eval ("dooutput(\"".gettemplate($tplfolder . "o_header")."\");");
	eval ("dooutput(\"".gettemplate($tplfolder . "offers")."\");");
	eval ("dooutput(\"".gettemplate($tplfolder . "o_footer")."\");");
$db->close($sqlconn);
?>