require dirname(__FILE__) . '/includes/init.php'; require ROOT_PATH . 'includes/cls_json.php'; if (!isset($_REQUEST['vote']) || !isset($_REQUEST['options']) || !isset($_REQUEST['type'])) { ecs_header("Location: ./\n"); exit; } $res = array('error' => 0, 'message' => '', 'content' => ''); $vote_id = intval($_POST['vote']); $options = trim($_POST['options']); $type = intval($_POST['type']); $ip_address = real_ip(); if (vote_already_submited($vote_id, $ip_address)) { $res['error'] = 1; $res['message'] = $_LANG['vote_ip_same']; } else { save_vote($vote_id, $ip_address, $options); $vote = get_vote($vote_id); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } $str = $smarty->fetch("library/vote.lbi"); $pattern = '/(?:<(\\w+)[^>]*> .*?)?<div\\s+id="ECS_VOTE">(.*)<\\/div>(?:.*?<\\/\\1>)?/is'; if (preg_match($pattern, $str, $match)) { $res['content'] = $match[2]; } $res['message'] = $_LANG['vote_success']; } $json = new JSON(); echo $json->encode($res); /*------------------------------------------------------ */
$location = urlencode($location); $place_name = urldecode($location); // geocode try { $location_XML = yahoo_geo($_REQUEST['location']); $location = $location_XML['Latitude'] . "," . $location_XML['Longitude']; $location_latitude = $location_XML['Latitude']; $location_longitude = $location_XML['Longitude']; // get event number $event_index = $_POST['event_index']; if ($event_index > 0) { $conn = get_db_connection($db_user, $db_passwd, $db_name); $event_label = $event_index; $latitudes[$event_index] = $location_latitude; $longitudes[$event_index] = $location_longitude; $sql_result = save_vote($location_latitude, $location_longitude, $event_label); // $db_status_close = close_db_connection($conn); } else { $event_label = ""; } // $map_click_X = $_POST['map_x']; $map_click_Y = $_POST['map_y']; } catch (exception $e) { $location_latitude = 0; $location_longitude = 0; // or display default entry page $location = ""; $place_name = ""; $event_index = 0;