Custom Captive Portal index.php on 2.0.3 - code 99% complete need final 1%
-
hello. this should be an easy $50 for someone who is more familiar with pfsense than us… I hope
this is urgently needed so if you think you can do it please reply. I hope there is enough info here but i will update the post if not
what we are trying to do seems very simple - a custom CP login page in a hotel
No Authentication
index.php with 3 fields for user data - name, email address and "reason for visiting" (with some JS validation) and a Submit button1. write the above data to customportal-data.csv when the user hits the Submit button
2. redirect the user to the hotel's website when the user hits the Submit button
3. email the csv file on a weekly basis to a fixed email addresswhere we have got to... see the index.php below
if we omit [value="Continue"] from the line [however if we omit [value="Continue"] then the redirect does not work
if we include [value="Continue"] then the line is like this [
finally we have tried sendmail and pear for the weekly email to attach csv with no success at all - ran into errors with boththe only options configured in the GUI for CP are
Enable
LAN interface
Idle timeout 60 mins
After authentication redirection URL
No Authenticationindex.php to follow … javascript validation has been removed for testing purposes... hotel name changed to xxxxxxxx
if (isset($_POST) && !empty($_POST)) {
$csv = $_POST;
unset($csv['redirurl'], $csv['accept_x'], $csv['accept_y']);
list($fname, $lname) = explode(' ', $csv['name']);
unset($csv['name']);
array_unshift($csv, $fname, $lname);
$f = fopen('captiveportal-data.csv', 'a');
fputcsv($f, $csv);
fclose($f);
header("Location: http://www.xxxxxxxxxx.com/wifi-landing-page?user=$fname");
exit();
}?>
<title>Hayfield Manor Wi-Fi Login</title>

Wi-Fi Login
<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
Your Name
Your Email Address
Reason for your visit to XXXX?
<select name="reason" id="reason"> <option value="">Please choose from the list below…</option> <option>Leisure Accomodation Guest</option> <option>Corporate Accomodation Guest</option> <option>Conference Attendee</option> <option>Dining at XXXXX</option> <option>Meeting People at XXXXX</option></select>
</form>


-
URL after Submit if [value="Continue"] is omitted
http://192.168.1.1:8000/index.php?redirurl=http%3A%2F%2Fwww.xxxxx.ie%2Fwifi-landing-page%3Fuser%3DZiggy
I realise that [value="Continue"] is mandatory for the redirect but i hope the above helps
-
still editing the redirect URL to hide the hotel name so please ignore the difference between xxxxxxxxxx.com in the php code and xxxxxx.ie in the previous post
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginPrivacy Policy · Cookie Policy