From 35e707bfeb8d82d713acb49d78b08062374269f6 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Wed, 25 Oct 2017 15:02:52 -0400 Subject: Restyle address format and change background image --- dash/profile.php | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'dash/profile.php') diff --git a/dash/profile.php b/dash/profile.php index fa3ee8e..a59109c 100644 --- a/dash/profile.php +++ b/dash/profile.php @@ -39,7 +39,7 @@ $phonelink = '+'.preg_replace('/[^0-9]/', '', $user['phone']);

Phone:


Address

-

No address specified.' : htmlentities($user['address']));?>

+

Zipcode:


Chat

@@ -74,10 +74,24 @@ $result->free(); escape_string($_POST['bio']).'\''; - if (!empty($_POST['address'])) { - if (!geolocate($_POST['address'], $b_user['zipcode'])) dash_fatal('The address provided is not valid.'); + // Address validation + $addr = array_map(trim, array( + $_POST['address1'], + $_POST['address2'], + $_POST['addrcity'], + $_POST['addrstate'], + )); + $addrfull = array_reduce($addr, function ($carry, $item) { + return $carry || !empty($item); + }, false); + if ($addrfull) { + if (validate_address($addr)) + $addr_q = '\''.$db->escape_string(address_join($addr)).'\''; + else + dash_fatal('The address you supplied appears to be incomplete or invalid.'); + } else { + $addr_q = 'NULL'; } - $addr = empty($_POST['address']) ? 'NULL' : '\''.$db->escape_string($_POST['address']).'\''; $patterns = array( 'email' => '/^.+@.+\..+$/', 'zip' => '/^\d{5}([-\s]\d{4})?$/', @@ -106,7 +120,7 @@ $result->free(); @unlink($b_user['picture']); @imagedestroy($img); } - $db->query('UPDATE users SET email = \''.$db->escape_string($_POST['email']).'\', zipcode = \''.$db->escape_string($_POST['zip']).'\', phone = \''.$db->escape_string($_POST['phone']).'\', address = '.$addr.', bio = '.$bio.$usepropic.$deactivate.' WHERE id = '.$b_user['id']) or dash_fatal($db->error); + $db->query('UPDATE users SET email = \''.$db->escape_string($_POST['email']).'\', zipcode = \''.$db->escape_string($_POST['zip']).'\', phone = \''.$db->escape_string($_POST['phone']).'\', address = '.$addr_q.', bio = '.$bio.$usepropic.$deactivate.' WHERE id = '.$b_user['id']) or dash_fatal($db->error); dash_fatal('Your profile has been updated. If you have changed your email, you will need to verify it before returning to Bulletin.', $b_config['base_url'].'dash/profile.php'); } else { ?> @@ -142,8 +156,16 @@ $result->free();

Basic Information

-

-

+ +

+

+

+

+ + +

-- cgit v1.2.3