Pagination problem with mod_rewrite

Hello All,
I am going mad with the problem i am getting with the mod_rewrite.

mod_rewrite is working fine with other urls.
but with pagination the session variables are cleared and

my url http://[sitename]/Deals/Computer/5 is working fine

in tht page there are a set of pages the urls of which i need to change

like http://[sitename]/Deals/Computer/5/page/3

the page is redirected fine. but i am not getting the session variables in the redirected page.

i’m breaking my head since 3 days on this problem

immediate help will be appreciated.
thnx in advance

So on the first URL the sessions do work, but if you add pagination they don’t anymore?

Also, could you show your .htaccess with the RewriteRules please?

Are Computer/5/ and Computer/5/page/3 going to the same page? Are you sure session_start() is on the page for Computer/5/page/3? Or that you’re not unsetting the session somewhere?

Thnx for u’r immediate reply

for Deals/Computer/5
RewriteRule ^Deals/([^/]+)/([^/]+)/?$ /Deals.php?cat_id=$2 [L]

/Deals/Computer/5/page/3
RewriteRule ^Deals/([^/]+)/([^/]+)/page/([^/]+)/?$ /Deals.php?cat_id=$2&page=$3 [NC,L]

i am posting the Rewrite rules here

and i am using the session_start() in tht page!!!
please help me out

can u suggest if there is any other way i can change the rewrite rule or use the url in any other way
Thnx & regards

I’m kind of at a loss here, it really should just work. The only think I can think of (and even that is unlikely) is that you have the suhosin hardening patch installed on your server, and that’s stopping the session from being initialized (because of directory depth security issue).
Or maybe PHP is setting a path for the session cookie and that’s why it doesn’t work?
Are you 100% sure sessions don’t work btw, and it’s not some other problem somehow?

yaah let me tell u in detail
I am storing the values from multiple tables into a single array in the session
and using tht array for pagination.
it’s working fine in all the other pages where i wrote the rewrite rules. id don’t think the problem is with the rewrite rule.
in this page also, some other session variables are stored well. only this session variable(the array i mentioned just now) is disappeared.

It’s probably too big to fit in a session, so PHP won’t store it. In which case I’m afraid your solely out of luck…
Better change the code to just query every time instead of storing everything in the session (or get some other caching system).

SORRY TO BUG U BUT THIS PAGE WORKS WHEN I GIVE THE URL STRAIGHT AWAY WITHOUT GIVING REWRITE RULE.

THIS URL WORKS
/Deals.php?cat_id=5&page=3

Hm, come to think of it, it may be a MultiViews problem.

Try adding this to your .htaccess


Options -MultiViews

If that doesn’t work, I’m really out of ideas here.

Seeing as you are bottoming out, let me ask:

Does the order in which rewrite rules have an effect on their processing?

I also cannot see how the order of things affects this particular case, but this question always bugs me.

In general yes (you should start with the more specific ones, and then go on the more generic ones), but it this particular case it shouldn’t matter as the rules are mutually exclusive.

[ot]Thanks, but to clarify, if you want any particular rule, once a condition has been met, to be the last you add the directive [L] otherwise you risk cascading further down the rules.

Is that the way to think of it?
[/ot]

Sort of, but not really. The [L] flag is a tricky thing, best explained through an example.

Suppose we have three RewriteRules, none of which have a [L] flag.

Now suppose a request comes in for URL, which is matched by the first RewriteRule. URL is rewritten to URL'. From that moment, when matching, the new URL' will be used instead of URL.
The RewriteEngine will now check the second and third RewriteRules. Let’s assume they don’t match.
Now the RewriteEngine is done checking the RewriteRules, and finds that the URL it ended up with is not the same as the one it started out with (since it was rewritten by the first RewriteRule) and will start the process again starting from the first RewriteRule. Assuming that doesn’t match, and the second and third don’t match either, it’s done. (Suppose the first RewriteRule matched again, and the next time after that also, and the next time after that, etc, etc, 10 times --default, you can set that value-- you end up with a 500 internal server error).

Now suppose the first rule ~did~ have an [L] flag. What than happens is it starts out the same, in that the URL is rewritten by the first RewriteRule, but instead of also checking the second and third RewriteRules then, the [L] flag tells the RewriteEngine to start over from the first RewriteRule immediately, thus skipping the second and third RewriteRules.
After that a second round will take place, and assuming nothing happens there, we’re done.

So what you actually do with the [L] flag is safe time.
Of course this only helps when URLs are mutually exclusive; if you want URLs to be processed by several rules you shouldn’t use the [L] flag.

I hope that’s clear, it’s hard to explain :confused:

that was a very good explanation!!!.
Thnx for that.

But wht abt my problem???

See post #9 :slight_smile:

it din’t work!!!

Then I’m really out of ideas, sorry :injured:

How about posting your code on the page that’s giving you a problem?

This is Deals.php
require_once “includes/Paginated.php”;
require_once “includes/TrailingLayout.php”;
//print_r($_SERVER);//[‘QUERY_STRING’] ;
?>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<?
if( $_GET[‘cat_id’] <> ‘’){
$query=“SELECT * FROM rim_categories where cat_id = '” . $_GET[‘cat_id’] . “'”;
//echo $query;
$pcat = getSqlRow($query);
$cat_name = $pcat[‘cat_name’];?>
<title><?echo $cat_name?> Deals - <?echo $pcat[‘SEODealsKeywords’]?> | Zirafi.com</title>
<meta name=“description” content = “<?echo $pcat[‘meta_desc’]?>”>
<meta name=“keywords” content = “<?echo $pcat[‘meta_keywords’]?>”>
<?
}
else if( $_GET[‘adv_id’] <> ‘’){?>
<title><?echo $_GET[‘adv_id’]?> Daily Deals - Free Shopping Deals Online</title>
<meta name=“description” content = “<?echo $_GET[‘adv_id’]?> Daily Deals - Free Shopping Deals Online”>
<meta name=“keywords” content = “<?echo $_GET[‘adv_id’]?> Daily Deals - Free Shopping Deals Online”>

<?
$cat_name=“”;
}
else{
?>
<title>Daily Deals - Free Shopping Deals Online | Ziraffi.com</title>
<meta name=“description” content = “Daily Deals - Free Shopping Deals Online”>
<meta name=“keywords” content = “Daily Deals - Free Shopping Deals Online”>
<?}?>

<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1”>
<meta name=“robots” content=“index, follow” />
<!–Google Analytics Code–>
<script type=“text/javascript”>

var _gaq = _gaq || ;
_gaq.push([‘_setAccount’, ‘UA-24361236-1’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<link rel=“stylesheet” href=“/images/Stylemain.css” type=“text/css” media=“all” />
<link rel=“stylesheet” href=“/images/Style.css” type=“text/css” media=“all” />

</head>
<body>
<style type=“text/css”>
.style1 {
font-family:Verdana;
font-size:18px;
color: #FF3000;
font-weight:bold;
font-style:normal;
}
.style12 {
color: #40A12F;
font-size: 16px;

}
</style>

<div id=“content”>

<?php
// For pagination
$filePath = “Deals.php”;
$page = $_GET[‘page’];
$home=“false”;
if ($_GET[‘cat_id’] <> ‘’)
{
$cat_id = $_GET[‘cat_id’];
$catqry = “select Keywords from rim_categories where cat_id = '” . $cat_id . “'”;
//echo $catqry;
$catarr = getSqlRow($catqry);
$keyword = $catarr[‘Keywords’];
if ($keyword <> ‘’)
{
$keywords=split(“,”,$keyword);//Breaking the string to array of words

//echo $catsort;
}
//$limit =50;
//$pagelimit = 50;
$home=“false”;
}
else
{
$cat_id=“”;
}
echo “cat” . $cat_id;
if ($_GET[‘adv_id’] <> ‘’)
{
$adv_id = $_GET[‘adv_id’];
//$limit =70;
//$pagelimit = 70;
$home=“false”;
}
else
{
$adv_id=“”;
}
if ($limit == 0)
{
//$limit =50;
//$pagelimit = 50;
}

if(isset($_GET[‘start’]) ){
$start = $_GET[‘start’];
}else{
$start = 0;
}
$filePath = “Deals.php”;
//print_r($_SESSION);
if ($cat_id <> ‘’)
{
//$additionalvar .= “&cat_id=” . $cat_id;
$additionalvar .= basename($_SERVER[‘REQUEST_URI’]);
}
if ($adv_id <> ‘’)
{
//$additionalvar .= “&adv_id=” . $adv_id;
}
////Pagination End

$_SESSION[‘menuoption’] = “DEALS”;
include “includes/header.php”;
include “Header.php”;
$limit = 80;
$listingImageWidth = LISTING_IMAGE_WIDTH; //AMAZON_LISTING_IMAGE_WIDTH;//
//$cat_id=$tempcat;
if(!isset($page)){$page=0;}
echo “page” . $page;
//print_r($_SESSION);
if($page<1)
{
//echo “empty”;

include “extract.php”;
shuffle($_SESSION[‘gDealArray’]);
}
else
{
//$gPromotionArray = $_SESSION[‘gDealArray’];
}

//echo $nbDeals;
?>
<div id=“main”>
<?php

$icnt=0;
$total = count($_SESSION[‘gDealArray’]);
//echo $total;
if ($total<=0)
{
include “nosearch.php”;
}

This is extarct.php

<?
$traceenable = true;
if($traceenable==true){
$myFile = “/home/zadmin/logs/Querylog.log”;
$fh = fopen($myFile, ‘w’) or die(“file invalid”);}
$idx=0;
//echo $cat_id ;
//$Dealsquery=“SELECT * FROM rim_products where (expire_date>CURDATE() or expire_date=‘0000-00-00’) and product_status=1 and kind=0 “;
$Dealsquery=“SELECT * FROM rim_products where (expire_date>CURDATE() or expire_date=‘0000-00-00’) and product_status=1 and kind=0 and specialnote <> ‘’”;// and (specialnote like ‘%rebate%’ or specialnote like ‘%save%’ or specialnote like ‘%Free Shipping%’ or specialnote like ‘%savings%’ ) “;
if($cat_id <> ‘’)
{
// $Dealsquery= $Dealsquery . " and cat_id = " . $cat_id;
$searchcat=($cat_id)?$cat_id:””;
if ($searchcat!=”“){
$searchcat .= subcategories($cat_id); //cat_id='”.$_GET[‘cid’]."’
}

$Dealsquery .= " and cat_id in (".$searchcat.") ";

}
else if($adv_id <> ‘’)
{
$Dealsquery= $Dealsquery . " and webservice_id in (select id from rim_advertisers where name like ‘%" . $adv_id . "%’)“;
}
else if ($searchcnt <> ‘’)
{
$searchquery= " and (product_name like '%” . $searchcnt .“%') “;
}
$tempqry = $Dealsquery;
$Dealsquery= $Dealsquery . $searchquery ;
//echo $Dealsquery;
$nbDeals=getSqlNumber($Dealsquery);
//echo $nbDeals;
if($nbDeals <= 0){
if ($searchcnt <> ‘’)
{
$searchquery= " and (title like '%” . $searchcnt .”%') “;
}
$Dealsquery= $tempqry . $searchquery;
//echo $Dealsquery;
$nbDeals=getSqlNumber($Dealsquery);
}
if($homepage == “true”)
{
$Dealsquery= $Dealsquery . " limit $limit”;
}
//echo $Dealsquery;
$nbDeals=getSqlNumber($Dealsquery);
if($traceenable==true){fwrite($fh, $Dealsquery. "
");}
if($nbDeals > 0){
$getDealsQuery=mysql_query($Dealsquery);

while($item=mysql_fetch_assoc($getDealsQuery)){						
	//$getDeals[$idx] = $item;
	if ($item['regular_price'] != 0)
	{
		$DealsArray[$idx]['prows_price'] = "$" . $item['regular_price'];
		$item['how_much_saving'] = (int) (((float) $item['rebate'] / (float) $item['regular_price']) * 100);
	}
	if ($item['sale_price'] != 0)
	{
		$DealsArray[$idx]['sale_price'] = "$" . $item['sale_price'];
	}
	$DealsArray[$idx]['prod_id'] = $item['product_id'];
	//echo $item['description'];
	$DealsArray[$idx]['prows_description'] = $item['description'];

//MF Build up link on title
//If the title field is empty, then use the product name
//print_r($item);
//echo “p”.$item[‘product_name’];
if ($item[‘title’] <> ‘’)
{
$DealsArray[$idx][‘prows_title’]=$item[‘title’];
}
else if ($item[‘product_name’] <> ‘’)
{
$DealsArray[$idx][‘prows_title’]=$item[‘product_name’];
}

	else
	{
		$DealsArray[$idx]['prows_title']=$item['description'];  
	}
	$DealsArray[$idx]['prows_url'] = $item['go_link'];
	$DealsArray[$idx]['title_link']=html_entity_decode($item["title_link"]);
	//echo $DealsArray[$idx]['title_link'];
	$DealsArray[$idx]['prows_image'] = $item['image'];

//MF End of link on title mod echo “hh”;
$DealsArray[$idx][‘type’] = “Deal”;
$DealsArray[$idx][‘specialnote’] = $item[‘specialnote’];
$DealsArray[$idx][‘shipping_desc’] = $item[‘shipping_desc’];
$DealsArray[$idx][‘imp_url’] = $item[‘imp_url’];
$DealsArray[$idx][‘source’] = $item[‘source’];
$DealsArray[$idx][‘table’] = “rim_product”;
$strAdv = “select name from rim_advertisers WHERE id = '” . $item[‘webservice_id’] . “'”;
//echo $strAdv;
$AdvRow = getSqlRow($strAdv);
$DealsArray[$idx][‘Advertiser’] = $AdvRow[‘name’];

	$idx++;				
}

}

//Amazon Browse Node Listings
$sqlstr = “SELECT * FROM Tbl_Deals_ws WHERE prows_status=1 and sale_price<>‘Too low to display’”;//order by cat_id,prows_asin";//Advertiser <> ‘Amazon’
if ($cat_id <> ‘’)
{
$searchcat=($cat_id)?$cat_id:“”;
if ($searchcat!=“”){
$searchcat .= subcategories($cat_id); //cat_id=‘“.$_GET[‘cid’].”’
}

$sqlstr .= " and cat_id in (".$searchcat.") ";

}
else if($adv_id <> ‘’)
{
$sqlstr= $sqlstr . " and advertiser like ‘%" . $adv_id . "%’“;
}
else
{
}
if ($searchcnt <> ‘’)
{
$sqlstr .= " and prows_title like '%” . $searchcnt ."%’ ";
}

if($homepage == “true”)
{
$sqlstr= $sqlstr . " limit $limit";
}
$rowcnt = getSqlNumber($sqlstr);
$nbDeals += $rowcnt;
//echo “amazon”. $rowcnt . ‘<br>’;
//echo $sqlstr;
if($traceenable==true){
fwrite($fh, $sqlstr. "
");}
if ($rowcnt > 0)
{
//echo $sqlstr;

$getDealsQuery=mysql_query($sqlstr);
while($item=mysql_fetch_assoc($getDealsQuery))
{
	$DealsArray[$idx]['prows_image'] = $item['prows_image'];
	//echo $DealsArray['prows_image'] ;
	$DealsArray[$idx]['prows_title'] = $item['prows_title'];
	$DealsArray[$idx]['prows_url'] = $item['prows_url'];
	$DealsArray[$idx]['prows_image'] = $item['prows_image'];
	$DealsArray[$idx]['prows_description'] = $item['prows_description'];
	if (substr($item['prows_price'],0,1) == "$"){
		$DealsArray[$idx]['prows_price'] = $item['prows_price'];
	}else
	{
		$DealsArray[$idx]['prows_price'] = "$" . $item['prows_price'] ;
	}
	if (substr($item['sale_price'],0,1) == "$"){
		$DealsArray[$idx]['sale_price'] = $item['sale_price'];}
	else{
		$DealsArray[$idx]['sale_price'] = "$" . $item['sale_price'];
	}
	$DealsArray[$idx]['specialnote'] = $item['specialnote'];
	$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
	$DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
	$DealsArray[$idx]['prod_id'] = $item['prows_id'];
	$DealsArray[$idx]['imp_url'] = $item['imp_url'];
	$DealsArray[$idx]['source'] = $item['source'];
	$DealsArray[$idx]['type'] = "Deal";
	$DealsArray[$idx]['table'] = "tbl_deals_ws";
	$idx++;
}

}

//Amazon Gold Deals
$sqlstr = " select * from deals_ws where Advertiser=‘Amazon’ and (Percentage > 10 and Percentage < 100) and Percentage is not null";
if($adv_id <> ‘’)
{
$sqlstr= $sqlstr . " and advertiser like (‘%" . $adv_id . "%’)“;
}
//echo $catsort;
//print_r($keywords);
else if ($cat_id<>‘’)
{
$sqlstr .= " and (”;
$tempcat = $cat_id;
$catsort = “”;
while(list($key,$val)=each($keywords)){
//echo $val;
if($val<>" " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or ";}

		}// end of while
		$catsort=substr($catsort,0,(strlen($catsort)-3));
		$sqlstr= $sqlstr .  $catsort . ")" ;
		if ($catsort&lt;&gt;'')
		{
		//$cat_id = "";
		}
		reset($keywords);
	}
	if ($searchcnt &lt;&gt; '')
	{
		$sqlstr .= " and title like '%" . $searchcnt ."%' ";
	}
	if($homepage == "true")
	{
		$sqlstr= $sqlstr . " limit $limit";
	}
	//echo $cat_id;
	$rowcnt = getSqlNumber($sqlstr);
	$nbDeals += $rowcnt;

// echo “non amazon”. $rowcnt . ‘<br>’;
//echo $sqlstr;
if($traceenable==true){
fwrite($fh, $sqlstr. "
");}
if ($rowcnt > 0)
{
$getDealsQuery=mysql_query($sqlstr);
while($item=mysql_fetch_assoc($getDealsQuery)){
//print_r($item);
$DealsArray[$idx][‘prows_image’] = $item[‘Image’];

			//echo $item['Image'];//$DealsArray['prows_image'] ;
			$DealsArray[$idx]['prows_description'] = $item['description'];
			$DealsArray[$idx]['prows_title'] = $item['title'];
			if ($item['link'] &lt;&gt; ''){
			$DealsArray[$idx]['prows_url'] = $item['link'];
			}else{
			$DealsArray[$idx]['prows_url'] = $item['guid'];
			}
			if ($item['dealtype'] == "Deal")
			{
				if (substr($item['ListPrice'],0,1) == "$"){
					$DealsArray[$idx]['prows_price'] = $item['ListPrice'];
				}else
				{
					$DealsArray[$idx]['prows_price'] = "$" . $item['ListPrice'];
				}
				$DealsArray[$idx]['rebate'] =  $item['Percentage'] ;
			}
			$DealsArray[$idx]['type'] = $item['dealtype'];
			//echo $item['dealtype'];
			$DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
			if (substr($item['DealPrice'],0,1) == "$"){
				$DealsArray[$idx]['sale_price'] = $item['DealPrice'];}
			else{
				$DealsArray[$idx]['sale_price'] = "$" . $item['DealPrice'];
			}
			//$DealsArray[$idx]['sale_price'] = $item['DealPrice'];
			$DealsArray[$idx]['specialnote'] = $item['specialnote'];
			$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
			$DealsArray[$idx]['prod_id'] = $item['id'];
			$idx++;
	// $DealsArray[$idx]['prows_image'] = $item['prows_image'];
	// $DealsArray[$idx]['prows_description'] = $item['prows_description'];
	// $DealsArray[$idx]['prows_price'] = $item['prows_price'];
	// $DealsArray[$idx]['sale_price'] = $item['sale_price'];
	// $DealsArray[$idx]['specialnote'] = $item['specialnote'];
	// $DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
	// $DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
	// $DealsArray[$idx]['type'] = "Deal";
		}
	}
	$cat_id=$tempcat;

//Amazon Gold Deals Promotions
$sqlstr = " select * from deals_ws where dealtype like ‘promo%’ and Advertiser=‘Amazon’“; //and
if($adv_id <> ‘’)
{
$sqlstr= $sqlstr . " and advertiser like ('%” . $adv_id . “%')”;
}
//echo $catsort;
//print_r($keywords);
else if ($cat_id<>‘’)
{
$sqlstr .= " and (“;
$tempcat = $cat_id;
$catsort = “”;
while(list($key,$val)=each($keywords)){
//echo $val;
if($val<>” " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or ";}

		}// end of while
		$catsort=substr($catsort,0,(strlen($catsort)-3));
		$sqlstr= $sqlstr .  $catsort . ")";
		if ($catsort&lt;&gt;'')
		{
		//$cat_id = "";
		}
		reset($keywords);
	}
	if ($searchcnt &lt;&gt; '')
	{
		$sqlstr .= " and title like '%" . $searchcnt ."%' ";
	}
	if($homepage == "true")
	{
		$sqlstr= $sqlstr . " limit $limit";
	}
	//echo $cat_id;
	$rowcnt = getSqlNumber($sqlstr);
	$nbDeals += $rowcnt;
	//echo "non amazon". $rowcnt . '&lt;br&gt;';
	//echo $sqlstr;
	if($traceenable==true){
	fwrite($fh, $sqlstr. "\

");}

	if ($rowcnt &gt; 0)
	{
		$getDealsQuery=mysql_query($sqlstr);
		while($item=mysql_fetch_assoc($getDealsQuery)){	
			//print_r($item);
			$DealsArray[$idx]['prows_image'] = $item['Image'];
			//echo $item['Image'];//$DealsArray['prows_image'] ;
			$DealsArray[$idx]['prows_description'] = $item['description'];
			$DealsArray[$idx]['prows_title'] = $item['title'];
			if ($item['link'] &lt;&gt; ''){
			$DealsArray[$idx]['prows_url'] = $item['link'];
			}else{
			$DealsArray[$idx]['prows_url'] = $item['guid'];
			}
			if ($item['dealtype'] == "Deal")
			{
				if (substr($item['ListPrice'],0,1) == "$"){
					$DealsArray[$idx]['prows_price'] = $item['ListPrice'];
				}else
				{
					$DealsArray[$idx]['prows_price'] = "$" . $item['ListPrice'];
				}
				$DealsArray[$idx]['rebate'] =  $item['Percentage'] ;
			}
			$DealsArray[$idx]['type'] = $item['dealtype'];
			//echo $item['dealtype'];
			$DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
			if ($item['Image'] == ''){
				$query = "select Logo,Link from `rim_advertisers` where name = '" . $DealsArray[$idx]['Advertiser'] . "'";
				//echo $query;
				$getAdvertiser=mysql_query($query);
				$Adv=mysql_fetch_assoc($getAdvertiser);
				$DealsArray[$idx]['logoimage'] = $Adv['Logo'];
			}
			if (substr($item['DealPrice'],0,1) == "$"){
				$DealsArray[$idx]['sale_price'] = $item['DealPrice'];}
			else{
				$DealsArray[$idx]['sale_price'] = "$" . $item['DealPrice'];
			}
			//$DealsArray[$idx]['sale_price'] = $item['DealPrice'];
			$DealsArray[$idx]['specialnote'] = $item['specialnote'];
			$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
			$DealsArray[$idx]['prod_id'] = $item['id'];

			$idx++;
	// $DealsArray[$idx]['prows_image'] = $item['prows_image'];
	// $DealsArray[$idx]['prows_description'] = $item['prows_description'];
	// $DealsArray[$idx]['prows_price'] = $item['prows_price'];
	// $DealsArray[$idx]['sale_price'] = $item['sale_price'];
	// $DealsArray[$idx]['specialnote'] = $item['specialnote'];
	// $DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
	// $DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
	// $DealsArray[$idx]['type'] = "Deal";
		}
	}
	$cat_id=$tempcat;

//Non Amazon Gold Deals Promotions
$sqlstr = " select * from deals_ws where dealtype like ‘promo%’ and Advertiser<>‘Amazon’“; //and
if($adv_id <> ‘’)
{
$sqlstr= $sqlstr . " and advertiser like ('%” . $adv_id . “%')”;
}
//echo $catsort;
//print_r($keywords);
else if ($cat_id<>‘’)
{
$sqlstr .= " and (“;
$tempcat = $cat_id;
$catsort = “”;
while(list($key,$val)=each($keywords)){
//echo $val;
if($val<>” " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or ";}

		}// end of while
		$catsort=substr($catsort,0,(strlen($catsort)-3));
		$sqlstr= $sqlstr .  $catsort . ")";
		if ($catsort&lt;&gt;'')
		{
		//$cat_id = "";
		}
		reset($keywords);
	}
	if ($searchcnt &lt;&gt; '')
	{
		$sqlstr .= " and title like '%" . $searchcnt ."%' ";
	}
	if($homepage == "true")
	{
		$sqlstr= $sqlstr . " limit $limit";
	}
	//echo $cat_id;
	$rowcnt = getSqlNumber($sqlstr);
	$nbDeals += $rowcnt;
	//echo "non amazon". $rowcnt . '&lt;br&gt;';
	//echo $sqlstr;
	if($traceenable==true){
	fwrite($fh, $sqlstr. "\

");}

	if ($rowcnt &gt; 0)
	{
		$getDealsQuery=mysql_query($sqlstr);
		while($item=mysql_fetch_assoc($getDealsQuery)){	
			//print_r($item);
			$DealsArray[$idx]['prows_image'] = $item['Image'];
			//echo $item['Image'];//$DealsArray['prows_image'] ;
			$DealsArray[$idx]['prows_description'] = $item['description'];
			$DealsArray[$idx]['prows_title'] = $item['title'];
			if ($item['link'] &lt;&gt; ''){
			$DealsArray[$idx]['prows_url'] = $item['link'];
			}else{
			$DealsArray[$idx]['prows_url'] = $item['guid'];
			}
			if ($item['dealtype'] == "Deal")
			{
				if (substr($item['ListPrice'],0,1) == "$"){
					$DealsArray[$idx]['prows_price'] = $item['ListPrice'];
				}else
				{
					$DealsArray[$idx]['prows_price'] = "$" . $item['ListPrice'];
				}
				$DealsArray[$idx]['rebate'] =  $item['Percentage'] ;
			}
			$DealsArray[$idx]['type'] = $item['dealtype'];
			//echo $item['dealtype'];
			$DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
			if ($item['Image'] == ''){
				$query = "select Logo,Link from `rim_advertisers` where name = '" . $DealsArray[$idx]['Advertiser'] . "'";
				//echo $query;
				$getAdvertiser=mysql_query($query);
				$Adv=mysql_fetch_assoc($getAdvertiser);
				$DealsArray[$idx]['logoimage'] = $Adv['Logo'];
			}
			if (substr($item['DealPrice'],0,1) == "$"){
				$DealsArray[$idx]['sale_price'] = $item['DealPrice'];}
			else{
				$DealsArray[$idx]['sale_price'] = "$" . $item['DealPrice'];
			}
			//$DealsArray[$idx]['sale_price'] = $item['DealPrice'];
			$DealsArray[$idx]['specialnote'] = $item['specialnote'];
			$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
			$DealsArray[$idx]['prod_id'] = $item['id'];
			$DealsArray[$idx]['expiry'] = $item['expirydate'];
			$idx++;
	// $DealsArray[$idx]['prows_image'] = $item['prows_image'];
	// $DealsArray[$idx]['prows_description'] = $item['prows_description'];
	// $DealsArray[$idx]['prows_price'] = $item['prows_price'];
	// $DealsArray[$idx]['sale_price'] = $item['sale_price'];
	// $DealsArray[$idx]['specialnote'] = $item['specialnote'];
	// $DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
	// $DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
	// $DealsArray[$idx]['type'] = "Deal";
		}
	}
	$cat_id=$tempcat;

//LinkShare
$sqlstr = " select * from deals_ws where (Advertiser<>‘Amazon’ and Advertiser<>‘Ebay’) and (Percentage > 10 and Percentage <= 100)“;
if($adv_id <> ‘’)
{
$sqlstr= $sqlstr . " and advertiser like '%” . $adv_id . “%'”;
}
if ($cat_id<>‘’)
{
$sqlstr .= " and (“;
$tempcat = $cat_id;
$catsort = “”;
while(list($key,$val)=each($keywords))
{
//echo $val;
if($val<>” " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or “;}
}// end of while
$catsort=substr($catsort,0,(strlen($catsort)-3));
$sqlstr= $sqlstr . $catsort . “)”;
if ($catsort<>‘’)
{
// $cat_id = “”;
}
reset($keywords);
}
if ($searchcnt <> ‘’)
{
$sqlstr .= " and title like '%” . $searchcnt ."%’ “;
}
if($homepage == “true”)
{
$sqlstr= $sqlstr . " limit $limit”;
}
$rowcnt = getSqlNumber($sqlstr);

	$nbDeals += $rowcnt;
	if($traceenable==true){
	fwrite($fh, $sqlstr. "\

");}
//echo “no amazon”. $rowcnt . ‘<br>’;
//echo $sqlstr;
if ($rowcnt > 0)
{
$getDealsQuery=mysql_query($sqlstr);
while($item=mysql_fetch_assoc($getDealsQuery)){
//print_r($item);
$DealsArray[$idx][‘prows_image’] = $item[‘Image’];

			//echo $item['Image'];//$DealsArray['prows_image'] ;
			$DealsArray[$idx]['prows_description'] = $item['description'];
			$DealsArray[$idx]['prows_title'] = $item['title'];
			$DealsArray[$idx]['prows_url'] = $item['guid'];
			if ($item['dealtype'] == "Deal")
			{
				if (substr($item['ListPrice'],0,1) == "$"){
					$DealsArray[$idx]['prows_price'] = $item['ListPrice'];
				}else
				{
					$DealsArray[$idx]['prows_price'] = "$" . $item['ListPrice'];
				}

				//$DealsArray[$idx]['prows_price'] = $item['ListPrice'] ;
				$DealsArray[$idx]['rebate'] =  $item['Percentage'] ;
			}
			$DealsArray[$idx]['type'] = $item['dealtype'];
			$DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
			if (substr($item['DealPrice'],0,1) == "$"){
				$DealsArray[$idx]['sale_price'] = $item['DealPrice'];}
			else{
				$DealsArray[$idx]['sale_price'] = "$" . $item['DealPrice'];
			}
			//$DealsArray[$idx]['sale_price'] = $item['DealPrice'];
			$DealsArray[$idx]['specialnote'] = $item['specialnote'];
			$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
			$DealsArray[$idx]['source'] = "";
			$DealsArray[$idx]['prod_id'] = $item['id'];

			$idx++;
	// $DealsArray[$idx]['prows_image'] = $item['prows_image'];
	// $DealsArray[$idx]['prows_description'] = $item['prows_description'];
	// $DealsArray[$idx]['prows_price'] = $item['prows_price'];
	// $DealsArray[$idx]['sale_price'] = $item['sale_price'];
	// $DealsArray[$idx]['specialnote'] = $item['specialnote'];
	// $DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
	// $DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
	// $DealsArray[$idx]['type'] = "Deal";
		}
	}

$cat_id=$tempcat;

//CJ Coupons
$Couponquery=“SELECT * FROM rim_coupon where status=1 and description2 != ‘Banner’ and shipping_desc=‘Coupons’ “;//AND (exp_date > now() OR exp_date=‘0000-00-00’) “;and advertiser = '” . $advDetails[‘advertiser’] . “’
if($adv_id <> ‘’)
{
$Couponquery= $Couponquery . " and advertiser like '%” . $adv_id . “%'”;
}
//echo $Couponquery;
else{
//$Couponquery.=” order by rand() limit $start,$limit”;
}
if ($searchcnt <> ‘’)
{
$Couponquery .= " and name like ‘%" . $searchcnt ."%’ “;
}
if ($cat_id<>‘’)
{
$Couponquery .= " and (”;
$tempcat = $cat_id;
$catsort = “”;
while(list($key,$val)=each($keywords)){
//echo $val;
if($val<>" " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or “;}
}// end of while
$catsort=substr($catsort,0,(strlen($catsort)-3));
$Couponquery= $Couponquery . $catsort . “)”;
if ($catsort<>‘’)
{
// $cat_id = “”;
}
reset($keywords);
}
if($homepage == “true”)
{
$Couponquery= $Couponquery . " limit $limit”;
}
$nbCoupon=getSqlNumber($Couponquery);
if ($cat_id == ‘’)
{
$nbDeals += $nbCoupon;
}

$count=0;

//echo "coupons". $nbCoupon . '&lt;br&gt;';
//echo $Couponquery;
if($traceenable==true){
	fwrite($fh, $Couponquery. "\

");}
if($nbCoupon>0) {
$getCoupon=mysql_query($Couponquery);
while($item=mysql_fetch_assoc($getCoupon)){
$DealsArray[$idx][‘prod_id’] = $item[‘cid’];
$DealsArray[$idx][‘prows_description’] = $item[‘description’];
$DealsArray[$idx][‘prows_title’] = $item[‘name’];
$DealsArray[$idx][‘prows_url’] = $item[‘title_link’];
if ($item[‘shipping_desc’] == “Coupons”)
{
$DealsArray[$idx][‘type’] = $item[‘shipping_desc’];
$DealsArray[$idx][‘couponno’] = $item[‘coupon_no’];
//$DealsArray[$idx][‘prows_price’] = $item[‘ListPrice’] ;
//$DealsArray[$idx][‘rebate’] = $item[‘Percentage’] ;
}
else
{
$DealsArray[$idx][‘type’] = “Promotion”;
$DealsArray[$idx][‘shipping_desc’] = $item[‘shipping_desc’];
}

		$DealsArray[$idx]['Advertiser'] = $item['advertiser'];
		$query = "select Logo,Link from `rim_advertisers` where name = '" . $DealsArray[$idx]['Advertiser'] . "'";
		//echo $query;
		$getAdvertiser=mysql_query($query);
		$Adv=mysql_fetch_assoc($getAdvertiser);
		//echo $Adv['Logo'];
		$DealsArray[$idx]['logolink'] = $Adv['Link'];
		$DealsArray[$idx]['source'] = $item['source'];
		//echo $DealsArray[$idx]['source'];
		$DealsArray[$idx]['logoimage'] = $Adv['Logo'];//"http://www.tqlkg.com/m4115c37w1-LOMTPRTNLNMOVPQNN";
		// if ($DealsArray[$idx]['Advertiser'] == "eBags")
		// {
			// //echo "eBags";
			// $DealsArray[$idx]['logolink'] = "http://www.kqzyfj.com/c2111uoxuowBECJFHJDBDCELFGDD";
			
			// $DealsArray[$idx]['logoimage'] = "http://www.tqlkg.com/m4115c37w1-LOMTPRTNLNMOVPQNN";
		// }
		
		// else if (substr($DealsArray[$idx]['Advertiser'],0,2) == "HP")// Home & Home Office Store")
		// {
			// ///echo "HP";
			// $DealsArray[$idx]['logolink'] = "http://www.anrdoezrs.net/ch103uoxuowBECJFHJDBDCGEFLKG";
			// $DealsArray[$idx]['logoimage'] = "http://www.lduhtrp.net/h4102drvjpn8B9GCEGA8A9DBCIHD";
			// $DealsArray[$idx]['logoimage1'] = '&lt;a href="http://www.anrdoezrs.net/ch103uoxuowBECJFHJDBDCGEFLKG" target="_blank"&gt;&lt;img src="http://www.lduhtrp.net/h4102drvjpn8B9GCEGA8A9DBCIHD" alt="" border="0"/&gt;&lt;/a&gt;';
		// }
		// else if ($DealsArray[$idx]['Advertiser'] == "NewEgg.com")
		// {
			// //echo "NewEgg";
			// $DealsArray[$idx]['logolink'] = "http://www.tkqlhce.com/ij98ar-xrzEHFMIKMGEGFJJFKKN";
			
			// $DealsArray[$idx]['logoimage'] = "http://www.awltovhc.com/m1116g04tzxILJQMOQKIKJNNJOOR";
		// }
		// else if ($DealsArray[$idx]['Advertiser'] == "123Inkjets.com")
		// {
			// $DealsArray[$idx]['logolink'] = "http://www.kqzyfj.com/qq83gv30v2ILJQMOQKIKJLSRLSL";
			
			// $DealsArray[$idx]['logoimage'] = "http://www.lduhtrp.net/5f108xjnbhf031846820213A93A3";
		// }
		$DealsArray[$idx]['expiry'] = $item['expiry'];
		$idx++;
		//echo $item['shipping_desc'];
	}
}

//CJ Promotions
$Couponquery=“SELECT * FROM rim_coupon where status=1 and description2 != ‘Banner’ and shipping_desc<>‘Coupons’ “;//AND (exp_date > now() OR exp_date=‘0000-00-00’) “;and advertiser = '” . $advDetails[‘advertiser’] . “’
if($adv_id <> ‘’)
{
$Couponquery= $Couponquery . " and advertiser like '%” . $adv_id . “%'”;
}
else
{
}
if ($searchcnt <> ‘’)
{
$Couponquery .= " and name like '%” . $searchcnt .”%’ “;
}
if ($cat_id<>‘’)
{
$Couponquery .= " and (”;
$tempcat = $cat_id;
$catsort = “”;
// print_r($keywords);
while(list($key,$val)=each($keywords)){
// echo “here”. $key;
if($val<>" " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or ";}
}// end of while
// echo $catsort;
$catsort=substr($catsort,0,(strlen($catsort)-3));
$Couponquery= $Couponquery . $catsort . “)”;
if ($catsort<>‘’)
{
// $cat_id = “”;
}
reset($keywords);
}

	if($homepage == "true")
	{
		$Couponquery= $Couponquery . " limit $limit";
	}

// echo $Couponquery;
if($traceenable==true){
fwrite($fh, $Couponquery. "
");}
$nbCoupon=getSqlNumber($Couponquery);
if ($cat_id == ‘’)
{
$nbDeals += $nbCoupon;
}
//echo “promos”. $nbCoupon . ‘<br>’;

//$Couponquery.=" order by rand() limit $start,$limit";

$count=0;
//echo $Couponquery;
if($nbCoupon&gt;0) {					 
	$getCoupon=mysql_query($Couponquery);
	while($item=mysql_fetch_assoc($getCoupon)){
		$DealsArray[$idx]['prod_id'] = $item['cid'];
		//$DealsArray[$idx]['prows_image'] = $item['Image'];
		$DealsArray[$idx]['prows_description'] = $item['description'];
		$DealsArray[$idx]['prows_title'] = $item['name'];
		$DealsArray[$idx]['prows_url'] = $item['title_link'];
		if ($item['shipping_desc'] == "Coupons")
		{
			$DealsArray[$idx]['type'] = $item['shipping_desc'];
			$DealsArray[$idx]['couponno'] = $item['coupon_no'];
			//$DealsArray[$idx]['prows_price'] = $item['ListPrice'] ;
			//$DealsArray[$idx]['rebate'] =  $item['Percentage'] ;
		}
		else
		{
			$DealsArray[$idx]['type'] = "Promotion";
			$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
		}
		
		$DealsArray[$idx]['Advertiser'] = $item['advertiser'];
		$query = "select Logo,Link from `rim_advertisers` where name = '" . $DealsArray[$idx]['Advertiser'] . "'";
		//echo $query;
		$getAdvertiser=mysql_query($query);
		$Adv=mysql_fetch_assoc($getAdvertiser);
		$DealsArray[$idx]['logolink'] = $Adv['Link'];
		//echo $Adv['Logo'];
		$DealsArray[$idx]['logoimage'] = $Adv['Logo'];
		$DealsArray[$idx]['date'] = $item['datestr'];
		$DealsArray[$idx]['expiry'] = $item['expiry'];
		$DealsArray[$idx]['source'] = $item['source'];
		$idx++;
		//echo $item['shipping_desc'];
	}
}

//Ebay Deals
$sqlstr = " select * from deals_ws where Advertiser=‘Ebay’ and (Percentage > 10 and Percentage < 100)“;
if($adv_id <> ‘’)
{
$sqlstr= $sqlstr . " and advertiser like '%” . $adv_id . “%'”;
}
else if ($cat_id<>‘’)
{
$sqlstr .= " and (“;
$tempcat = $cat_id;
$catsort = “”;
while(list($key,$val)=each($keywords)){
//echo $val;
if($val<>” " and strlen($val) > 0){$catsort .= " description like ‘%" . ltrim($val) . "%’ or ";}

		}// end of while
		$catsort=substr($catsort,0,(strlen($catsort)-3));
		$sqlstr= $sqlstr .  $catsort . ")" ;
		if ($catsort&lt;&gt;'')
		{

// $cat_id = “”;
}
reset($keywords);

	}
	if ($searchcnt &lt;&gt; '')
	{
		$sqlstr .= " and title like '%" . $searchcnt ."%' ";
	}
	if($homepage == "true")
	{
		$sqlstr= $sqlstr . " limit $limit";
	}
	$rowcnt = getSqlNumber($sqlstr);
	$nbDeals += $rowcnt;

// echo $sqlstr . “ebay”. $rowcnt . ‘<br>’;
if($traceenable==true){
fwrite($fh, $sqlstr. "
");}

	if ($rowcnt &gt; 0)
	{
		$getDealsQuery=mysql_query($sqlstr);
		while($item=mysql_fetch_assoc($getDealsQuery)){	
			//print_r($item);
			$DealsArray[$idx]['prows_image'] = $item['Image'];
			
			//echo $item['Image'];//$DealsArray['prows_image'] ;
			$DealsArray[$idx]['prows_description'] = $item['description'];
			$DealsArray[$idx]['prows_title'] = $item['title'];
			$DealsArray[$idx]['prows_url'] = $item['link'];
			if ($item['dealtype'] == "Deal")
			{
				if (substr($item['ListPrice'],0,1) == "$"){
					$DealsArray[$idx]['prows_price'] = $item['ListPrice'];
				}else
				{
					$DealsArray[$idx]['prows_price'] = "$" . $item['ListPrice'];
				}

				//$DealsArray[$idx]['prows_price'] = $item['ListPrice'] ;
				$DealsArray[$idx]['rebate'] =  $item['Percentage'] ;
			}else{
				//echo $item['dealtype'];
			}
			$DealsArray[$idx]['type'] = $item['dealtype'];
			$DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
			if (substr($item['DealPrice'],0,1) == "$"){
				$DealsArray[$idx]['sale_price'] = $item['DealPrice'];}
			else{
				$DealsArray[$idx]['sale_price'] = "$" . $item['DealPrice'];
			}

			//$DealsArray[$idx]['sale_price'] = $item['DealPrice'];
			$DealsArray[$idx]['specialnote'] = $item['specialnote'];
			$DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
			$DealsArray[$idx]['prod_id'] = $item['id'];

			$idx++;
	// $DealsArray[$idx]['prows_image'] = $item['prows_image'];
	// $DealsArray[$idx]['prows_description'] = $item['prows_description'];
	// $DealsArray[$idx]['prows_price'] = $item['prows_price'];
	// $DealsArray[$idx]['sale_price'] = $item['sale_price'];
	// $DealsArray[$idx]['specialnote'] = $item['specialnote'];
	// $DealsArray[$idx]['shipping_desc'] = $item['shipping_desc'];
	// $DealsArray[$idx]['Advertiser'] = $item['Advertiser'];
	// $DealsArray[$idx]['type'] = "Deal";
		}
	}

foreach($DealsArray as $getdeals)
{
if($getdeals[‘advertiser’] == “eBay”)
{
$getdeals[‘prows_image’] = fix_amazon_image_size($getdeals[‘prows_image’], EBAY_IMAGE_SIZE);
}
else{
$getdeals[‘prows_image’] = fix_amazon_image_size($getdeals[‘prows_image’], AMAZON_IMAGE_SIZE);
}

if($getdeals['type'] == "Deal")
{
	$gDealArray[$gDealCount] = $getdeals;
	//print_r($gDealArray[$gDealCount]);
	$gDealCount++;

}
if($getdeals['type'] == "Coupons")
{
	$gCouponArray[$gCouponCount] = $getdeals;
	$gCouponCount++;
}
if($getdeals['type'] == "Promotion")
{
	$gPromotionArray[$gPromotionCount] = $getdeals;
	$gPromotionCount++;
}
//$getdeals['prows_description'] = str_replace("'","",$getdeals['prows_description']);
//$getdeals['prows_title'] = str_replace("'","",$getdeals['prows_title']);
//$getdeals['specialnote'] = str_replace("'","",$getdeals['specialnote']);
//$getdeals['shipping_desc'] = str_replace("'","",$getdeals['shipping_desc']);
//$getdeals['title_link'] = str_replace("'","",$getdeals['title_link']);
//$getdeals['prows_description'] = str_replace(chr(34),"",$getdeals['prows_description']);
//$getdeals['prows_title'] = str_replace(chr(34),"",$getdeals['prows_title']);
//$getdeals['specialnote'] = str_replace(chr(34),"",$getdeals['specialnote']);
//$getdeals['shipping_desc'] = str_replace(chr(34),"",$getdeals['shipping_desc']);
//$getdeals['title_link'] = str_replace(chr(34),"",$getdeals['title_link']);		
//$getdeals['sessionid'] = session_id();
//$sql = "SELECT 1 FROM extract_products " . "WHERE prod_id = '{$getdeals['prod_id']}' " . " AND sessionid = '{$getdeals['sessionid']}'";
//			if (getSqlNumber($sql) != 0)
//			{
//				continue;
//			}

//$sqls = "INSERT INTO extract_products( `prows_price` , `sale_price` , `prod_id` , `prows_description` , `prows_title` , `prows_url` , `title_link` , `prows_image` , `prodtype` , `specialnote` , `shipping_desc` , `imp_url` , `source` , `table_id` , `Advertiser` , `logolink` , `logoimage` , `c_date` , `expiry` , `sessionid` ) values(";
//$sqls = $sqls . "'" . $getdeals['prows_price'] . "','" . $getdeals['sale_price'] . "','" . $getdeals['prod_id'] . "','" . $getdeals['prows_description'] . "','" . $getdeals['prows_title'] . "','" . $getdeals['prows_url'] . "','" . $getdeals['title_link'] . "','" . $getdeals['prows_image'] . "','" . $getdeals['type'] . "','" . $getdeals['specialnote'] . "','" . $getdeals['shipping_desc'] . "','" . $getdeals['imp_url'] . "','" . $getdeals['source'] . "','" . $getdeals['table_id'] . "','" . $getdeals['Advertiser'] . "','" . $getdeals['logolink'] . "','" . $getdeals['logoimage'] . "','" . $getdeals['date'] . "','" . $getdeals['expiry'] . "','" . $getdeals['sessionid'] . "')";
//echo $sqls;
//exit;
//$insert_id = insertQuery($sqls);

}
shuffle($gPromotionArray);
shuffle($gDealArray);
$_SESSION[‘gDealArray’] = $gDealArray;
$_SESSION[‘gPromotionArray’] = $gPromotionArray;
$_SESSION[‘gAllArray’] = $DealsArray;
//print_r($gDealArray);
if($traceenable==true){
fclose($fh);}
?>

There’s no session_start() in that code anywhere … Is it in one of the includes maybe?