if ($status == "NOTOK") { $msg = "<div class='alert alert-error' id='error_box'>" . $msg . "</div>"; } else { $gbizObj = new Business(); $package = $gbizObj->getPkg($requested_pkg); $gbizObj->setBizInfo($id, $title, $tagline, $category, $subCategory, $description, $listingUrl); $gbizObj->setContactInfo($email, $phone, $fax, $mobile, $contactP); $gbizObj->setLocationInfo($street, $city, $country, $zip, $latitude, $longitude); $gbizObj->setKeywordInfo($keywords); $gbizObj->setPkg($package); $result = $gbizObj->add(); // Cause insert a new business record in to the database if ($result) { $bizId = $gbizObj->business_id; $gbannerObj = new Banner(); $gbannerObj->setBannerInfo($banerType, $caption, $adUrl, $bizId, $id); $gbannerObj->add(); $bannerId = $gdbObj->insert_id(); $msg .= "<b>You have successfully added a new business with the Id of " . $bizId . "</b>"; $msg = "<div class='alert alert-info' id='error_box'>" . $msg . "</div>"; //upload the logo file mkdir(SITE_ROOT . "/biz/{$bizId}", 0755); $tmp_file = $_FILES['file_upload']['tmp_name']; $originalFile = basename($_FILES['file_upload']['name']); $extension = substr($originalFile, strripos($originalFile, '.'), strlen($originalFile)); $renamedFile = "logo" . $extension; $upload_dir = "biz/{$bizId}"; move_uploaded_file($tmp_file, $upload_dir . "/" . $renamedFile); //upload banner image file $tmp_file = $_FILES['banner_upload']['tmp_name']; $originalFile = basename($_FILES['banner_upload']['name']);
$destination = $_POST['txtDestination']; $adUrl = $urlProtocol . $destination; if ($destination == NULL) { $adUrl = ""; } else { if ($destination != NULL && !$gvalObj->isURL($adUrl)) { $msg = $msg . "Invalid banner URL<br>"; $status = "NOTOK"; } } if ($status == "NOTOK") { $msg = "<div class='alert alert-error' id='error_box'>" . $msg . "</div>"; } else { $gbannerObj = new Banner(); $gbannerObj->setListingId($lid); $gbannerObj->setBannerInfo($banerType, $caption, $adUrl); $result = $gbannerObj->add(); $bannerID = $gbannerObj->getBannerId(); if ($result) { //upload banner image file $tmp_file = $_FILES['banner_upload']['tmp_name']; $originalFile = basename($_FILES['banner_upload']['name']); $extension = substr($originalFile, strripos($originalFile, '.'), strlen($originalFile)); $renamedFile = $bannerID . "" . $extension; $upload_dir = "ads/{$banerType}"; move_uploaded_file($tmp_file, $upload_dir . "/" . $renamedFile); $msg .= "<b>Listing updated successfully</b>"; $msg = "<div class='alert alert-info'>" . $msg . "</div>"; } else { $msg .= "An error occurred while updating data. Please try again."; $msg = "<div class='alert alert-error' id='error_box'>" . $msg . "</div>";