} debug("FRONTEND", "All variables:", $fyr_values); $fyr_values['pc'] = canonicalise_postcode($fyr_values['pc']); if (!isset($fyr_values['fyr_extref'])) $fyr_values['fyr_extref'] = fyr_external_referrer(); if (!isset($fyr_values['cocode'])) $fyr_values['cocode'] = get_http_var('cocode'); // Various display and used fields $fyr_postcode = $fyr_values['pc']; if (array_key_exists('who', $fyr_values)) $fyr_who = $fyr_values['who']; if (array_key_exists('type', $fyr_values)) $fyr_type = $fyr_values['type']; $fyr_time = msg_get_time(); msg_check_error($fyr_time); $fyr_date = strftime('%A %e %B %Y', $fyr_time); if (!isset($fyr_who) || ($fyr_who == "all" && !isset($fyr_type))) { header("Location: who?pc=" . urlencode($fyr_postcode)); exit; } # Determine if this is a message to be sent to a group of representatives $fyr_group_msg = false; if ($fyr_who == 'all') $fyr_group_msg = true; // Rate limiter $limit_values = array('postcode' => array($fyr_postcode, "Postcode that's been typed in"));
function check_message_id($msgid) { /* Check that they've come back with a valid message ID. Really we should * be verifying all the data that we've retrieved from the browser with a * hash, but in this case it doesn't matter. */ if (!preg_match("/^[0-9a-f]{20}\$/i", $msgid)) { template_show_error('Sorry, but your browser seems to be transmitting erroneous data to us. Please try again, or <a href="/about-contact">contact us</a>.'); } } # --- $fyr_values = get_all_variables(); set_up_variables($fyr_values); // Various display and used fields, global variables $stash = array(); $stash['time'] = msg_get_time(); msg_check_error($stash['time']); $stash['date'] = strftime('%A %e %B %Y', $stash['time']); if (!isset($fyr_values['who']) || $fyr_values['who'] == "all" && !isset($fyr_values['type'])) { back_to_who(); } # Determine if this is a message to be sent to a group of representatives $stash['group_msg'] = false; if ($fyr_values['who'] == 'all') { $stash['group_msg'] = true; } rate_limit($fyr_values); // For a group mail, get a group_id for transaction with the fax queue now // and generate message ids later if ($stash['group_msg']) { if (array_key_exists('fyr_grpid', $fyr_values)) {