Guest User

Untitled

a guest
Apr 13th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <?php
  2. //just For showing up...
  3. echo " #################\n";
  4. echo " FTP Client\n";
  5. echo " By:Giggs\n";
  6. echo " ################\n";
  7. //teh c0de begins...
  8. echo "Type The Host: ";
  9. $host=trim(fgets(STDIN));
  10. echo "Type The User Name: ";
  11. $user=trim(fgets(STDIN));
  12. echo "Now The Pass: ";
  13. $pass=trim(fgets(STDIN));
  14. echo "checking if the host is alive...\n";
  15. $connect=ftp_connect($host);
  16. if(!$connect){
  17. echo "The Host is Down.\n";
  18. exit;
  19. }
  20. echo "connected,Logging in...\n";
  21. $ftp_log=ftp_login($connect,$user,$pass);
  22. if(!$ftp_log){
  23. echo "Wrong User Name/Password...";
  24. exit;
  25. }
  26. else{
  27. echo "Logged in,Listing Directories...\n";
  28. $contents=ftp_nlist($connect, "/");
  29. foreach ($contents as $entry) {
  30. echo $entry, "\n";
  31. }
  32. }
  33. while(1){
  34. echo "\n What would you Like To Do:\n 1-Upload Files \n 2-Download Files \n 3-Make Dir \n 4-Delete Dir\n 5-change dir ";
  35. $choise=trim(fgets(STDIN));
  36. switch($choise){
  37. case 1:{
  38. echo "Type The File Source: ";
  39. $file=trim(fgets(STDIN));
  40. $fup=fopen($file,'r');
  41. if((ftp_fput($connect, $file, $fup, FTP_ASCII))){
  42. echo "File Uploaded\n";
  43. $contents=ftp_nlist($connect, "/");
  44. foreach ($contents as $entry) {
  45. echo $entry, "\n";
  46. }
  47. }
  48. else{
  49. echo "failed\n";
  50. }
  51. break;
  52. }
  53.  
  54. case 2:{
  55. echo "Type The Drive You want To save To: \n";
  56. $local=trim(fgets(STDIN));
  57. echo "Type The File You want to Download: \n";
  58. $filed=trim(fgets(STDIN));
  59. if(ftp_get($connect,$local,$filed, FTP_BINARY)){
  60. echo "File Downloaded\n";
  61. $contents=ftp_nlist($connect, "/");
  62. foreach ($contents as $entry) {
  63. echo $entry, "\n";
  64. }
  65.  
  66. }
  67. else{
  68. echo "Downloading Failed\n";
  69. }
  70. break;
  71.  
  72. }
  73.  
  74. default:{
  75. echo "nay";
  76. }
  77. }
  78. }
  79. //iknow....i cant even read my own c0de...
  80.  
  81. ?>
Add Comment
Please, Sign In to add comment