summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2017-04-19 10:21:52 -0400
committerCarson Fleming <cflems@cflems.net>2017-04-19 10:21:52 -0400
commit1b23808772e1158603b93a24c5df241c46fae756 (patch)
tree21fa27495e26bf507f75f40e876b424bc8febd92
parent832f3c245e66c0a78b2d5732355b381f91acb9ef (diff)
downloadbulletin-1b23808772e1158603b93a24c5df241c46fae756.tar.gz
Changed response to account activation
-rw-r--r--activate.php4
-rw-r--r--dash/dash_functions.php12
-rw-r--r--dash/profile.php3
3 files changed, 17 insertions, 2 deletions
diff --git a/activate.php b/activate.php
index 52175d6..14e45f5 100644
--- a/activate.php
+++ b/activate.php
@@ -6,7 +6,7 @@ $db = new bdb() or fatal($db-error);
$uid = intval($_GET['uid']);
$key = $_GET['key'];
$db->query('UPDATE users SET active = 1 WHERE id = '.$uid.' AND session = \''.bulletin_hash($key).'\'') or fatal($db->error);
-if ($db->affected_rows < 1) fatal('Invalid information provided.');
+if ($db->affected_rows < 1) fatal('Your information is formatted incorrectly.');
setcookie($b_config['c_name'], $uid.';'.$key, 0, $b_config['c_path'], $b_config['c_dom'], $b_config['c_sec'], $b_config['c_http']);
-fatal('Your account is now active, you will be taken to the user dashboard.', $b_config['base_url'].'dash/');
+fatal('Your account is now active, you will now be taken to set up your profile.', $b_config['base_url'].'dash/profile.php');
?>
diff --git a/dash/dash_functions.php b/dash/dash_functions.php
index 6551e15..2f6c794 100644
--- a/dash/dash_functions.php
+++ b/dash/dash_functions.php
@@ -169,4 +169,16 @@ function hire_trigger ($rid) {
);
bulletin_mail($rinfo['email'], 'You\'ve Been Hired for "'.$rinfo['title'].'"', tpl($options, 'hire_eml.tpl'));
}
+function geolocate ($addr, $zip) {
+ $apireturn = json_decode(file_get_contents('https://maps.google.com/maps/api/geocode/json?sensor=false&address='.urlencode($addr.' '.$zip)), true);
+ if ($apireturn['status'] != 'OK') return false;
+ $latlong = $apireturn['results']['geometry']['location'];
+ return array($latlong['lat'], $latlong['lng']);
+}
+function geodistance ($pt1, $pt2) {
+
+ $a = pow(sin(deg2rad($pt2[0]-$pt1[0])), 2)+cos(deg2rad($pt1[0]))*cos($pt2[0])*pow(sin(deg2rad($pt2[1]-$pt1[1])/2), 2);
+ $b = 2*atan2(sqrt($a), sqrt(1-$a));
+ return $b*3960;
+}
?>
diff --git a/dash/profile.php b/dash/profile.php
index d8e4af3..d730dc9 100644
--- a/dash/profile.php
+++ b/dash/profile.php
@@ -74,6 +74,9 @@ $result->free();
<?php
} else if (!empty($_POST['chprofile'])) {
$bio = empty($_POST['bio']) ? 'NULL' : '\''.$db->escape_string($_POST['bio']).'\'';
+ if (!empty($_POST['address'])) {
+ if (!geolocate($_POST['address'], $b_user['zipcode'])) dash_fatal('The address provided is not valid.');
+ }
$addr = empty($_POST['address']) ? 'NULL' : '\''.$db->escape_string($_POST['address']).'\'';
$patterns = array(
'email' => '/^.+@.+\..+$/',