</body>
</html>

<?php 
//PFSense functions to resolve mac
$clientip = $_SERVER['REMOTE_ADDR'];
if (!$clientip) {
    /* not good - bail out */
    log_error("Zone: {$cpzone} - Captive portal could not determine client's IP address.");
    $error_message = "An error occurred.  Please check the system logs for more information.";
    portal_reply_page($redirurl, "error", $errormsg);
    ob_flush();
    return;
}
$macfilter = !isset($cpcfg['nomacfilter']);
$passthrumac = isset($cpcfg['passthrumacadd']);
/* find MAC address for client */
if ($macfilter || $passthrumac) {
    $tmpres = pfSense_ip_to_mac($clientip);
    if (!is_array($tmpres)) {
        /* unable to find MAC address - shouldn't happen! - bail out */
        captiveportal_logportalauth("unauthenticated", "noclientmac", $clientip, "ERROR");
        echo "An error occurred.  Please check the system logs for more information.";
        log_error("Zone: {$cpzone} - Captive portal could not determine client's MAC address.  Disable MAC address filtering in captive portal if you do not need this functionality.");
        ob_flush();
        return;
    }
    $mac = $tmpres['macaddr'];
    unset($tmpres);
}
print "<pre>MAC:" . $mac . "</pre>";
Пример #2
0
                                //check against local user manager
                                $loginok = local_backed($_POST['auth_user'], $_POST['auth_pass']);
                                if ($loginok && isset($cpcfg['localauth_priv'])) {
                                    $loginok = userHasPrivilege(getUserEntry($_POST['auth_user']), "user-services-captiveportal-login");
                                }
                                if ($loginok) {
                                    captiveportal_logportalauth($_POST['auth_user'], $clientmac, $clientip, "LOGIN");
                                    portal_allow($clientip, $clientmac, $_POST['auth_user']);
                                } else {
                                    captiveportal_logportalauth($_POST['auth_user'], $clientmac, $clientip, "FAILURE");
                                    portal_reply_page($redirurl, "error", $errormsg);
                                }
                            } else {
                                portal_reply_page($redirurl, "error", $errormsg);
                            }
                        } else {
                            if ($_POST['accept'] && $clientip && $cpcfg['auth_method'] == "none") {
                                captiveportal_logportalauth("unauthenticated", $clientmac, $clientip, "ACCEPT");
                                portal_allow($clientip, $clientmac, "unauthenticated");
                            } else {
                                /* display captive portal page */
                                portal_reply_page($redirurl, "login", null, $clientmac, $clientip);
                            }
                        }
                    }
                }
            }
        }
    }
}
ob_flush();
Пример #3
0
                }
            }
            if (!$external) {
                $auth_list = radius($_POST['auth_user'], $_POST['auth_pass'], $clientip, $clientmac, 'YENI OTURUM');
                $type = 'error';
                if (!empty($auth_list['url_redirection'])) {
                    $redirurl = $auth_list['url_redirection'];
                    $type = 'redir';
                }
                if ($auth_list['auth_val'] == 1) {
                    captiveportal_logportalauth($_POST['auth_user'], $clientmac, $clientip, 'HATA', $auth_list['error']);
                    log_error('HOTSPOT servisi duzgun calismiyor. FreeRADIUS sunucusunu kontrol edin.');
                    exit;
                } else {
                    if ($auth_list['auth_val'] == 3) {
                        if ($auth_list['reply_message']) {
                            $error_message = $hotspot_errors['session'][$lang];
                        } else {
                            $error_message = $hotspot_errors['login'][$lang];
                        }
                        captiveportal_logportalauth($_POST['auth_user'], $clientmac, $clientip, 'BASARISIZ', $auth_list['reply_message']);
                        portal_reply_page($redirurl, 'error', $error_message);
                    }
                }
            }
        }
    } else {
        portal_reply_page($redirurl, 'login', null, $clientmac, $clientip);
    }
}
exit;