function get_user_info($link, $user, $config)
{
    if ($link && $config[sql_use_user_info_table] == 'true') {
        $user = da_sql_escape_string($user);
        $res = @da_sql_query($link, $config, "SELECT name FROM {$config['sql_user_info_table']} WHERE username = '******';");
        if ($res) {
            $row = @da_sql_fetch_array($res, $config);
            if ($row) {
                return $row[name];
            }
        }
    }
}
         }
         $lastlog_output = $row['acctoutputoctets'];
         if ($lastlog_output) {
             $lastlog_output = bytes2str($lastlog_output);
         } else {
             $lastlog_output = 'not available';
         }
     }
 } else {
     echo "<b>Database query failed: " . da_sql_error($link, $config) . "</b><br>\n";
 }
 if (!$logged_now) {
     $search = @da_sql_query($link, $config, "SELECT " . da_sql_limit(1, 0, $config) . " * FROM {$config['sql_accounting_table']}\n\t\tWHERE username = '******' AND acctsessiontime != '0' " . da_sql_limit(1, 1, $config) . "\n\t\t ORDER BY acctstoptime DESC " . da_sql_limit(1, 2, $config) . " ;");
     if ($search) {
         if (@da_sql_num_rows($search, $config)) {
             $row = @da_sql_fetch_array($search, $config);
             $lastlog_time = $row['acctstarttime'];
             $lastlog_server_ip = $row['nasipaddress'];
             $lastlog_server_port = $row['nasportid'];
             $lastlog_session_time = time2str($row['acctsessiontime']);
             $lastlog_client_ip = $row['framedipaddress'];
             $lastlog_server_name = $lastlog_server_ip != '' ? @gethostbyaddr($lastlog_server_ip) : '-';
             $lastlog_client_name = $lastlog_client_ip != '' ? @gethostbyaddr($lastlog_client_ip) : '-';
             $lastlog_callerid = $row['callingstationid'];
             if ($lastlog_callerid == '') {
                 $lastlog_callerid = 'not available';
             }
             $lastlog_input = $row['acctinputoctets'];
             $lastlog_input = bytes2str($lastlog_input);
             $lastlog_output = $row['acctoutputoctets'];
             $lastlog_output = bytes2str($lastlog_output);
<?php

require 'password.php';
if (is_file("../lib/sql/drivers/{$config['sql_type']}/functions.php")) {
    include_once "../lib/sql/drivers/{$config['sql_type']}/functions.php";
} else {
    echo "<b>Could not include SQL library</b><br>\n";
    exit;
}
if ($action == 'checkpass') {
    $link = @da_sql_pconnect($config);
    if ($link) {
        $res = @da_sql_query($link, $config, "SELECT attribute,value FROM {$config['sql_check_table']} WHERE username = '******'\n\t\t\tAND attribute = '{$config['sql_password_attribute']}';");
        if ($res) {
            $row = @da_sql_fetch_array($res, $config);
            if (is_file("../lib/crypt/{$config['general_encryption_method']}.php")) {
                include "../lib/crypt/{$config['general_encryption_method']}.php";
                $enc_passwd = $row[value];
                $passwd = da_encrypt($passwd, $enc_passwd);
                if ($passwd == $enc_passwd) {
                    $msg = '<font color=blue><b>YES It is that</b></font>';
                } else {
                    $msg = '<font color=red><b>NO It is wrong</b></font>';
                }
            } else {
                echo "<b>Could not open encryption library file</b><br>\n";
            }
        }
    }
    echo "<tr><td colspan=3 align=center>{$msg}</td></tr>\n";
}