Advertisement
DemonFiendz

Core.bat

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