-
Notifications
You must be signed in to change notification settings - Fork 1
/
setActiveLocation.php
26 lines (21 loc) · 963 Bytes
/
setActiveLocation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include 'includes/session.php';
include 'includes/dbConnect.php';
include 'includes/library.php';
$meeting_id = mysqli_real_escape_string($connection, $_GET['meeting_id']);
$location_id = mysqli_real_escape_string($connection, $_GET['location_id']);
// check if user is owner
if ($user_id != getMeetingOwnerID($connection, $meeting_id)){
header("Location: error.php");
exit;
}
$query = "SELECT * FROM locations WHERE location_id='$location_id'";
$result = mysqli_query($connection, $query);
$location = mysqli_fetch_array($result, MYSQLI_ASSOC);
$location_name = $location['name'];
$location_latitude = $location['latitude'];
$location_langitude = $location['longitude'];
$query = "UPDATE meetings SET location='$location_name', latitude='$location_latitude', longitude='$location_longitude' WHERE meeting_id=$meeting_id";
$result = mysqli_query($connection, $query);
header("Location: meeting.php?meeting_id=$meeting_id");
?>