quoteSmart($_REQUEST['id']); // Update the number of views for this item $viewExists = $link->querySingleItem("SELECT id FROM views WHERE itemid=$itemId AND date=".$link->quoteSmart(date("Y-m-d"))); if ($viewExists < 1) { $strSql = "INSERT INTO views (itemid,date,count) VALUES ($itemId,".$link->quoteSmart(date("Y-m-d")).",1)"; } else { $strSql = "UPDATE views SET count=count+1 WHERE itemid=$itemId AND date=".$link->quoteSmart(date("Y-m-d")); } $doIt = $link->execute($strSql); // Get the item details ... $strSql = "SELECT items.*, ages.description as agedesc, conditions.description as conddesc, members.username as givername, counties.name as countyname, members.address3 as city FROM items LEFT JOIN ages ON ages.id = items.age LEFT JOIN conditions ON conditions.id = items.cond LEFT JOIN members ON members.id = items.sellerid LEFT JOIN counties ON counties.id = items.county WHERE items.id=$itemId"; $thisItem = $search->simpleSearch($strSql); $img = ($thisItem[0]->image == "" or $thisItem[0]->image == NULL or $thisItem[0]->image == "http://")? "nopic.gif" : $thisItem[0]->image; // Store the category ID (useful for determining if item is Wanted or Offered) $thisItemCat = $thisItem[0]->category; /* seperate out the Get Now/Want message and/or replace with Login msg if this isn't a recognised user */ if ($user->isValidUser()) { $buyTxt = ($thisItemCat == 30)? "I can offer this item" : "I WANT THIS ITEM"; $buyMsg = "$buyTxt - (List an item like this)"; $askQuestionMsg = "

Ask a question about this item

"; } else { $buyMsg = "

Only registered users can contact other users about their listed items. If you are a registered user please Login Now or why not Sign Up today! it's free!

"; $askQuestionMsg = ""; } // Calculate time remaining .. $timeLeft = dateDiff((date("Y-m-d G:i:s",time())),$thisItem[0]->expires); $yearsLeft = ($timeLeft['years'] > 0)? $timeLeft['years']." years, " : ""; $monthsLeft = ($timeLeft['months'] > 0)? $timeLeft['months']." months, " : ""; $daysLeft = ($timeLeft['days'] > 0)? $timeLeft['days']." days, " : ""; $hrsLeft = ($timeLeft['hours'] > 0)? $timeLeft['hours']." hours, " : ""; $minsLeft = ($timeLeft['minutes'] > 0)? "and ".$timeLeft['minutes']." mins" : ""; $timeLeft = $yearsLeft.$monthsLeft.$daysLeft.$hrsLeft.$minsLeft; // Create the location description $location = ($thisItem[0]->city != NULL and $thisItem[0]->city !="")? $thisItem[0]->city.", ".$thisItem[0]->countyname : $thisItem[0]->countyname; // Get the image details for the popup if ( ($img != "") && ($img != "http://") ) { $imagesize = getimagesize("uploads/fullsize/$img"); $imagewidth = $imagesize[0]; $imageheight = $imagesize[1]; // Code added to deal with oversize images (for scanned reviews etc) // set a default .. $scroll = "no"; if ($imagewidth > 700 or $imageheight > 500) { $scroll = "yes"; $imageheight=500; } else { $scroll = "no"; } } /* ***** GET THE STATE - With 3rd party linking & Google etc, it's possible for detail pages to exist AFTER item ahve been rehomed, so I'll use a local var to see what we should display. If the item has been rehomed, show only very basic info ***** */ $available = ($thisItem[0]->state == "l" || $thisItem[0]->state == "w"); // is it available ? $title = $thisItem[0]->title." - free to collect in your local area at Rehomeyourstuff.co.uk"; include_once ("includes/header.php"); include_once ("includes/navigation.php"); include_once ("js/popup.js"); ?>
Categories