Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- title CPanel
- :initialize
- set chc=""
- set userl=""
- set passl=""
- :firstPage
- cls
- echo.
- echo.
- echo Welcome to CPanel!
- echo Choose an option to get started
- echo.
- echo.
- echo [1]. Sign Up
- echo [2]. Sign In
- echo [3]. Exit CPanel
- echo.
- set /p chc="Enter a choice: "
- if %chc% equ 1 goto :register
- if %chc% equ 2 goto :login
- if %chc% equ 3 goto :bye
- pause
- goto firstPage
- :register
- cls
- color 07
- set usern=""
- set passw=""
- set confirmp=""
- echo.
- echo.
- echo Register Account
- echo Enter your personal information below
- echo.
- set /p usern="User Name: "
- set /p passw="Password: "
- set /p confirmp="Confirm Password: "
- echo.
- if "%usern%"=="" (
- echo "ERROR: Please enter a valid username"
- pause
- goto :register
- )
- if not "%passw%"=="%confirmp%" (
- echo "Passwords do not match"
- pause > nul
- goto :register
- )
- if not exist user.txt echo first user created > user.txt
- if not exist users\ md users
- echo %passw% > users\%usern%.txt
- echo.
- echo User has been created successfully!
- pause
- goto firstPage
- :login
- cls
- set userl=""
- set passl=""
- echo.
- echo.
- echo Login Area
- if not exist user.txt (
- echo.
- choice /c YN /m "There are no users registered. Do you want to create one now? "
- if errorlevel 2 goto firstPage
- if errorlevel 1 goto register
- )
- echo Enter your credentials below
- echo.
- set /p userl="User Name: "
- set /p passl="Password: "
- if not exist "users\%userl%.txt" goto loginerr
- for /f "delims=" %%x in (users\%userl%.txt) do set fpass=%%x
- if not %fpass%==%passl% goto loginerr
- goto main
- :loginerr
- echo.
- echo Invalid username/password
- pause > nul
- goto :login
- :bye
- cls
- echo Bye!
- pause > nul
- exit
- :main
- cls
- set chc=""
- echo.
- echo.
- echo CPanel Main Page
- echo Choose an option to get started
- echo.
- echo.
- echo [1]. Account Details
- echo [2]. View Registered Users
- echo [3]. Number Guessing Game
- echo [4]. Open a Website
- echo [5]. Ping a Server
- echo [6]. Open a Folder
- echo [7]. Logout
- echo.
- set /p chc="Enter your choice: "
- if %chc% equ 1 goto accdetails
- if %chc% equ 2 goto regusers
- if %chc% equ 3 goto guessgame
- if %chc% equ 4 goto opensite
- if %chc% equ 5 goto pngServer
- if %chc% equ 6 goto openFolder
- if %chc% equ 7 goto bye
- goto main
- rem INDIVIDUAL FUNCTIONS START HERE
- rem ************************************ ACCOUNT DETAILS ***************************************
- :accdetails
- cls
- echo CPanel
- echo.
- echo This is your account details:
- echo.
- echo Username: %userl%
- echo Password: %passl%
- echo.
- echo What do you want to do with this?
- echo [1] Change Username
- echo [2] Change Password
- echo [3] Go Back to Main
- echo.
- set chc=""
- set /p chc="Enter your choice: "
- if %chc% equ 1 goto accuser
- if %chc% equ 2 goto accpass
- if %chc% equ 3 (goto main) else (goto accdetails)
- :accuser
- echo.
- set nuser=""
- set /p nuser="Enter new user name: "
- ren "users\%userl%.txt" %nuser%.txt
- set userl=%nuser%
- echo.
- echo Username successfully changed
- pause > nul
- goto accdetails
- :accpass
- echo.
- set npass=""
- set ncpass=""
- set /p npass="Enter new password: "
- set /p ncpass="Confirm password: "
- if "%npass%"=="%ncpass%" (
- echo %npass% > "users\%userl%.txt"
- echo.
- echo Password has been changed.
- set passl=%npass%
- pause > nul
- goto accdetails
- ) else (
- echo Passwords do not match
- echo.
- goto accpass
- )
- rem ****************************** REGISTERED USERS LIST **********************************
- :regusers
- cls
- echo CPanel
- echo.
- echo These are the users currently registered:
- echo.
- for %%a in (users\*) do echo %%~na
- echo.
- pause > nul
- goto main
- rem ************************** NUMBER GUESSING GAME ***************************************
- :guessgame
- cls
- set chc=
- set score=0
- set maxrange=10
- set round=0
- title Guessing Game
- echo Let's Play Number Guessing Game
- echo.
- echo Rules:
- echo 1. Guess a number between a given range.
- echo 2. Points add up for every correct guess. Range will increase as the game goes on.
- echo 3. You have only 3 chances to guess the correct number. If you failed to guess, the game will end.
- echo.
- set /p chc="Shall we begin? [Y/N]: "
- if /i %chc%==Y goto newround
- goto main
- :newround
- set mistakes=0
- set /a round=%round%+1
- set inp=
- set /a ans=(%random%*%maxrange%/32768)+1
- goto gamestart
- :gamestart
- cls
- if %round% LEQ 10 (
- echo Easy Round
- goto startgame
- )
- if %round% LEQ 25 (
- echo Moderate Round
- set maxrange=20
- goto startgame
- )
- if %round% GTR 25 (
- echo Hard Round
- set maxrange=30
- goto startgame
- )
- :startgame
- echo Current Score: %score%
- echo Mistakes: %mistakes%
- echo.
- echo I'm between 1 to %maxrange%.
- set guess=
- set /p guess="What number am I? "
- if %guess% equ %ans% (
- set /a score=%score%+1 > nul
- echo Great! You got it right!
- pause > nul
- goto newround
- ) else (
- set /a mistakes=%mistakes%+1 > nul
- if %mistakes% GEQ 3 goto gameover
- if %guess% LSS %ans% (
- echo That's wrong. It is GREATER than %guess%...
- pause > nul
- goto gamestart
- ) else (
- echo That's wrong. It is LESSER than %guess%...
- pause > null
- goto gamestart
- )
- )
- :gameover
- cls
- echo GAME OVER!!!
- echo You scored %score%.
- set chc=
- set /p chc="Do you want to play again? [Y/N]: "
- if %chc%==Y goto guessgame
- if %chc%==N goto main
- goto gameover
- rem ************************************ OPEN WEBSITE ***********************************************
- :opensite
- cls
- title Open Website
- echo Choose a website you want to visit:
- echo [1]. Facebook
- echo [2]. Google
- echo [3]. Youtube
- echo [4]. Twitter
- echo [5]. Instagram
- echo [6]. Windows
- echo [7]. GitHub
- echo [8]. Apple
- echo [9]. MSN
- echo [10]. Yahoo!
- echo [11]. Other
- echo.
- set chc=
- set /p chc="Select a number: "
- if %chc% equ 1 start www.facebook.com
- if %chc% equ 2 start www.google.com
- if %chc% equ 3 start www.youtube.com
- if %chc% equ 4 start www.twitter.com
- if %chc% equ 5 start www.instagram.com
- if %chc% equ 6 start www.windows.com
- if %chc% equ 7 start www.github.com
- if %chc% equ 8 start www.apple.com
- if %chc% equ 9 start www.msn.com
- if %chc% equ 10 start www.yahoo.com
- if %chc% equ 11 goto customSite
- goto endSite
- :customSite
- echo.
- set site=
- set /p site="Enter a website to visit: "
- start %site%
- :endSite
- goto main
- rem *********************************** PING A SERVER ***********************************************
- :pngServer
- cls
- title Ping a Server
- echo Choose a website you want to ping:
- echo [1]. Facebook
- echo [2]. Google
- echo [3]. Youtube
- echo [4]. Twitter
- echo [5]. Instagram
- echo [6]. Windows
- echo [7]. GitHub
- echo [8]. Apple
- echo [9]. MSN
- echo [10]. Yahoo!
- echo [11]. Other
- echo.
- set chc=
- set /p chc="Select a number: "
- if %chc% equ 1 ping www.facebook.com
- if %chc% equ 2 ping www.google.com
- if %chc% equ 3 ping www.youtube.com
- if %chc% equ 4 ping www.twitter.com
- if %chc% equ 5 ping www.instagram.com
- if %chc% equ 6 ping www.windows.com
- if %chc% equ 7 ping www.github.com
- if %chc% equ 8 ping www.apple.com
- if %chc% equ 9 ping www.msn.com
- if %chc% equ 10 ping www.yahoo.com
- if %chc% equ 11 goto customPing
- goto endPingf
- :customPing
- echo.
- set site=
- set /p site="Enter a website to ping: "
- ping %site%
- :endPing
- echo.
- echo Press any key to go back to menu...
- pause > nul
- goto main
- :openFolder
- rem *********************************** OPEN FOLDER ***********************************************
- cls
- title Open a FOLDER
- echo Opening a folder will allow you to create folders and files, delete folders and files, and rename folders and files.
- echo.
- set pat=
- set /p pat="Enter complete folder path: "
- rem if not exist "%pat%" goto notFound
- echo.
- :flist
- cls
- echo Here are the list of folders and files inside %pat%.
- echo.
- if not exist "%pat%" goto notfound
- cd "%pat%"
- dir /B /O:G
- echo.
- echo What do you want to do with these?
- echo [a] Create a New Folder
- echo [b] Rename a File/Folder
- echo [c] Delete a File
- echo [d] Delete a Folder
- echo [e] Go Back to Menu
- set chc=
- set /p chc="Enter choice: "
- if %chc%==a goto createFol
- if %chc%==b goto renameF
- if %chc%==c goto deleteFile
- if %chc%==d goto deleteFol
- if %chc%==e goto main
- goto flist
- :createFol
- echo.
- set str=
- set /p str="Enter folder name: "
- md %str%
- echo.
- echo "%str%" folder created.
- pause > nul
- goto :flist
- :renameF
- echo.
- set str=
- set /p str="Enter folder name or file name (with extensions): "
- if not exist "%str%" goto notfound2
- set nstr=
- set /p nstr="Enter new folder name or new filename (with extension): "
- ren "%str%" "%nstr%"
- echo.
- echo %str% is successfully renamed to %nstr%.
- pause>nul
- goto flist
- echo.
- :deleteFile
- echo.
- set str=
- set /p str="Enter file to delete (with extension): "
- if not exist "%str%" (
- echo.
- echo File %str% not found.
- goto refr) else (
- delete "%str%"
- echo.
- echo File %str% deleted.
- pause>nul
- goto flist)
- :deleteFol
- echo.
- set str=
- set /p str="Enter folder name to delete: "
- if not exist "%str%" (
- echo.
- echo Folder %str% not found.
- goto refr) else (
- echo.
- rd "%str%" || goto refr
- echo Folder %str% deleted.
- pause>nul
- goto flist)
- :notfound
- echo.
- echo This folder does not exist.
- pause>nul
- goto openFolder
- :notfound2
- echo.
- echo This folder does not exist.
- goto refr
- :refr
- echo Returning to folder list...
- pause>nul
- goto flist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement