forked from abenzer/represent-map
-
Notifications
You must be signed in to change notification settings - Fork 3
/
add.php
60 lines (42 loc) · 1.61 KB
/
add.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
include_once "header.php";
// This is used to submit new markers for review.
// Markers won't appear on the map until they are approved.
$owner_name = parseInput($_POST['owner_name']);
$owner_email = parseInput($_POST['owner_email']);
$title = parseInput($_POST['title']);
$type = parseInput($_POST['type']);
$address = parseInput($_POST['address']);
$uri = parseInput($_POST['uri']);
$description = parseInput($_POST['description']);
// validate fields
if(empty($title) || empty($type) || empty($address) || empty($uri) || empty($description) || empty($owner_name) || empty($owner_email)) {
echo "All fields are required - please try again.";
exit;
} else {
// if startup genome mode enabled, post new data to API
if($sg_enabled) {
try {
@$r = $http->doPost("/organization", $_POST);
$response = json_decode($r, 1);
if ($response['response'] == 'success') {
include_once("startupgenome_get.php");
echo "success";
exit;
}
} catch (Exception $e) {
echo "<pre>";
print_r($e);
}
// normal mode enabled, save new data to local db
} else {
// insert into db, wait for approval
$insert = mysql_query("INSERT INTO places (approved, title, type, address, uri, description, owner_name, owner_email) VALUES (null, '$title', '$type', '$address', '$uri', '$description', '$owner_name', '$owner_email')") or die(mysql_error());
// geocode new submission
$hide_geocode_output = true;
include "geocode.php";
echo "success";
exit;
}
}
?>