function main() { $action = $_REQUEST['action']; if (isset($action)) { switch ($action) { case "save_map": save_map($_REQUEST); break; case "show_tiles": show_tiles(); break; case "show_maps": show_maps(); break; case "load_map": load_map($_REQUEST['map']); break; default: echo 'invalid action'; } } }
$post_list['marker_icon'] = isset($_POST['marker_icon']) ? $_POST['marker_icon'] : ''; $post_list['line_title'] = isset($_POST['line_title']) ? $_POST['line_title'] : ''; $post_list['line_coords'] = isset($_POST['line_coords']) ? $_POST['line_coords'] : ''; $post_list['poly_title'] = isset($_POST['poly_title']) ? $_POST['poly_title'] : ''; $post_list['poly_coords'] = isset($_POST['poly_coords']) ? $_POST['poly_coords'] : ''; $post_list['rect_title'] = isset($_POST['rect_title']) ? $_POST['rect_title'] : ''; $post_list['rect_coords'] = isset($_POST['rect_coords']) ? $_POST['rect_coords'] : ''; $post_list['circle_title'] = isset($_POST['circle_title']) ? $_POST['circle_title'] : ''; $post_list['circle_coords'] = isset($_POST['circle_coords']) ? $_POST['circle_coords'] : ''; var_dump($post_list); exit; if (trim($post_list['map_title']) == '') { $vars['error_msg'] = $lang_msg['ERROR_EMPTY_TITLE']; } if (empty($vars['error_msg'])) { $vars_tmp = save_map($post_list); // redirect the page to map view $page = 'map_view'; } $vars['html_title'] = $lang_msg['MAP_VIEW_TITLE']; $vars['page_title'] = $lang_msg['MAP_VIEW_PAGE_TITLE']; break; default: $vars['html_title'] = ''; $vars['page_title'] = $lang_msg['PAGE_TITLE']; break; } // check option to show only map $vars['map_o'] = false; if ($page == 'map_view' && isset($_GET['map_o']) && $_GET['map_o'] == 1) { $vars['map_o'] = true;
<?php include "../lib.php"; $name = $_POST['name']; $json = $_POST['json']; save_map($name, $json);