With some help from these two posts I've manged a solution:
http://forum.pfsense.org/index.php/topic,5796.0.html (auto posting the form)
http://forum.pfsense.org/index.php/topic,5368.0.html (passing action & redirurl to custom .php page)
I'd still appreciate any corrections or suggestions. Thanks!
index.html:
Redirecting . . .
p.php:```
$message = ""; // set default error message to empty
$portal_redirurl = $_GET['portal_redirurl']; // get portal_redirurl from URL
$portal_action = $_GET['portal_action']; // get portal_action from URL
// if form submitted, validate
if ($_POST['submitted'] == 1)
{
$email = $_POST['email']; // get submitted e-mail address
$pattern = '/.@...*/'; // used to "validate" submitted e-mail address
// if valid, process and auto-submit portal form
if (preg_match($pattern, $_POST['email']) > 0)
{
// use e-mail here . . .
// build auto-submitting for to allow user thru captive portal
echo "
";
exit; // prevents latter code from displaying
}
// if email is invalid, set error message to be displayed
$message = "E-mail address must be valid!
";
}
?>
ACCEPTABLE USE POLICY
<iframe src="captiveportal-aup.html" style="width:90%;height:65%;margin-bottom:20px;"></iframe>
$message";?>
<form method="post" action="<?echo $_SERVER['PHP_SELF'] . " ?portal_action=" . $portal_action . " &portal_redirurl=" . $portal_redirurl;?>">
Please enter your e-mail address:
By clicking 'Continue' you agree to the Acceptable Use Policy.
</form>