hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
ubuntu
/
bmse.net
/
Upload FileeE
HOME
<?php ob_start(); session_start(); header('Content-Type: application/json'); //CONFIGARATIONS - ///////////////////////////////////// //ini_set('display_errors',1); //include ("fpconfig.php"); require_once('includes/configure.php'); $name1 = mysqli_connect(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME); if ($_REQUEST["actType"] == "GET_EVENTS") { // give the list of existing projects $query = mysqli_query($name1, "SELECT `id`, `name`, `city` FROM `bmse_expos` WHERE `status`=1 and `remove`=1 ORDER BY `start_dttm` DESC"); $values = array(); while ($row = mysqli_fetch_assoc($query)) { //$data.="<exbition><id>".$row["id"]."</id><name>".$row["name"]."</name></exbition>"; $values[] = $row; } echo json_encode($values); } else if ($_REQUEST["actType"] == "GET_EVENTS_ADMIN") { // give the list of existing projects $query = mysqli_query($name1, 'SELECT `id`, `name`, `city` FROM `bmse_expos` WHERE `remove`=1 AND `start_dttm`>="' . date('Y-m-d 00:00:00') . '" ORDER BY `start_dttm` DESC'); $values = array(); while ($row = mysqli_fetch_assoc($query)) { //$data.="<exbition><id>".$row["id"]."</id><name>".$row["name"]."</name></exbition>"; $values[] = $row; } echo json_encode($values); } else if ($_REQUEST["actType"] == "LOAD_EVENT") { // update the current project with data $ex_id = $_REQUEST["ex_id"]; $query = mysqli_query($name1, "SELECT `id`, `name`, `city` FROM `bmse_expos` WHERE `status`=1 AND `remove`=1 AND `id`='" . $ex_id . "'"); $data_result = mysqli_fetch_assoc($query); $values = array(); $values['event'][] = $data_result; $booth_query = mysqli_query($name1, "select id,expo_id,room_number as booth, size_id from bmse_expo_rooms where type=1 and expo_id='" . $ex_id . "' and status=1 and remove=1 order by room_number asc"); while ($row = mysqli_fetch_assoc($booth_query)) { $values['booths'][] = $row; } $hall_query = mysqli_query($name1, "select id,expo_id,room_number as hall from bmse_expo_rooms where type=2 and expo_id='" . $ex_id . "' and status=1 and remove=1 order by room_number asc"); if (!$hall_query) { die(var_dump((mysqli_error($name1)))); } while ($row1 = mysqli_fetch_assoc($hall_query)) { $values['halls'][] = $row1; } echo json_encode($values); /*echo "&loadedProject=".stripslashes($data_result["ex_data"]); echo "&booths=".$booths; echo "&halls=".$halls;*/ } else if ($_REQUEST["actType"] == "LOAD_EVENT_BUYERS") { // update the current project with data $ex_id = $_REQUEST["ex_id"]; $query = mysqli_query($name1, "SELECT `id`, `name`, `city` FROM bmse_expos where status=1 and remove=1 and `id`='" . $ex_id . "'"); $data_result = mysqli_fetch_assoc($query); $values = array(); $values['buyers'] = []; $values['event'][] = $data_result; $buyers_query = mysqli_query($name1, "SELECT ER.id AS room_id, ER.expo_id, ER.size_id, BC.booth_logo as boothlogo, BC.title, M.company_logo,M.id as memid, M.name,M.website,M.email,M.phone, M.image_name,M.companyname as company, O.insert_dttm AS orderdate, ER.room_number ,ER.size_id as size FROM bmse_expo_rooms ER LEFT JOIN bmse_booth_configs BC ON ER.id = BC.boothid LEFT JOIN bmse_order_details OD ON ER.id = OD.item_id LEFT JOIN bmse_orders O ON O.id = OD.order_id LEFT JOIN bmse_members M ON M.id = O.member_id WHERE ER.expo_id ='" . $ex_id . "' AND OD.item_type_id =1 AND ER.order_status =2 AND ER.status=1 AND ER.remove=1 ORDER BY ER.room_number ASC "); $buyers = "<buyers>"; $members = array(); while ($row = mysqli_fetch_assoc($buyers_query)) { if (file_exists("exhibitoradmin/images/booth_logos/" . $row['boothlogo']) and $row['boothlogo'] != '') { $row['boothlogo'] = str_replace("&", "%26", $row['boothlogo']); } else { $row['boothlogo'] = 'default-company-logo.jpg'; } if ($row['image_name'] != '') { $row['image_name'] = str_replace("&", "%26", $row['image_name']); } else { $row['image_name'] = 'default-company-logo.jpg'; } if ($row['company_logo'] != '') { $row['company_logo'] = str_replace("&", "%26", $row['company_logo']); } else { $row['company_logo'] = 'default-company-logo.jpg'; } # Booth sign or company if (isset($row['title']) and $row['title'] != '') { $company = str_replace("&", "%26", $row['title']); $company = str_replace("'", "%27", $row['title']); $company = str_replace("'", "'", $row['title']); } else { $company = str_replace("&", "%26", $row['company']); $company = str_replace("'", "%27", $row['company']); $company = str_replace("'", "'", $row['company']); } $row['title'] = $company; $row['company'] = $company; $row['boothid'] = $row['room_id']; $row['size_id'] = $row['size_id']; $row['booth'] = $row['room_number']; $row['booth-img'] = 'exhibitoradmin/images/booth_logos/' . $row['boothlogo']; $row['email'] = $row['email']; $row['url'] = str_replace("http://", "", $row['website']); $row['member_id'] = $row['memid']; $values['buyers'][] = $row; } echo json_encode($values); } else if ($_REQUEST["actType"] == "FB_LOAD_EVENT_DATA") { // update the current project with data $evt_id = $_REQUEST["evt_id"]; $values = array('elements' => array()); $events_query = mysqli_query($name1, "SELECT `event_id`, `event_name` FROM `fb_events` where `event_id`='" . $evt_id . "' and `status`='active'"); $data_eventresult = mysqli_fetch_assoc($events_query); $data_eventresult['event_id'] = (int) $data_eventresult['event_id']; $data_eventresult['event_name'] = $data_eventresult['event_name']; $values['Event'] = $data_eventresult; $mapset_query = mysqli_query($name1, "SELECT `booth_font_size`, `color`, `size`, `height`, `width`, `viewport` FROM `fb_mapset` where `event_id`='" . $evt_id . "' and `status`='active'"); $data_mapsetresult = mysqli_fetch_assoc($mapset_query); $data_mapsetresult['booth_font_size'] = (int) $data_mapsetresult['booth_font_size']; $data_mapsetresult['height'] = (int) $data_mapsetresult['height']; $data_mapsetresult['width'] = (int) $data_mapsetresult['width']; if (!isset($data_mapsetresult['viewport'])) { $data_mapsetresult['viewport'] = '1,0,0,1,0,0'; } if (!isset($data_mapsetresult['color'])) { $data_mapsetresult['color'] = '#000000'; } $values['MapSet'] = $data_mapsetresult; $colors_query = mysqli_query($name1, "SELECT available, meeting, sold FROM fb_colors where `event_id`='" . $evt_id . "' and `status`='active'"); $data_colorsresult = mysqli_fetch_assoc($colors_query); $values['colors'] = $data_colorsresult; $elements_query = mysqli_query($name1, "SELECT `_booth_id`, `_booth_number`, `_mcName`, `color`, `bgColors`, `directions`, `height`, `key`, `keyArr`, `left`, `rotate`, `size`, `top`, `type`, `width`, `event_id` as `expo_id`, `text`, `zIndex`, `scaleX`, `scaleY` FROM fb_elements where `event_id`='" . $evt_id . "' and `status`='active'"); $i = 1; if (mysqli_num_rows($elements_query) >= 1) { while ($row = mysqli_fetch_assoc($elements_query)) { $row['rotate'] = (int) $row['rotate']; $row['keyArr'] = (int) $row['keyArr']; $row['key'] = (int) $row['key']; $row['scaleX'] = (float) $row['scaleX']; $row['scaleY'] = (float) $row['scaleY']; //$row['height'] = (int)$row['height']; //$row['width'] = (int)$row['width']; $row['height'] = $row['height']; $row['width'] = $row['width']; $row['text'] = $row['text']; if ($row['type'] == 'square') { $row['zIndex'] = (int) $row['zIndex']; } if ($row['_booth_id'] == '' or $row['_booth_id'] == 0) { $val = $i; //echo "yes"; //echo "<br>"; } else { $sizeqry = mysqli_query($name1, "select size_id from bmse_expo_rooms where id='" . $row['_booth_id'] . "' "); $sizeRes = mysqli_fetch_assoc($sizeqry); $row['size_id'] = $sizeRes['size_id']; $val = $row['_booth_id']; } $values['elements']['element_' . $val] = $row; $i++; } //echo "<pre>"; //print_r($values); echo json_encode($values); } else { echo json_encode($values); } /*echo "&loadedProject=".stripslashes($data_result["ex_data"]); echo "&booths=".$booths; echo "&halls=".$halls;*/ } else if ($_REQUEST["actType"] == "FB_SAVE_EVENT_DATA") { // update the current project with data $event_id = $_REQUEST["evt_id"]; $postdata = file_get_contents("php://input"); $request = json_decode($postdata); # exponame $expoinfoone = mysqli_query($name1, 'select `name` FROM `bmse_expos` WHERE `id`=' . $event_id . ''); $expoinfo = mysqli_fetch_assoc($expoinfoone); //echo $request->MapSet->booth_font_size; # Checking for the existing inactive and current records - deleting old FP, inactivating current FP and inserting new FP - START # for the event fb_events db $eventInfoInactveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_events` WHERE `event_id`=' . $event_id . ' and `status`="inactive"'); $eventInfoInactve = mysqli_fetch_assoc($eventInfoInactveqr); $eventInfoActiveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_events` WHERE `event_id`=' . $event_id . ' and `status`="active"'); $eventInfoActve = mysqli_fetch_assoc($eventInfoActiveqr); if (!empty($eventInfoInactve)) { mysqli_query($name1, 'DELETE FROM `fb_events` WHERE `status`="inactive" and `event_id`=' . $event_id . ''); } if (!empty($eventInfoActve)) { mysqli_query($name1, 'UPDATE `fb_events` SET `status`="inactive", `event_name`="' . $expoinfo['name'] . '" WHERE `event_id`=' . $event_id . ''); } # for the event fb_mapset db $eventMapsetInactveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_mapset` WHERE `event_id`=' . $event_id . ' and `status`="inactive"'); $eventMapsetInactve = mysqli_fetch_assoc($eventMapsetInactveqr); $eventMapsetActiveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_mapset` WHERE `event_id`=' . $event_id . ' and `status`="active"'); $eventMapsetActive = mysqli_fetch_assoc($eventMapsetActiveqr); if (!empty($eventMapsetInactve)) { mysqli_query($name1, 'DELETE FROM `fb_mapset` WHERE `status`="inactive" and `event_id`=' . $event_id . ''); } if (!empty($eventMapsetActive)) { mysqli_query($name1, 'UPDATE `fb_mapset` SET `status`="inactive" WHERE `event_id`=' . $event_id . ''); } # for the event fb_colors db $eventColorsInactveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_colors` WHERE `event_id`=' . $event_id . ' and `status`="inactive"'); $eventColorsInactve = mysqli_fetch_assoc($eventColorsInactveqr); $eventColorsActiveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_colors` WHERE `event_id`=' . $event_id . ' and `status`="active"'); $eventColorsActive = mysqli_fetch_assoc($eventColorsActiveqr); if (!empty($eventColorsInactve)) { mysqli_query($name1, 'DELETE FROM `fb_colors` WHERE `status`="inactive" and `event_id`=' . $event_id . ''); } if (!empty($eventColorsActive)) { mysqli_query($name1, 'UPDATE `fb_colors` SET `status`="inactive" WHERE `event_id`=' . $event_id . ''); } # for the event fb_elements db $eventElementsInactveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_elements` WHERE `event_id`=' . $event_id . ' and `status`="inactive"'); $eventElementsInactve = mysqli_fetch_assoc($eventElementsInactveqr); $eventElementsActiveqr = mysqli_query($name1, 'SELECT `event_id` FROM `fb_elements` WHERE `event_id`=' . $event_id . ' and `status`="active"'); $eventElementsActive = mysqli_fetch_assoc($eventElementsActiveqr); if (!empty($eventElementsInactve)) { mysqli_query($name1, 'DELETE FROM `fb_elements` WHERE `status`="inactive" and `event_id`=' . $event_id . ''); } if (!empty($eventElementsActive)) { mysqli_query($name1, 'UPDATE `fb_elements` SET `status`="inactive" WHERE `event_id`=' . $event_id . ''); } # Checking for the existing inactive and current records - deleting old FP, inactivating current FP and inserting new FP - END // Query to insert into new MapSet $eventSetSQL = "INSERT INTO `fb_events` (`event_id`, `event_name`) VALUES ($event_id, '" . $expoinfo['name'] . "') "; $eventInsert_query = mysqli_query($name1, $eventSetSQL) or die(mysqli_error()); $mapSetSQL = "INSERT INTO `fb_mapset` (`event_id`, `booth_font_size`, `color`, `size`, `height`, `width`, `viewport`) VALUES ($event_id, '" . $request->MapSet->booth_font_size . "', '" . $request->MapSet->color . "', '" . $request->MapSet->size . "', " . $request->MapSet->height . ", " . $request->MapSet->width . ", '" . $request->MapSet->viewport . "') "; $mapsetInsert_query = mysqli_query($name1, $mapSetSQL) or die(mysqli_error()); if ($mapsetInsert_query) { $colorsSQL = "INSERT INTO `fb_colors` (`event_id`, `available`, `meeting`, `sold`) VALUES ($event_id, '" . $request->colors->available . "', '" . $request->colors->meeting . "', '" . $request->colors->sold . "') "; $colorsInsert_query = mysqli_query($name1, $colorsSQL); if ($colorsInsert_query) { $i = 0; foreach ($request->elements as $eleKey => $eleVal) { if (!isset($eleVal->_booth_number)) { $boothnum = '0'; } else { $boothnum = $eleVal->_booth_number; } if (!isset($eleVal->_booth_id)) { $boothid = '0'; } else { $boothid = $eleVal->_booth_id; } if (!isset($eleVal->keyArr)) { $keyarr = '0'; } else { $keyarr = $eleVal->keyArr; } if (!isset($eleVal->key)) { $key = '0'; } else { $key = $eleVal->key; } if (!isset($eleVal->bgColors)) { $bgColors = ''; } else { $bgColors = $eleVal->bgColors; } //echo $eleKey; $elementsSQL = "INSERT INTO fb_elements ( event_id, `_booth_id`, `_booth_number`, `_mcName`, `color`,`bgColors`, `directions`, `height`, `key`, `keyArr`, `left`, `rotate`, `size`, `top`, `type`, `width`,`text`,`zIndex`,`scaleX`,`scaleY`) VALUES ($event_id, " . $boothid . ", " . $boothnum . ", '" . $eleVal->_mcName . "', '" . $eleVal->color . "', '" . $bgColors . "', '" . $eleVal->directions . "', '" . $eleVal->height . "', " . $key . ", " . $keyarr . ", '" . $eleVal->left . "', " . $eleVal->rotate . ", '" . $eleVal->size . "', '" . $eleVal->top . "', '" . $eleVal->type . "', '" . $eleVal->width . "','" . $eleVal->text . "', " . $eleVal->zIndex . ", " . $eleVal->scaleX . ", " . $eleVal->scaleY . ") "; //echo $elementsSQL; $elements_query = mysqli_query($name1, $elementsSQL) or die(mysqli_error($name1)); } } } echo json_encode($request); } else if ($_REQUEST["actType"] == "is_logged_in") { // update the current project with data //$request = json_decode($postdata); $value = array(); if (isset($_SESSION['staffone']['id']) and $_SESSION['staffone']['id'] != '') { $value['id'] = $_SESSION['staffone']['id']; } echo json_encode($value); }