예제 #1
0
파일: login.php 프로젝트: udomsak/rahunas
 $message = get_message('OK_USER_AUTHORIZED');
 $forward = true;
 $racct = new rahu_radius_acct($_POST['user']);
 $racct->host = $config["RADIUS_HOST"];
 $racct->port = $config["RADIUS_ACCT_PORT"];
 $racct->secret = $config["RADIUS_SECRET"];
 $racct->nas_identifier = $config["NAS_IDENTIFIER"];
 $racct->nas_ip_address = $config["NAS_IP_ADDRESS"];
 $racct->nas_port = $config["NAS_PORT"];
 $racct->framed_ip_address = $_SERVER['REMOTE_ADDR'];
 $racct->calling_station_id = returnMacAddress();
 $racct->gen_session_id();
 $serviceclass_attrib = defined('SERVICECLASS_ATTRIBUTE') ? SERVICECLASS_ATTRIBUTE : "WISPr-Billing-Class-Of-Service";
 try {
     $prepareData = array("IP" => $ip, "Username" => $_POST['user'], "SessionID" => $racct->session_id, "MAC" => returnMacAddress(), "Session-Timeout" => $rauth->attributes['session_timeout'], "Bandwidth-Max-Down" => $rauth->attributes['WISPr-Bandwidth-Max-Down'], "Bandwidth-Max-Up" => $rauth->attributes['WISPr-Bandwidth-Max-Up'], "Class-Of-Service" => $rauth->attributes[$serviceclass_attrib]);
     $result = $xmlrpc->do_startsession($vserver_id, $prepareData);
     if (strstr($result, "Client already login")) {
         $message = get_message('ERR_ALREADY_LOGIN');
         $forward = false;
     } else {
         if (strstr($result, "Greeting")) {
             $split = explode("Mapping ", $result);
             $called_station_id = $split[1];
             if (!empty($called_station_id)) {
                 $racct->called_station_id = $called_station_id;
             }
             $racct->acctStart();
         } else {
             if (strstr($result, "Invalid IP Address")) {
                 $message = get_message('ERR_INVALID_IP');
                 $forward = false;