Пример #1
0
function rad_add_ip($remoteIp, $expiredate, $configValues)
{
    //convert $remoteIp to mac and use in rad_add_mac
    //$password for rad_add_mac here will be hardcoded for now
    $password = "******";
    $mac_addr = returnMacAddress($remoteIp);
    writelog("rad_add_ip ip = " . $remoteIp . " mac_addr = " . $mac_addr . "\n");
    writelog("expiredate = " . $expiredate . "\n");
    if ($mac_addr) {
        rad_add_mac($mac_addr, $password, $expiredate, $configValues);
    } else {
        writelog("no mac returned from ip no mac account created\n");
    }
}
Пример #2
0
function logsession()
{
    // this will log session data to /var/www/session.log file, later will make it put in mysql database table
    // $code will return 1 if we have success in password check and account check
    // $code will return 0 if no user with this name exists
    // $code will return -1 for bad password but a user does exist
    // $code will return -2 for account expired
    // $_SESSION['firstname'] = "scotty";// users first name
    // $_SESSION['expire']= date account will expire in human readable format
    // $_SESSION['promotion']=1 for first time one week promotion,  0 if not
    // $_SESSION['code']= 1;//  see $code above for details,  1 login ok 0 bad user -1 bad password ...
    // $_SESSION['loggedin'] = 0 on login failure,   1 for success
    // $_SESSION['customers_email'] = "*****@*****.**";
    // $_SESSION['customers_password'] = password of cusstomer
    // $_SESSION['login_date_time'] = $login_date_time;
    // $_SESSION['login_timestamp'] = time();
    // $_SESSION['customer_ip'] = address customer logged in as
    // $_SESSION['totdatin'] = total byte count of data_in used on wire from start to end of recording
    // $_SESSION['totdatout']= total byte count of data_out, used on wire from start to end of recording
    $datetime = date("F j, Y, g:i a");
    $email = $_SESSION['customers_email'];
    $password = $_SESSION['customers_password'];
    $firstname = $_SESSION['firstname'];
    $code = $_SESSION['code'];
    #$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
    $ip = $_SESSION['customer_ip'];
    $mac = returnMacAddress($ip);
    //readipac($ip,"1M","0s");
    //addipac($ip);
    // $outString = $firstname . " : ".$email." : ".$password." : ".$code . " : ".$ip. " : ". $datetime .":". $_SESSION['totdatout']."\n";
    $outString = $firstname . " : " . $email . " : " . $password . " : " . $code . " : " . $ip . " : " . $mac . " : " . $datetime . " \n";
    $f = fopen("./private/session.log", "a");
    fwrite($f, $outString);
    fclose($f);
    return;
}
Пример #3
0
<?php

include 'returnMacAdress.php';
$GLOBALS['REMOTE_ADDR'] = "192.168.2.3";
$mac = returnMacAddress("192.168.2.3");
echo "results = " . $mac;
echo "\n<br> ";
// should see: results = 00:1D:E0:A6:62:C7
Пример #4
0
 if ($rauth->isAccept()) {
     $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');
Пример #5
0
$info = array();
$retinfo = $xmlrpc->do_getsessioninfo($vserver_id, $ip);
if (is_array($retinfo)) {
    // Send stop accounting to Radius
    $ip =& $retinfo["ip"];
    $username =& $retinfo["username"];
    $session_id =& $retinfo["session_id"];
    $session_start =& $retinfo["session_start"];
    $mac_address =& $retinfo["mac_address"];
    $isinfo = true;
} else {
    $valid = false;
}
if (!empty($_POST['do_logout'])) {
    if ($isinfo) {
        $result = $xmlrpc->do_stopsession($vserver_id, $ip, returnMacAddress(), RADIUS_TERM_USER_REQUEST);
        if ($result === true) {
            $valid = false;
            $message = get_message('OK_USER_LOGOUT');
            $isstopacct = true;
        } else {
            $valid = false;
            $message = get_message('ERR_LOGOUT_FAILED');
            $show_info = true;
        }
    }
    if ($isstopacct) {
        // Send account stop to radius
        $racct = new rahu_radius_acct($username);
        $racct->host = $config["RADIUS_HOST"];
        $racct->port = $config["RADIUS_ACCT_PORT"];
Пример #6
0
              <TR>
                <TD><div align="center"><font color='#000000' size='1' face='Verdana, Arial, Helvetica, sans-serif'>Sistema PBX basato sul progetto <a href="http://www.asterisk.org" onFocus="this.blur()" target="_blank">Asterisk</a><b> v<?php 
echo $ver_asterisk["Asterisk"];
?>
</b> - (C) <a href="http://www.spherait.it" onFocus="this.blur()" target="_blank">SpheraIT</a> - VMP: <b><?php 
echo $ver_voiper["version"];
?>
 <?php 
echo $ver_voiper["data"];
?>
</b></font></div></TD>
              </TR>
              <TR>
                <TD><div align="center"><font color='#000000' size='1' face='Verdana, Arial, Helvetica, sans-serif'>VCTI: <b><?php 
echo $ver_vcti["version"];
?>
 <?php 
echo $ver_vcti["data"];
?>
</b> - Serial: <b><?php 
echo $serial;
?>
</b> - MacAddress ETH0: <b><?php 
echo returnMacAddress();
?>
</b></font></div></TD>
              </TR>