showAccount.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. $countNotNull = 0;
  3. $user_details = "";
  4. $success = 0;
  5. $errorCount = 0;
  6. if (isset($errors)) {
  7. unset($errors);
  8. }
  9. if (!isset($connection)) {
  10. include "config.php";
  11. }
  12. include_once 'db_functions.php';
  13. if (isset($_GET['username'])) {
  14. $ftp_account = $_GET['username'];
  15. }
  16. if (!isset($connection)) {
  17. die("Problem setting up connection!");
  18. } else
  19. if (isset($ftp_account)) {
  20. $SQL = "SELECT ftpusername, homedir FROM ftpaccounts WHERE ftpusername = '$ftp_account'";
  21. $Result = execSQL($SQL, $connection);
  22. if ($Result !== FALSE) {
  23. $count = countSQLResult($Result);
  24. if ($count == 1) {
  25. if ($row = getSQLRow($Result)) {
  26. // Only show custom entries... do not allow to modify EHCP accounts.
  27. if (!empty($row['homedir'])) {
  28. $countNotNull++;
  29. $username = $row['ftpusername'];
  30. $dir = $row['homedir'];
  31. $user_details.= "Username" . " : " . $username . "\n";
  32. $user_details.= "Directory" . " : " . $dir . "\n";
  33. }
  34. }
  35. if ($countNotNull == 0) {
  36. $errorCount++;
  37. $errors[] = "There are no custom FTP accounts yet in the EHCP database!";
  38. }
  39. } else {
  40. $errorCount++;
  41. $errors[] = "No FTP accounts exist with the given username of $ftp_account";
  42. }
  43. } else {
  44. $errorCount++;
  45. $errors[] = getSQLError($connection);
  46. $success = 0;
  47. }
  48. // Log errors
  49. if ($errorCount > 0) {
  50. addToLog($errors);
  51. }
  52. }
  53. // Return the user list
  54. echo $user_details;
  55. ?>