$Titel"; echo $Body; $boShowErrors = 1; define('ConsPageForMarketplace','index.php?i=84'); //define('ConsPageForMarketplace','marketplace.inc.php'); // For changing packet prices, go to pakket.class.php // additional classes include("db_common2.class.php"); include("debug.class.php"); $db_market = new db_common2; $strWie = $arVisitor["name"]; $intBarak = $arVisitor["barrack"]; /////////// Tijdelijk if ($arVisitor["status"]) { if ($_REQUEST["action"] == 'add_item') { $strWhat = addslashes($_REQUEST["htWhat"]); $strName = addslashes($_REQUEST["htName"]); $intBarak = (INT)$_REQUEST["htBarak"]; $strContact = addslashes($_REQUEST["htContact"]); $strExpDate = addslashes($_REQUEST["htExpDate"]); $strPrice = AddSlashes($_REQUEST["htPrice"]); if ($_REQUEST["htOfferOrRequest"] == "offer") $boIsOffer = 1; if ($_REQUEST["htOfferOrRequest"] == "request") $boIsRequest = 1; if ($_REQUEST["htOfferOrRequest"] == "both") { $boIsOffer = 1; $boIsRequest = 1; } $strSQL = "INSERT INTO marketplace SET placing_date = NOW(), expiration_date = '$strExpDate', what = '$strWhat', name = '$strName', barrack = '$intBarak', contact = '$strContact', price = '$strPrice', is_offer = '$boIsOffer', is_request = '$boIsRequest', edit_log = '".$_SERVER['REMOTE_ADDR']." @ ".date('r')."';"; $db_market->query_run($strSQL,"?? ".__FILE__." at ".__LINE__); $strBody .= "

Your item has been added

"; //If new, add to database $strSQL = "SELECT * FROM droef_visitor WHERE ip = '".$arVisitor["iplong"]."';"; if (!($resKnownVisitors = $db_market->query_return_resource($strSQL,"?? ".__FILE__." at ".__LINE__))) die ("

Something wrong..

.$strSQL"); if (mysqli_num_rows($resKnownVisitors)==0) { $strSQL = "INSERT INTO droef_visitor SET ip = '".$arVisitor["iplong"]."', last_visit = NOW();"; if (!($resKnownVisitors = $db_market->query_return_resource($strSQL,"?? ".__FILE__." at ".__LINE__))) die ("

Something wrong..

.$strSQL"); $arVisitor["status"] = 1; } else { if (mysqli_num_rows($resKnownVisitors)) { $arVisitor = mysqli_fetch_array($resKnownVisitors); $arVisitor["status"] = 2; $arVisitor["iplong"] = sprintf("%u", ip2long($_SERVER['REMOTE_ADDR'])); // Update $strSQL = "UPDATE droef_visitor SET last_visit = NOW(), name = '$strName', barrack = '$intBarak' WHERE ip = '".$arVisitor["iplong"]."';"; if (!($resKnownVisitors = $db_market->query_return_resource($strSQL,"?? ".__FILE__." at ".__LINE__))) die ("

Something wrong..

.$strSQL"); } } } $strBody .="

Offers
Requests
Add your items!"; $strSQL = "SELECT * FROM marketplace WHERE is_offer AND (expiration_date > NOW() OR expiration_date = '0000-00-00') ORDER BY placing_date DESC, ID DESC;"; $resOffers = $db_market->query_return_resource($strSQL,"?? ".__FILE__." at ".__LINE__); $strBody .= "

Offers

"; $strBody .= ""; while ($arOffer = mysqli_fetch_array($resOffers)) { $strBody .= ""; } $strBody .= "
What?NameContactRewardPlacing date
"; $strBody .= nl2br(stripslashes($arOffer["what"])); $strBody .= ""; $strBody .= stripslashes($arOffer["name"]); $strBody .= " "; $strBody .= stripslashes($arOffer["barrack"]); $strBody .= ""; $strBody .= stripslashes($arOffer["contact"]); $strBody .= ""; $strBody .= stripslashes($arOffer["price"]); $strBody .= ""; $strBody .= stripslashes($arOffer["placing_date"]); $strBody .= "
"; $strSQL = "SELECT * FROM marketplace WHERE is_request AND (expiration_date > NOW() OR expiration_date = '0000-00-00') ORDER BY placing_date DESC, ID DESC;"; $resOffers = $db_market->query_return_resource($strSQL,"?? ".__FILE__." at ".__LINE__); $strBody .= "

Requests

"; $strBody .= ""; while ($arOffer = mysqli_fetch_array($resOffers)) { $strBody .= ""; } $strBody .= "
What?NameContactRewardPlacing date
"; $strBody .= nl2br(stripslashes($arOffer["what"])); $strBody .= ""; $strBody .= stripslashes($arOffer["name"]); $strBody .= " "; $strBody .= stripslashes($arOffer["barrack"]); $strBody .= ""; $strBody .= stripslashes($arOffer["contact"]); $strBody .= ""; $strBody .= stripslashes($arOffer["price"]); $strBody .= ""; $strBody .= stripslashes($arOffer["placing_date"]); $strBody .= "
"; $strBody .= "

Add your item

"; $strBody .= "

Add item for Droevendaal Marketplace "; $strBody .= "
What: "; $strBody .= "
This is.. "; $strBody .= "
I am:
of Barrack "; $strBody .= ChooseBarrack2($intBarak); $strBody .= "
Contact
Price / reward
Expiration date (format: yyyy-mm-dd)"; $strBody .= "

"; } else { $strBody.= "

Sorry, this part is for Droevendaal internal only

"; } echo $strBody; ///////////// function ChooseBarrack2($intBarak=0) // comes back in htBarak { $strBody = ""; return $strBody; } ?>

Last edited: 2010-02-23 23:53:46 by Luc