#!/usr/local/bin/php
<?php
$login=$argv[1];
include('mysql.php');
$ipq='SELECT `IP` FROM `users` WHERE `login`="'.$login.'"';
$ip=DB_query($ipq);
           while ($line2 = DB_fetch_array($ip, MYSQL_ASSOC)) {
                foreach($line2 as $ipval) {
                                $nasq='select `nas`.`nastype` from `nethosts` join  `nas` on (`nas`.`netid` = `nethosts`.`netid`) where `nethosts`.`ip` = "'.$ipval.'"';
                                $nas=DB_query($nasq);
                                   while ($line3 = DB_fetch_array($nas, MYSQL_ASSOC)) {
                                   foreach($line3 as $nasip) {
                                   print($nasip);
                                   }
                                  }
                           }
                        }

?>
