Advertisement
Ang377ou

cmdloginsystem

Feb 23rd, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.20 KB | None | 0 0
  1. @echo off
  2.  
  3. title CPanel
  4. :initialize
  5. set chc=""
  6. set userl=""
  7. set passl=""
  8.  
  9.  
  10. :firstPage
  11. cls
  12. echo.
  13. echo.
  14. echo Welcome to CPanel!
  15. echo Choose an option to get started
  16. echo.
  17. echo.
  18. echo [1]. Sign Up
  19. echo [2]. Sign In
  20. echo [3]. Exit CPanel
  21. echo.
  22. set /p chc="Enter a choice: "
  23. if %chc% equ 1 goto :register
  24. if %chc% equ 2 goto :login
  25. if %chc% equ 3 goto :bye
  26. pause
  27. goto firstPage
  28.  
  29. :register
  30. cls
  31. color 07
  32. set usern=""
  33. set passw=""
  34. set confirmp=""
  35. echo.
  36. echo.
  37. echo Register Account
  38. echo Enter your personal information below
  39. echo.
  40. set /p usern="User Name: "
  41. set /p passw="Password: "
  42. set /p confirmp="Confirm Password: "
  43. echo.
  44. if "%usern%"=="" (
  45. echo "ERROR: Please enter a valid username"
  46. pause
  47. goto :register
  48. )
  49. if not "%passw%"=="%confirmp%" (
  50. echo "Passwords do not match"
  51. pause > nul
  52. goto :register
  53. )
  54.  
  55. if not exist user.txt echo first user created > user.txt
  56. if not exist users\ md users
  57. echo %passw% > users\%usern%.txt
  58. echo.
  59. echo User has been created successfully!
  60. pause
  61. goto firstPage
  62.  
  63. :login
  64. cls
  65. set userl=""
  66. set passl=""
  67. echo.
  68. echo.
  69. echo Login Area
  70. if not exist user.txt (
  71. echo.
  72. choice /c YN /m "There are no users registered. Do you want to create one now? "
  73. if errorlevel 2 goto firstPage
  74. if errorlevel 1 goto register
  75. )
  76. echo Enter your credentials below
  77. echo.
  78. set /p userl="User Name: "
  79. set /p passl="Password: "
  80.  
  81. if not exist "users\%userl%.txt" goto loginerr
  82. for /f "delims=" %%x in (users\%userl%.txt) do set fpass=%%x
  83. if not %fpass%==%passl% goto loginerr
  84. goto main
  85.  
  86. :loginerr
  87. echo.
  88. echo Invalid username/password
  89. pause > nul
  90. goto :login
  91.  
  92. :bye
  93. cls
  94. echo Bye!
  95. pause > nul
  96. exit
  97.  
  98. :main
  99. cls
  100. set chc=""
  101. echo.
  102. echo.
  103. echo CPanel Main Page
  104. echo Choose an option to get started
  105. echo.
  106. echo.
  107. echo [1]. Account Details
  108. echo [2]. View Registered Users
  109. echo [3]. Number Guessing Game
  110. echo [4]. Open a Website
  111. echo [5]. Ping a Server
  112. echo [6]. Open a Folder
  113. echo [7]. Logout
  114. echo.
  115. set /p chc="Enter your choice: "
  116. if %chc% equ 1 goto accdetails
  117. if %chc% equ 2 goto regusers
  118. if %chc% equ 3 goto guessgame
  119. if %chc% equ 4 goto opensite
  120. if %chc% equ 5 goto pngServer
  121. if %chc% equ 6 goto openFolder
  122. if %chc% equ 7 goto bye
  123. goto main
  124.  
  125. rem INDIVIDUAL FUNCTIONS START HERE
  126. rem ************************************ ACCOUNT DETAILS ***************************************
  127. :accdetails
  128. cls
  129. echo CPanel
  130. echo.
  131. echo This is your account details:
  132. echo.
  133. echo Username: %userl%
  134. echo Password: %passl%
  135. echo.
  136. echo What do you want to do with this?
  137. echo [1] Change Username
  138. echo [2] Change Password
  139. echo [3] Go Back to Main
  140. echo.
  141. set chc=""
  142. set /p chc="Enter your choice: "
  143. if %chc% equ 1 goto accuser
  144. if %chc% equ 2 goto accpass
  145. if %chc% equ 3 (goto main) else (goto accdetails)
  146.  
  147. :accuser
  148. echo.
  149. set nuser=""
  150. set /p nuser="Enter new user name: "
  151. ren "users\%userl%.txt" %nuser%.txt
  152. set userl=%nuser%
  153. echo.
  154. echo Username successfully changed
  155. pause > nul
  156. goto accdetails
  157.  
  158. :accpass
  159. echo.
  160. set npass=""
  161. set ncpass=""
  162. set /p npass="Enter new password: "
  163. set /p ncpass="Confirm password: "
  164. if "%npass%"=="%ncpass%" (
  165. echo %npass% > "users\%userl%.txt"
  166. echo.
  167. echo Password has been changed.
  168. set passl=%npass%
  169. pause > nul
  170. goto accdetails
  171. ) else (
  172. echo Passwords do not match
  173. echo.
  174. goto accpass
  175. )
  176.  
  177. rem ****************************** REGISTERED USERS LIST **********************************
  178. :regusers
  179. cls
  180. echo CPanel
  181. echo.
  182. echo These are the users currently registered:
  183. echo.
  184. for %%a in (users\*) do echo %%~na
  185. echo.
  186. pause > nul
  187. goto main
  188.  
  189. rem ************************** NUMBER GUESSING GAME ***************************************
  190. :guessgame
  191. cls
  192. set chc=
  193. set score=0
  194. set maxrange=10
  195. set round=0
  196. title Guessing Game
  197. echo Let's Play Number Guessing Game
  198. echo.
  199. echo Rules:
  200. echo 1. Guess a number between a given range.
  201. echo 2. Points add up for every correct guess. Range will increase as the game goes on.
  202. echo 3. You have only 3 chances to guess the correct number. If you failed to guess, the game will end.
  203. echo.
  204. set /p chc="Shall we begin? [Y/N]: "
  205. if /i %chc%==Y goto newround
  206. goto main
  207.  
  208. :newround
  209. set mistakes=0
  210. set /a round=%round%+1
  211. set inp=
  212. set /a ans=(%random%*%maxrange%/32768)+1
  213. goto gamestart
  214.  
  215. :gamestart
  216. cls
  217. if %round% LEQ 10 (
  218. echo Easy Round
  219. goto startgame
  220. )
  221. if %round% LEQ 25 (
  222. echo Moderate Round
  223. set maxrange=20
  224. goto startgame
  225. )
  226. if %round% GTR 25 (
  227. echo Hard Round
  228. set maxrange=30
  229. goto startgame
  230. )
  231.  
  232. :startgame
  233. echo Current Score: %score%
  234. echo Mistakes: %mistakes%
  235. echo.
  236. echo I'm between 1 to %maxrange%.
  237. set guess=
  238. set /p guess="What number am I? "
  239. if %guess% equ %ans% (
  240. set /a score=%score%+1 > nul
  241. echo Great! You got it right!
  242. pause > nul
  243. goto newround
  244. ) else (
  245. set /a mistakes=%mistakes%+1 > nul
  246. if %mistakes% GEQ 3 goto gameover
  247.  
  248. if %guess% LSS %ans% (
  249. echo That's wrong. It is GREATER than %guess%...
  250. pause > nul
  251. goto gamestart
  252. ) else (
  253. echo That's wrong. It is LESSER than %guess%...
  254. pause > null
  255. goto gamestart
  256. )
  257. )
  258.  
  259. :gameover
  260. cls
  261. echo GAME OVER!!!
  262. echo You scored %score%.
  263. set chc=
  264. set /p chc="Do you want to play again? [Y/N]: "
  265. if %chc%==Y goto guessgame
  266. if %chc%==N goto main
  267. goto gameover
  268.  
  269. rem ************************************ OPEN WEBSITE ***********************************************
  270. :opensite
  271. cls
  272. title Open Website
  273. echo Choose a website you want to visit:
  274. echo [1]. Facebook
  275. echo [2]. Google
  276. echo [3]. Youtube
  277. echo [4]. Twitter
  278. echo [5]. Instagram
  279. echo [6]. Windows
  280. echo [7]. GitHub
  281. echo [8]. Apple
  282. echo [9]. MSN
  283. echo [10]. Yahoo!
  284. echo [11]. Other
  285. echo.
  286. set chc=
  287. set /p chc="Select a number: "
  288. if %chc% equ 1 start www.facebook.com
  289. if %chc% equ 2 start www.google.com
  290. if %chc% equ 3 start www.youtube.com
  291. if %chc% equ 4 start www.twitter.com
  292. if %chc% equ 5 start www.instagram.com
  293. if %chc% equ 6 start www.windows.com
  294. if %chc% equ 7 start www.github.com
  295. if %chc% equ 8 start www.apple.com
  296. if %chc% equ 9 start www.msn.com
  297. if %chc% equ 10 start www.yahoo.com
  298. if %chc% equ 11 goto customSite
  299. goto endSite
  300.  
  301. :customSite
  302. echo.
  303. set site=
  304. set /p site="Enter a website to visit: "
  305. start %site%
  306.  
  307. :endSite
  308. goto main
  309. rem *********************************** PING A SERVER ***********************************************
  310. :pngServer
  311. cls
  312. title Ping a Server
  313. echo Choose a website you want to ping:
  314. echo [1]. Facebook
  315. echo [2]. Google
  316. echo [3]. Youtube
  317. echo [4]. Twitter
  318. echo [5]. Instagram
  319. echo [6]. Windows
  320. echo [7]. GitHub
  321. echo [8]. Apple
  322. echo [9]. MSN
  323. echo [10]. Yahoo!
  324. echo [11]. Other
  325. echo.
  326. set chc=
  327. set /p chc="Select a number: "
  328. if %chc% equ 1 ping www.facebook.com
  329. if %chc% equ 2 ping www.google.com
  330. if %chc% equ 3 ping www.youtube.com
  331. if %chc% equ 4 ping www.twitter.com
  332. if %chc% equ 5 ping www.instagram.com
  333. if %chc% equ 6 ping www.windows.com
  334. if %chc% equ 7 ping www.github.com
  335. if %chc% equ 8 ping www.apple.com
  336. if %chc% equ 9 ping www.msn.com
  337. if %chc% equ 10 ping www.yahoo.com
  338. if %chc% equ 11 goto customPing
  339. goto endPingf
  340.  
  341. :customPing
  342. echo.
  343. set site=
  344. set /p site="Enter a website to ping: "
  345. ping %site%
  346.  
  347. :endPing
  348. echo.
  349. echo Press any key to go back to menu...
  350. pause > nul
  351. goto main
  352.  
  353. :openFolder
  354. rem *********************************** OPEN FOLDER ***********************************************
  355. cls
  356. title Open a FOLDER
  357. echo Opening a folder will allow you to create folders and files, delete folders and files, and rename folders and files.
  358. echo.
  359. set pat=
  360. set /p pat="Enter complete folder path: "
  361. rem if not exist "%pat%" goto notFound
  362. echo.
  363.  
  364. :flist
  365. cls
  366. echo Here are the list of folders and files inside %pat%.
  367. echo.
  368. if not exist "%pat%" goto notfound
  369. cd "%pat%"
  370. dir /B /O:G
  371. echo.
  372. echo What do you want to do with these?
  373. echo [a] Create a New Folder
  374. echo [b] Rename a File/Folder
  375. echo [c] Delete a File
  376. echo [d] Delete a Folder
  377. echo [e] Go Back to Menu
  378. set chc=
  379. set /p chc="Enter choice: "
  380. if %chc%==a goto createFol
  381. if %chc%==b goto renameF
  382. if %chc%==c goto deleteFile
  383. if %chc%==d goto deleteFol
  384. if %chc%==e goto main
  385. goto flist
  386.  
  387. :createFol
  388. echo.
  389. set str=
  390. set /p str="Enter folder name: "
  391. md %str%
  392. echo.
  393. echo "%str%" folder created.
  394. pause > nul
  395. goto :flist
  396.  
  397. :renameF
  398. echo.
  399. set str=
  400. set /p str="Enter folder name or file name (with extensions): "
  401. if not exist "%str%" goto notfound2
  402. set nstr=
  403. set /p nstr="Enter new folder name or new filename (with extension): "
  404. ren "%str%" "%nstr%"
  405. echo.
  406. echo %str% is successfully renamed to %nstr%.
  407. pause>nul
  408. goto flist
  409. echo.
  410.  
  411. :deleteFile
  412. echo.
  413. set str=
  414. set /p str="Enter file to delete (with extension): "
  415. if not exist "%str%" (
  416. echo.
  417. echo File %str% not found.
  418. goto refr) else (
  419. delete "%str%"
  420. echo.
  421. echo File %str% deleted.
  422. pause>nul
  423. goto flist)
  424.  
  425. :deleteFol
  426. echo.
  427. set str=
  428. set /p str="Enter folder name to delete: "
  429. if not exist "%str%" (
  430. echo.
  431. echo Folder %str% not found.
  432. goto refr) else (
  433. echo.
  434. rd "%str%" || goto refr
  435. echo Folder %str% deleted.
  436. pause>nul
  437. goto flist)
  438.  
  439. :notfound
  440. echo.
  441. echo This folder does not exist.
  442. pause>nul
  443. goto openFolder
  444.  
  445. :notfound2
  446. echo.
  447. echo This folder does not exist.
  448. goto refr
  449.  
  450. :refr
  451. echo Returning to folder list...
  452. pause>nul
  453. goto flist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement