1
0

auth_export.php 1.6 KB

123456789101112131415161718192021222324252627
  1. <?php
  2. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/auth.php");
  3. require_once($_SERVER['DOCUMENT_ROOT'] . "/inc/languages/" . HTML_LANG . ".php");
  4. if (!defined("CONFIG")) die("Not defined");
  5. if (isset($_POST["ExportAuth"])) {
  6. print "login;ip;mac;comment;dns name;last_found;connected\n";
  7. if (isset($_POST["a_selected"]) and $_POST["a_selected"] * 1) {
  8. //export selected only
  9. $auth_id = $_POST["fid"];
  10. foreach ($auth_id as $key => $val) {
  11. if ($val) {
  12. $sSQL = "SELECT User_list.login, User_auth.ip, User_auth.mac, User_auth.comments, User_auth.dns_name, User_auth.last_found FROM User_auth, User_list WHERE User_auth.user_id = User_list.id AND User_auth.id = " . $val;
  13. $record = get_record_sql($db_link, $sSQL);
  14. print $record['login'] . ';' . $record['ip'] . ';' . $record['mac'] . ';' . $record['comments'] . ';' . $record['dns_name'] . ';' . $record['last_found'] . ';' . get_connection($db_link, $val)."\n";
  15. }
  16. }
  17. } else {
  18. //export all
  19. $sSQL = "SELECT User_list.login, User_auth.id, User_User_auth.ip, User_auth.mac, User_auth.comments, User_auth.dns_name, User_auth.last_found FROM User_auth, User_list WHERE User_auth.user_id = User_list.id AND User_auth.deleted = 0 ORDER BY User_auth.ip_int";
  20. $auth_table = mysqli_query($db_link, $sSQL);
  21. while ($record = mysqli_fetch_array($auth_table)) {
  22. print $record['login'] . ';' . $record['ip'] . ';' . $record['mac'] . ';' . $record['comments'] . ';' . $record['dns_name'] . ';' . $record['last_found'] .';' . get_connection($db_link, $record['id']). "\n";
  23. }
  24. }
  25. }