session_start(); //uncomment to display errors, comment next line which suppresses error notices // error_reporting( E_ALL ); error_reporting(0); //error_reporting( E_All & ~E_NOTICE); // ini_set('display_errors',1); // ini_set('display_startup_errors',1); // Strictly validate district input and reject anything outside Senate districts 01-67 $dist = $_GET['district'] ?? '01'; if (!preg_match('/^(0[1-9]|[1-5][0-9]|6[0-7])$/', $dist)) { http_response_code(400); exit('Invalid district.'); } //next districts $distval = intval($dist); if ($distval < 9) { $ndist1 = $dist + 1; $ndist = "0" . $ndist1; } elseif ($dist > 8 && $dist <= 66) $ndist = $distval + 1; else $ndist = "01"; //previous districts if ($distval > 1 && $distval <= 10) { $pdist1 = $dist - 1; $pdist = "0" . $pdist1; } elseif ($distval > 9 && $distval <=67) $pdist = $dist - 1; else $pdist = "67"; $allowedSections = ['dp02', 'dp03', 'dp04', 'dp05']; $sect = strtolower($_GET['section'] ?? 'dp05'); if (!in_array($sect, $allowedSections, true)) { http_response_code(400); exit('Invalid section.'); } //set active tab and title if ($sect == 'dp05') { $title = "Demographic"; $dp05 = 'nav-link active text-joint font-weight-bold'; }else { $dp05 = 'nav-link'; } if ($sect == 'dp02') { $title = "Social"; $dp02 = 'nav-link active text-joint font-weight-bold'; }else { $dp02 = 'nav-link'; } if ($sect == 'dp03') { $title = "Economic"; $dp03 = 'nav-link active text-joint font-weight-bold'; }else { $dp03 = 'nav-link'; } if ($sect == 'dp04') { $title = "Housing"; $dp04 = 'nav-link active text-joint font-weight-bold'; }else { $dp04 = 'nav-link'; } include_once('/home/web/gis/config/config.php'); $pageTitle = 'MN Senate Profiles'; $announcement = file_get_contents('/web/config/announcement.php'); include_once($header); print "
"; //title print "| Subject | District | Percent |
|---|---|---|
| $line1 | $num2 | $row3[$i] |
| $line1 | $num2 | $row3[$i] |