|
|
@ -0,0 +1,95 @@ |
|
|
|
<?php |
|
|
|
// Copyright (C) 2021 Aayla
|
|
|
|
//
|
|
|
|
// This file is part of website.
|
|
|
|
//
|
|
|
|
// website is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// website is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with website. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
// Array of state abbreviations
|
|
|
|
$states = [ |
|
|
|
"Alabama" => "AL", |
|
|
|
"Alaska" => "AK", |
|
|
|
"Arizona" => "AZ", |
|
|
|
"Arkansas" => "AR", |
|
|
|
"California" => "CA", |
|
|
|
"Colorado" => "CO", |
|
|
|
"Connecticut" => "CT", |
|
|
|
"Delaware" => "DE", |
|
|
|
"Florida" => "FL", |
|
|
|
"Georgia" => "GA", |
|
|
|
"Hawaii" => "HI", |
|
|
|
"Idaho" => "ID", |
|
|
|
"Illinois" => "IL", |
|
|
|
"Indiana" => "IN", |
|
|
|
"Iowa" => "IA", |
|
|
|
"Kansas" => "KS", |
|
|
|
"Kentucky" => "KY", |
|
|
|
"Louisiana" => "LA", |
|
|
|
"Maine" => "ME", |
|
|
|
"Maryland" => "MD", |
|
|
|
"Massachusetts" => "MA", |
|
|
|
"Michigan" => "MI", |
|
|
|
"Minnesota" => "MN", |
|
|
|
"Mississippi" => "MS", |
|
|
|
"Missouri" => "MO", |
|
|
|
"Montana" => "MT", |
|
|
|
"Nebraska" => "NE", |
|
|
|
"Nevada" => "NV", |
|
|
|
"New Hampshire" => "NH", |
|
|
|
"New Jersey" => "NJ", |
|
|
|
"New Mexico" => "NM", |
|
|
|
"New York" => "NY", |
|
|
|
"North Carolina" => "NC", |
|
|
|
"North Dakota" => "ND", |
|
|
|
"Ohio" => "OH", |
|
|
|
"Oklahoma" => "OK", |
|
|
|
"Oregon" => "OR", |
|
|
|
"Pennsylvania" => "PA", |
|
|
|
"Rhode Island" => "RI", |
|
|
|
"South Carolina" => "SC", |
|
|
|
"South Dakota" => "SD", |
|
|
|
"Tennessee" => "TN", |
|
|
|
"Texas" => "TX", |
|
|
|
"Utah" => "UT", |
|
|
|
"Vermont" => "VT", |
|
|
|
"Virginia" => "VA", |
|
|
|
"Washington" => "WA", |
|
|
|
"West Virginia" => "WV", |
|
|
|
"Wisconsin" => "WI", |
|
|
|
"Wyoming" => "WY", |
|
|
|
"District of Columbia" => "DC", |
|
|
|
"Guam" => "GU", |
|
|
|
"Marhsall Islands" => "MH", |
|
|
|
"Puerto Rico" => "PR", |
|
|
|
"Virgin Islands" => "VI" |
|
|
|
]; |
|
|
|
|
|
|
|
// Ensure required parameters are present
|
|
|
|
if (!isset($_GET["state"])) { |
|
|
|
http_response_code(404); |
|
|
|
die(); |
|
|
|
} |
|
|
|
if (!array_key_exists($_GET["state"], $states)) { |
|
|
|
http_response_code(404); |
|
|
|
die(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$chapters = json_decode(file_get_contents("../../../chapters/chapters.json"), true); |
|
|
|
|
|
|
|
$state = $states[$_GET["state"]]; |
|
|
|
header('Content-Type: application/json; charset=utf-8'); |
|
|
|
echo json_encode($chapters[$state]); |
|
|
|
|
|
|
|
?>
|