diff --git a/actions/set_location.php b/actions/set_location.php index 9b8cd47..a11b566 100644 --- a/actions/set_location.php +++ b/actions/set_location.php @@ -28,15 +28,19 @@ } else { - $street = str_replace(" ", "%20", $_POST['street']); - $city = str_replace(" ", "%20", $_POST['city']); +$address = urlencode($_POST['street'] . ' ' . $_POST['city']); +//$filepath = rtrim($_SESSION['providerURL'], '/') . "/search?addressdetails=1&q=$address&format=json&limit=1"; +$filepath=$_SESSION['providerURL']."/search?addressdetails=1&q=$address&format=json&limit=1"; - $filepath=$_SESSION['providerURL']."/?addressdetails=1&q=".$street."%20".$city."&format=json&limit=1"; - if ( strlen($_SESSION['staticKey']) == 32 ) { + if ( strlen($_SESSION['staticKey']) == 32 ) { $filepath.="&key=".$_SESSION['staticKey']; } - $request = file_get_contents($filepath); + //$request = file_get_contents($filepath); +$request = file_get_contents($filepath); +$request = mb_convert_encoding($request, 'UTF-8', 'auto'); // Ensures proper encoding +$json = json_decode($request, true); + if ( $request == "[]" ) { header("Location: $redirect_url?type=display&page=area&return=error_update_location"); diff --git a/custom_profile_msg.php b/custom_profile_msg.php new file mode 100644 index 0000000..94697d1 --- /dev/null +++ b/custom_profile_msg.php @@ -0,0 +1,19 @@ +set_charset("utf8"); + +// Use prepared statements to prevent SQL injection +$sql2 = "CALL user_curr_end(?)"; +$stmt = $conn2->prepare($sql2); +$stmt->bind_param("i", $_SESSION['id']); +$stmt->execute(); +$result2 = $stmt->get_result(); + +$custom_profile_msg = ""; // Initialize the variable +while ($row2 = $result2->fetch_assoc()) { + $custom_profile_msg = $row2['ends']; +} + +$stmt->close(); // Close the prepared statement +$conn2->close(); // Close the database connection +?> diff --git a/include/db_connect.php b/include/db_connect.php index 42f1b8f..e847d53 100644 --- a/include/db_connect.php +++ b/include/db_connect.php @@ -15,6 +15,8 @@ if ( !isset($conn) ) { $conn = new mysqli($dbhost.":".$dbport, $dbuser, $dbpass, $_SESSION['dbname']); +// Set character set +$conn->set_charset("utf8mb4"); if ($conn->connect_errno) { echo "Failed to connect to MySQL: " . $conn->connect_error; exit(); diff --git a/include/nav.php b/include/nav.php index eda8359..98332f4 100644 --- a/include/nav.php +++ b/include/nav.php @@ -102,13 +102,13 @@ - +