Advertisement
Guest User

Untitled

a guest
Aug 15th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. ::Thank you for downloading this program by Nerd's Best Advice (YouTube.com/NerdsBestAdvice)
  2. ::If you have any questions about this program, watch the tutorial online or contact me
  3. ::via email @ videorequest4thenerd@gmail.com
  4.  
  5.  
  6. @echo off
  7. mode con: cols=54 lines=15
  8. title Command Prompt Chat - YouTube.com/NerdsBestAdvice
  9.  
  10. ::--------------------
  11. ::Below is the code to log-in to the program.
  12. ::--------------------
  13. :login
  14. mode con: cols=54 lines=15
  15. cls
  16. echo ---------------------
  17. echo Log-In to Old-School Chat
  18. echo.
  19. echo.
  20. echo.
  21. echo Please type your username and press enter...
  22. echo [To Create an Account, type 1 and Press Enter]
  23. echo.
  24. set /p username=Username:
  25. ::Check if input is 1 to go create an account
  26. if %username% == 1 goto create_account
  27. cls
  28.  
  29. echo ---------------------
  30. echo Log-In to Old-School Chat
  31. echo.
  32. echo.
  33. echo.
  34. echo Please type your password and press enter...
  35. echo.
  36. set /p password=Password:
  37.  
  38. ::Now we have the username and password set. We can now check to see if they are correct.
  39. ::First we need to see if the username exists.
  40.  
  41. if exist "\\CNT-22\Users\17clinen\Desktop\CMDchat\users\%username%.dll" goto password_check
  42. ::If the username does not exist, we will now display
  43. ::Incorrect Credentials Message and return to login
  44. :incorrect_credentials
  45. cls
  46. echo I'm sorry, but those credentials were not found. Please try again.
  47. timeout /t 3 >nul
  48. goto login
  49.  
  50.  
  51. ::If the username did exist, we will now check to see if the password matches.
  52. :password_check
  53.  
  54. ::First, we need to get the password from the file and set it as a variable.
  55. set /p password_file=<"\\CNT-22\Users\17clinen\Desktop\CMDchat\users\%username%.dll"
  56. ::Now, Compare the two
  57. if %password_file%==%password% goto correct_credentials
  58.  
  59. ::if they do not match, go again to incorrect credentials
  60. goto incorrect_credentials
  61.  
  62. :create_account
  63. ::Here we create an account. We need to ask for a username and password.
  64. cls
  65. echo _____________________
  66. echo Create an Account
  67. echo ---------------------
  68. echo.
  69. echo.
  70. echo Please enter your information...
  71. echo.
  72. set /p new_username=Username:
  73.  
  74. ::Clear the screen, re-draw and ask for password
  75. cls
  76. echo _____________________
  77. echo Create an Account
  78. echo ---------------------
  79. echo.
  80. echo.
  81. echo Please enter your information...
  82. echo.
  83. set /p new_password=Password:
  84.  
  85. ::Now that we have the information, we need to
  86. ::write it to the account file. We use the .dll extention
  87. echo %new_password% >"\\CNT-22\Users\17clinen\Desktop\CMDchat\users\%new_username%.dll"
  88.  
  89. ::now we confirm creation and go home
  90. echo.
  91. echo Account Successfully Created!
  92. timeout /t 2 >nul
  93. goto login
  94.  
  95.  
  96.  
  97. :correct_credentials
  98. ::If credentials were correct, start up the message viewer and begin asking for input
  99. start cmd /c "\\CNT-22\Users\17clinen\Desktop\CMDchat\Message_Displayer.cmd"
  100. title Chatting as %username%
  101. echo. >>.\chat.txt
  102. echo %username% has joined the room >>chat.txt
  103. echo. >>.\chat.txt
  104.  
  105.  
  106. :read_messages
  107.  
  108. cls
  109. mode con: cols=54 lines=4
  110. set /p input=Message:
  111. ::if input is nothing, go back
  112. if "%input%"=="" goto read_messages
  113. ::If input is exit, exit the program.
  114.  
  115.  
  116. ::Input message into chat file
  117. echo %username%: %input% >>chat.txt
  118. ::reset the input to prevent spam
  119. set input=
  120. goto read_messages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement