GetSpeed 636 B

1234567891011121314151617181920
  1. #!/usr/local/bin/php
  2. <?php
  3. $login=$argv[1];
  4. include('mysql.php');
  5. $query = 'SELECT `speed` FROM `userspeeds` where `login`= "'.$login.'"';
  6. $result = DB_query($query);
  7. while ($line = DB_fetch_array($result)) {
  8. $col_value = $line['speed'];
  9. if ($col_value) {
  10. print ($col_value);
  11. } else {
  12. $tarq='SELECT `speeddown` from `speeds` INNER JOIN (SELECT `Tariff` FROM users WHERE `login`="'.$login.'") AS t_u USING (`Tariff`)';
  13. $tar=DB_query($tarq);
  14. while ($line2 = DB_fetch_array($tar)) {
  15. $speedval = $line2['speeddown'];
  16. print($speedval);
  17. }
  18. }
  19. }
  20. ?>