CasperSecurity
<?php
session_start();
include '../../connection/connection.php';
$room = $_REQUEST['room'];
$location_name = $_REQUEST['loc'];
$floor = $_REQUEST['floor'];
$building = $_REQUEST['building'];
$street = $_REQUEST['street'];
$city = $_REQUEST['city'];
$state = $_REQUEST['state'];
$utm_zonee= $_REQUEST['utm_zone'];
$utm_side_a= $_REQUEST['utm_side_a'];
$utm_side_a_valuee= $_REQUEST['utm_side_a_value'];
$utm_side_b= $_REQUEST['utm_side_b'];
$utm_side_b_valuee= $_REQUEST['utm_side_b_value'];
$latitudee = $_REQUEST['latitude'];
$longitudee = $_REQUEST['longitude'];
$altitudee = $_REQUEST['altitude'];
if(empty($utm_zonee)){
$utm_zone = 0;
}else{
$utm_zone = $utm_zonee;
}
if(empty($utm_side_a_valuee)){
$utm_side_a_value = 0;
}else{
$utm_side_a_value = $utm_side_a_valuee;
}
if(empty($utm_side_b_valuee)){
$utm_side_b_value = 0;
}else{
$utm_side_b_value = $utm_side_b_valuee;
}
if(empty($latitudee)){
$latitude = 0;
}else{
$latitude = $latitudee;
}
if(empty($longitudee)){
$longitude = 0;
}else{
$longitude = $longitudee;
}
if(empty($altitudee)){
$altitude = 0;
}else{
$altitude = $altitudee;
}
$user_id = $_SESSION['USER_ID'];
$date = date("Y-m-d");
$is_active = 'yes';
$db_handle = new DBController();
$newInsertt = $db_handle->numRows("SELECT * FROM location WHERE room_no = '$room' AND location_name = '$location_name' AND building='$building'");
if($newInsertt >= '1'){
$_SESSION['ERROR_MSG'] = "Location Already Exist";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../web/home/modules/setup/location/locationgrid.php');
}else{
$db_handle = new DBController();
$newInsert = $db_handle->tableinsert("INSERT INTO location (room_no,location_name,floor,building,street,city,state,utm_zone,utm_side_a,utm_side_a_value,utm_side_b,utm_side_b_value,latitude,longitude,altitude,created_on,created_by,is_active)
VALUES ('$room','$location_name','$floor','$building','$street','$city','$state',$utm_zone,'$utm_side_a','$utm_side_a_value','$utm_side_b','$utm_side_b_value','$latitude','$longitude','$altitude','$date','".(int)$user_id."','$is_active')");
if($newInsert == TRUE){
$_SESSION['ERROR_MSG'] = "Success";
$_SESSION['MSG_ALRT'] = "TRUE";
header('location:../../../web/home/modules/setup/location/locationgrid.php');
}else{
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../web/home/modules/setup/location/locationgrid.php');
}
}
?>