-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-and-enter-address.php
46 lines (36 loc) · 1.48 KB
/
check-and-enter-address.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
<?php
defined( 'ABSPATH' ) || exit;
namespace IronPawsLLC;
require_once('setIncPath.php');
require_once('globals.php');
require_once(NON_WEB_PHP . 'mush-db.php');
$numberError = FALSE;
if(!session_id()) session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$address= test_input($_POST["address"]);
if (empty($address)) {
die ($address . "Is not a valid address.");
}
$po_box = test_input($_POST["po-box"]);
$city = test_input($_POST["city"]);
if (empty($city)) {
die ($city . "Is not a valid city.");
}
$state = test_input($_POST["stateIsoCode"]);
$postal = test_input($_POST["postal"]);
$district = test_input($_POST["district"]);
$neighborhood = test_input($_POST["neighborhood"]);
$suplemental = test_input($_POST["supplemental"]);
$department = test_input($_POST["department"]);
$building_name = test_input($_POST["building-name"]);
$type = test_input($_POST["addr-type"]);
$execSql = "CALL NewAddress ('{$address}', '{$po_box}', '{$city}', '{$state}', '{$district}', '{$neighborhood}', '{$postal}', '{$_SESSION[COUNTRY]}', '{$suplemental}', '{$department}', '{$building_name}', '{$type}')";
echo "sql to execute: " . $execSql . "<BR>";
try {
Mush_DB::connect()->exec($execSql);
}
catch(\PDOException $e) {
die ( "The database returned an error while registering an address. The details are: " . $e->getMessage());
}
}
?>