function startlistingnow($ItemNum, $UserID) { global $now; global $EP; global $regcharges; CCSetSession("ItemNum", $ItemNum); $db = new clsDBNetConnect(); $db->connect(); $whereif = "ItemNum='" . $ItemNum . "'"; $days = CCDLookUp("close", "items", $whereif, $db); $dayslk = CCDLookUp("days", "lookup_listing_dates", "date_id='" . $days . "'", $db); $dayscal = 86400 * $dayslk + time(); $approval = groupApprovalSpec(); if ($approval["required"] && $now["approv_priority"] || $approval["required"] && !$now["approv_priority"] && !$approval["notrequired"]) { $stat = 99; } else { $stat = 1; } $sql = "select `acct_credit_used` from items where ItemNum = '" . $ItemNum . "'"; $db->query($sql); if ($db->next_record()) { if ($db->f("acct_credit_used") > 0) { $sql = "insert into `charges` (`user_id`, `date`, `charge`, `cause`) Values ('" . $UserID . "', '" . time() . "', '-" . $db->f("acct_credit_used") . "', 'Account Credit Used to Start Item Number: " . $ItemNum . "')"; $db->query($sql); } } $sql = "UPDATE items SET status='" . $stat . "', started=" . time() . ", closes=" . $dayscal . " WHERE ItemNum='" . $ItemNum . "'"; $db->query($sql); $sql = "select * from used_coupons where ItemNum = '" . $ItemNum . "'"; $db->query($sql); if ($db->next_record()) { $sql = "UPDATE used_coupons SET `used`='1' WHERE ItemNum='" . $ItemNum . "'"; $db->query($sql); } $sql = "select * from used_tokens where ItemNum = '" . $ItemNum . "'"; $db->query($sql); if ($db->next_record()) { $sql = "UPDATE used_tokens SET `date`='" . time() . "' WHERE ItemNum='" . $ItemNum . "'"; $db->query($sql); } unset($db); unset($sql); CCSetSession("RecentItemNum", ""); $lookdb = new clsDBNetConnect(); $lookdb->connect(); $lookdb->query("SELECT * FROM users WHERE user_id='" . $UserID . "'"); if ($lookdb->next_record()) { $ld = array("first" => $lookdb->f("first_name"), "ID" => $lookdb->f("user_id"), "user_password" => $lookdb->f("user_password"), "last" => $lookdb->f("last_name"), "email" => $lookdb->f("email"), "address" => $lookdb->f("address1"), "address2" => $lookdb->f("address2"), "state" => $lookdb->f("state_id"), "zip" => $lookdb->f("zip"), "city" => $lookdb->f("city"), "phonedy" => $lookdb->f("phone_day"), "phoneevn" => $lookdb->f("phone_evn"), "fax" => $lookdb->f("fax"), "ip" => $lookdb->f("ip_insert"), "date_created" => $lookdb->f("date_created")); } $nb = new clsDBNetConnect(); $nb->connect(); $nb->query("SELECT * FROM items WHERE " . $whereif); if ($nb->next_record()) { $ls = array("itemID" => $nb->f("itemID"), "ItemNum" => $nb->f("ItemNum"), "category" => $nb->f("category"), "title" => $nb->f("title"), "started" => $nb->f("started"), "close" => $nb->f("close"), "closes" => $nb->f("closes"), "bold" => $nb->f("bold"), "background" => $nb->f("background"), "cat_featured" => $nb->f("cat_featured"), "home_featured" => $nb->f("home_featured"), "gallery_featured" => $nb->f("gallery_featured"), "image_preview" => $nb->f("image_preview"), "slide_show" => $nb->f("slide_show"), "counter" => $nb->f("counter"), "make_offer" => $nb->f("make_offer"), "image_one" => $nb->f("image_one"), "image_two" => $nb->f("image_two"), "image_three" => $nb->f("image_three"), "image_four" => $nb->f("image_four"), "image_five" => $nb->f("image_five"), "asking_price" => $nb->f("asking_price"), "quantity" => $nb->f("quantity"), "city" => $nb->f("city_town"), "state" => $nb->f("state_province")); } $lbold = pode($ls["bold"], $regcharges["bold_fee"]); $lhome = pode($ls["home_featured"], $regcharges["home_fee"]); $lback = pode($ls["background"], $regcharges["high_fee"]); $lcat = pode($ls["cat_featured"], $regcharges["cat_fee"]); $lgal = pode($ls["gallery_featured"], $regcharges["gallery_fee"]); $lipre = pode($ls["image_preview"], $regcharges["image_pre_fee"]); $lslide = pode($ls["slide_show"], $regcharges["slide_fee"]); $lcount = pode($ls["counter"], $regcharges["counter_fee"]); $li1 = podeimg($ls["image_one"], $regcharges["upload_fee"]); $li2 = podeimg($ls["image_two"], $regcharges["upload_fee"]); $li3 = podeimg($ls["image_three"], $regcharges["upload_fee"]); $li4 = podeimg($ls["image_four"], $regcharges["upload_fee"]); $li5 = podeimg($ls["image_five"], $regcharges["upload_fee"]); if ($ls["make_offer"] == 1) { $make = "Make Offer"; } if ($ls["make_offer"] == 0) { $make = ""; } $gf1 = new clsDBNetConnect(); $gf1->connect(); $gf2 = new clsDBNetConnect(); $gf2->connect(); $gf3 = new clsDBNetConnect(); $gf3->connect(); $EP["EMAIL:AD_ITEM_NUMBER"] = $ls["ItemNum"]; $EP["EMAIL:AD_CATEGORY_ID"] = $ls["category"]; $EP["EMAIL:AD_CATEGORY"] = CCDLookUp("name", "categories", "cat_id='" . $ls["category"] . "'", $gf1); $EP["EMAIL:AD_TITLE"] = $ls["title"]; $EP["EMAIL:AD_STARTED"] = date("F j, Y, g:i a", $ls["started"]); $EP["EMAIL:AD_CLOSES"] = date("F j, Y, g:i a", $ls["closes"]); $EP["EMAIL:AD_DAYS_RUNNING"] = CCDLookUp("days", "lookup_listing_dates", "date_id='" . $ls["close"] . "'", $gf2); $EP["EMAIL:AD_BOLD_CHARGE"] = $lbold; $EP["EMAIL:AD_HIGHLIGHTED_CHARGE"] = $lback; $EP["EMAIL:AD_CATEGORY_FEATURED_CHARGE"] = $lcat; $EP["EMAIL:AD_GALLERY_CHARGE"] = $lgal; $EP["EMAIL:AD_IMAGE_PREVIEW_CHARGE"] = $lipre; $EP["EMAIL:AD_HOME_PAGE_CHARGE"] = $lhome; $EP["EMAIL:AD_SLIDE_SHOW_CHARGE"] = $lslide; $EP["EMAIL:AD_COUNTER_CHARGE"] = $lcount; $EP["EMAIL:AD_DAYS_FEE"] = CCDLookUp("fee", "lookup_listing_dates", "date_id='" . $ls["close"] . "'", $gf3); $EP["EMAIL:AD_IMAGE_ONE_CHARGE"] = $li1; $EP["EMAIL:AD_IMAGE_TWO_CHARGE"] = $li2; $EP["EMAIL:AD_IMAGE_THREE_CHARGE"] = $li3; $EP["EMAIL:AD_IMAGE_FOUR_CHARGE"] = $li4; $EP["EMAIL:AD_IMAGE_FIVE_CHARGE"] = $li5; $EP["EMAIL:AD_MAKE_OFFER"] = $make; $EP["EMAIL:AD_ASKING_PRICE"] = $ls["asking_price"]; $EP["EMAIL:AD_QUANTITY"] = $ls["quantity"]; $EP["EMAIL:AD_CITY"] = $ls["city"]; $EP["EMAIL:AD_STATE_PROVINCE"] = $ls["state"]; $EP["EMAIL:CURRENT_USERNAME"] = CCGetUserLogin(); $EP["EMAIL:CURRENT_USERID"] = $ld["ID"]; $EP["EMAIL:CURRENT_USER_PASSWORD"] = $ld["user_password"]; $EP["EMAIL:CURRENT_USER_FIRST_NAME"] = $ld["first"]; $EP["EMAIL:CURRENT_USER_LAST_NAME"] = $ld["last"]; $EP["EMAIL:CURRENT_USER_EMAIL"] = $ld["email"]; $EP["EMAIL:CURRENT_USER_ADDRESS"] = $ld["address"]; $EP["EMAIL:CURRENT_USER_ADDRESS2"] = $ld["address2"]; $EP["EMAIL:CURRENT_USER_STATE"] = $ld["state"]; $EP["EMAIL:CURRENT_USER_CITY"] = $ld["city"]; $EP["EMAIL:CURRENT_USER_ZIP"] = $ld["zip"]; $EP["EMAIL:CURRENT_USER_DAY_PHONE"] = $ld["phonedy"]; $EP["EMAIL:CURRENT_USER_EVN_PHONE"] = $ld["phoneevn"]; $EP["EMAIL:CURRENT_USER_FAX"] = $ld["fax"]; $EP["EMAIL:CURRENT_USER_IP"] = getenv("REMOTE_ADDR"); $EP["EMAIL:CURRENT_USER__REGISTERED_IP"] = $ld["ip"]; $EP["EMAIL:CURRENT_USER_DATE_SIGNEDUP"] = date("F j, Y, g:i a", $ld["date_created"]); if ($stat == 99) { mailout("NewListingApproval", $now["notifyads"], $ld["ID"], 1000000000, time(), $EP); } else { mailout("NewListing", $now["notifyads"], $ld["ID"], 1000000000, time(), $EP); index_listing($ItemNum); $db = new clsDBNetConnect(); $query = "Select * from custom_textarea_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "ta", $db->f("field_id")); } $query = "Select * from custom_textbox_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "tb", $db->f("field_id")); } $query = "Select * from custom_dropdown_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("option_id"), "dd", $db->f("field_id"), $db->f("option_id")); } add_catcounts($ls["category"]); } //End Custom Code return $stat; }
$query = "Select * from custom_textarea_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "ta", $db->f("field_id")); } $query = "Select * from custom_textbox_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "tb", $db->f("field_id")); } $query = "Select * from custom_dropdown_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("option_id"), "dd", $db->f("field_id"), $db->f("option_id")); } add_catcounts($category); $query = "update `items` set `status` = '1', `closes` = '" . $closes . "' where `ItemNum` = '" . $_GET["Item_Number"] . "'"; $db->query($query); } } header("Location:ItemsList_Approve.php"); } //Initialize Objects @1-9EBE738D $DBDBNetConnect = new clsDBDBNetConnect(); // Controls $Header = new clsHeader(); $Header->BindEvents(); $Header->TemplatePath = "Themes/"; $Header->Initialize(); $items = new clsGriditems(); $Footer = new clsFooter();
function Insert() { global $valid; if (strlen(CCGetParam("Preview", ""))) { $table = "items_preview"; } else { $table = "items"; } $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert"); $ItemNum = $this->ItemNum->DBValue; if (!$valid) { $SQL = "INSERT INTO {$table}(" . "category, " . "title, " . "item_paypal, " . "quantity, " . "ship1, " . "shipfee1, " . "ship2, " . "shipfee2, " . "ship3, " . "shipfee3, " . "ship4, " . "shipfee4, " . "ship5, " . "shipfee5, " . "asking_price, " . "make_offer, " . "description, " . "image_preview, " . "slide_show, " . "city_town, " . "state_province, " . "country, " . "close, " . "closes, " . "started, " . "home_featured, " . "gallery_featured, " . "cat_featured, " . "bold, " . "background, " . "counter, " . "ItemNum, " . "user_id, " . "status, " . "image_five, " . "image_four, " . "image_three, " . "image_two, " . "image_one" . ") VALUES (" . $this->ToSQL($this->category->DBValue, $this->category->DataType) . ", " . $this->ToSQL($this->title->DBValue, $this->title->DataType) . ", " . $this->ToSQL($this->item_paypal->DBValue, $this->item_paypal->DataType) . ", " . $this->ToSQL($this->quantity->DBValue, $this->quantity->DataType) . ", " . $this->ToSQL($this->ship1->DBValue, $this->ship1->DataType) . ", " . $this->ToSQL($this->shipfee1->DBValue, $this->shipfee1->DataType) . ", " . $this->ToSQL($this->ship2->DBValue, $this->ship2->DataType) . ", " . $this->ToSQL($this->shipfee2->DBValue, $this->shipfee2->DataType) . ", " . $this->ToSQL($this->ship3->DBValue, $this->ship3->DataType) . ", " . $this->ToSQL($this->shipfee3->DBValue, $this->shipfee3->DataType) . ", " . $this->ToSQL($this->ship4->DBValue, $this->ship4->DataType) . ", " . $this->ToSQL($this->shipfee4->DBValue, $this->shipfee4->DataType) . ", " . $this->ToSQL($this->ship5->DBValue, $this->ship5->DataType) . ", " . $this->ToSQL($this->shipfee5->DBValue, $this->shipfee5->DataType) . ", " . $this->ToSQL($this->asking_price->DBValue, $this->asking_price->DataType) . ", " . $this->ToSQL($this->make_offer->DBValue, $this->make_offer->DataType) . ", " . $this->ToSQL($this->description->DBValue, $this->description->DataType) . ", " . $this->ToSQL($this->image_preview->DBValue, $this->image_preview->DataType) . ", " . $this->ToSQL($this->slide_show->DBValue, $this->slide_show->DataType) . ", " . $this->ToSQL($this->city_town->DBValue, $this->city_town->DataType) . ", " . $this->ToSQL($this->state_province->DBValue, $this->state_province->DataType) . ", " . $this->ToSQL($this->country->DBValue, $this->country->DataType) . ", " . $this->ToSQL($this->close->DBValue, $this->close->DataType) . ", " . $this->ToSQL($this->closes->DBValue, $this->closes->DataType) . ", " . $this->ToSQL($this->started->DBValue, $this->started->DataType) . ", " . $this->ToSQL($this->home_featured->DBValue, $this->home_featured->DataType) . ", " . $this->ToSQL($this->gallery_featured->DBValue, $this->gallery_featured->DataType) . ", " . $this->ToSQL($this->cat_featured->DBValue, $this->cat_featured->DataType) . ", " . $this->ToSQL($this->bold->DBValue, $this->bold->DataType) . ", " . $this->ToSQL($this->background->DBValue, $this->background->DataType) . ", " . $this->ToSQL($this->counter->DBValue, $this->counter->DataType) . ", " . $this->ToSQL($this->ItemNum->DBValue, $this->ItemNum->DataType) . ", " . $this->ToSQL($this->user_id->DBValue, $this->user_id->DataType) . ", " . $this->ToSQL($this->status->DBValue, $this->status->DataType) . ", " . $this->ToSQL($this->image_five->DBValue, $this->image_five->DataType) . ", " . $this->ToSQL($this->image_four->DBValue, $this->image_four->DataType) . ", " . $this->ToSQL($this->image_three->DBValue, $this->image_three->DataType) . ", " . $this->ToSQL($this->image_two->DBValue, $this->image_two->DataType) . ", " . $this->ToSQL($this->image_one->DBValue, $this->image_one->DataType) . ")"; } else { $days = new clsDBNetConnect(); $days->query("select * from lookup_listing_dates where date_id = '" . $this->close->DBValue . "'"); $closes = time(); if ($days->next_record()) { if ($this->addtime->DBValue == 1) { $closes = time() + 86400 * $days->f("days"); } } $start = 0; if ($this->startnow->DBValue == 1) { $start = 1; add_catcounts($this->category->DBValue); } $SQL = "INSERT INTO {$table}(" . "category, " . "title, " . "item_paypal, " . "quantity, " . "ship1, " . "shipfee1, " . "ship2, " . "shipfee2, " . "ship3, " . "shipfee3, " . "ship4, " . "shipfee4, " . "ship5, " . "shipfee5, " . "asking_price, " . "make_offer, " . "description, " . "image_preview, " . "slide_show, " . "city_town, " . "state_province, " . "country, " . "close, " . "closes, " . "started, " . "home_featured, " . "gallery_featured, " . "cat_featured, " . "bold, " . "background, " . "counter, " . "ItemNum, " . "user_id, " . "status, " . "image_five, " . "image_four, " . "image_three, " . "image_two, " . "image_one" . ") VALUES (" . $this->ToSQL($this->category->DBValue, $this->category->DataType) . ", " . $this->ToSQL($this->title->DBValue, $this->title->DataType) . ", " . $this->ToSQL($this->item_paypal->DBValue, $this->item_paypal->DataType) . ", " . $this->ToSQL($this->quantity->DBValue, $this->quantity->DataType) . ", " . $this->ToSQL($this->ship1->DBValue, $this->ship1->DataType) . ", " . $this->ToSQL($this->shipfee1->DBValue, $this->shipfee1->DataType) . ", " . $this->ToSQL($this->ship2->DBValue, $this->ship2->DataType) . ", " . $this->ToSQL($this->shipfee2->DBValue, $this->shipfee2->DataType) . ", " . $this->ToSQL($this->ship3->DBValue, $this->ship3->DataType) . ", " . $this->ToSQL($this->shipfee3->DBValue, $this->shipfee3->DataType) . ", " . $this->ToSQL($this->ship4->DBValue, $this->ship4->DataType) . ", " . $this->ToSQL($this->shipfee4->DBValue, $this->shipfee4->DataType) . ", " . $this->ToSQL($this->ship5->DBValue, $this->ship5->DataType) . ", " . $this->ToSQL($this->shipfee5->DBValue, $this->shipfee5->DataType) . ", " . $this->ToSQL($this->asking_price->DBValue, $this->asking_price->DataType) . ", " . $this->ToSQL($this->make_offer->DBValue, $this->make_offer->DataType) . ", " . $this->ToSQL($this->description->DBValue, $this->description->DataType) . ", " . $this->ToSQL($this->image_preview->DBValue, $this->image_preview->DataType) . ", " . $this->ToSQL($this->slide_show->DBValue, $this->slide_show->DataType) . ", " . $this->ToSQL($this->city_town->DBValue, $this->city_town->DataType) . ", " . $this->ToSQL($this->state_province->DBValue, $this->state_province->DataType) . ", " . $this->ToSQL($this->country->DBValue, $this->country->DataType) . ", " . $this->ToSQL($this->close->DBValue, $this->close->DataType) . ", " . $this->ToSQL($closes, $this->closes->DataType) . ", " . $this->ToSQL($this->started->DBValue, $this->started->DataType) . ", " . $this->ToSQL($this->home_featured->DBValue, $this->home_featured->DataType) . ", " . $this->ToSQL($this->gallery_featured->DBValue, $this->gallery_featured->DataType) . ", " . $this->ToSQL($this->cat_featured->DBValue, $this->cat_featured->DataType) . ", " . $this->ToSQL($this->bold->DBValue, $this->bold->DataType) . ", " . $this->ToSQL($this->background->DBValue, $this->background->DataType) . ", " . $this->ToSQL($this->counter->DBValue, $this->counter->DataType) . ", " . $this->ToSQL($this->ItemNum->DBValue, $this->ItemNum->DataType) . ", " . $this->ToSQL($this->fakeuser->DBValue, $this->fakeuser->DataType) . ", " . $this->ToSQL($start, $this->status->DataType) . ", " . $this->ToSQL($this->image_five->DBValue, $this->image_five->DataType) . ", " . $this->ToSQL($this->image_four->DBValue, $this->image_four->DataType) . ", " . $this->ToSQL($this->image_three->DBValue, $this->image_three->DataType) . ", " . $this->ToSQL($this->image_two->DBValue, $this->image_two->DataType) . ", " . $this->ToSQL($this->image_one->DBValue, $this->image_one->DataType) . ")"; } //print $SQL; //exit; $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert"); $this->query($SQL); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert"); if ($this->Errors->Count() > 0) { $this->Errors->AddError($this->Errors->ToString()); } //////////////////////////////////// //Enter custom fields into the DB //////////////////////////////////// global $_POST; //Text Area Values reset($_POST); $values = ""; if (stristr(implode(",", array_keys($_POST)), "custtxt_area")) { while (list($key, $val) = each($_POST)) { if (stristr($key, "custtxt_area")) { $values[] = $key; } } } $db = new clsDBNetConnect(); $i = 0; while ($values[$i]) { $query = "insert into custom_textarea_values(`field_id`, `ItemNum`, `value`) values ('" . end(explode("::", $values[$i])) . "', '" . $this->ItemNum->DBValue . "', '" . mysql_escape_string($_POST[$values[$i]]) . "')"; $i++; $db->query($query); } //Text Box Values reset($_POST); $values = ""; if (stristr(implode(",", array_keys($_POST)), "custtxt_box")) { while (list($key, $val) = each($_POST)) { if (stristr($key, "custtxt_box")) { $values[] = $key; } } } $db = new clsDBNetConnect(); $i = 0; while ($values[$i]) { $query = "insert into custom_textbox_values(`field_id`, `ItemNum`, `value`) values ('" . end(explode("::", $values[$i])) . "', '" . $this->ItemNum->DBValue . "', '" . mysql_escape_string($_POST[$values[$i]]) . "')"; $i++; $db->query($query); } //Dropdown Box Values reset($_POST); $values = ""; if (stristr(implode(",", array_keys($_POST)), "custddbox")) { while (list($key, $val) = each($_POST)) { if (stristr($key, "custddbox")) { $values[] = $key; } } } $db = new clsDBNetConnect(); $i = 0; while ($values[$i]) { $query = "insert into custom_dropdown_values(`field_id`, `ItemNum`, `option_id`) values ('" . end(explode("::", $values[$i])) . "', '" . $this->ItemNum->DBValue . "', '" . mysql_escape_string($_POST[$values[$i]]) . "')"; $i++; $db->query($query); } if ($valid && $start == 1) { index_listing($ItemNum); $db = new clsDBNetConnect(); $query = "Select * from custom_textarea_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "ta", $db->f("field_id")); } $query = "Select * from custom_textbox_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("value"), "tb", $db->f("field_id")); } $query = "Select * from custom_dropdown_values where `ItemNum` = {$ItemNum}"; $db->query($query); while ($db->next_record()) { index_listing($ItemNum, $db->f("option_id"), "dd", $db->f("field_id"), $db->f("option_id")); } add_catcounts($this->category->DBValue); } }