Vous êtes sur la page 1sur 13

@echo of

title Miniek's Program

color 1b

:home

cls

echo Welcome to Miniek's Program!

echo.

echo 1) Login

echo 2) Create account

echo 3) Exit

echo.

set /p home=Choose your number:

if %home% == 1 goto login

if %home% == 2 goto createaccount

if %home% == 3 exit

echo.

echo Sorry, but that's not a valid number.

echo Press any key to continue.

pause>nul

goto home

:createaccount

cls

echo Create your account.

echo.
set /p newusername=New username:

if Exist "C:\Miniek's_Program\Users\%newusername%_account\username.
%newusername%.mp" goto create_error >nul

echo.

set /p newpassword=New password:

echo.

if not exist "C:\Miniek's Program\Users\%newusername%_account" mkdir


C:\Miniek's_Program\Users\%newusername%_account

if not exist "C:\Miniek's Program\Users\backupaccounts\%newusername


%_backupaccount" mkdir C:\Miniek's_Program\Users\backupaccounts\
%newusername%_backupaccount

echo Username:%newusername% >"C:\Miniek's_Program\Users\backupaccounts\


%newusername%_backupaccount\backupusername.%newusername%.mp"

echo Password:%newpassword% >"C:\Miniek's_Program\Users\backupaccounts\


%newusername%_backupaccount\backuppassword.%newpassword%.mp"

echo %newusername%'s Diary>nul


>"C:\Miniek's_Program\Users\backupaccounts\%newusername
%_account\backupdiary.%newusername%.mp"

echo Password:%newpassword% >"C:\Miniek's_Program\Users\%newusername


%_account\password.%newpassword%.mp"

echo Username:%newusername% >"C:\Miniek's_Program\Users\%newusername


%_account\username.%newusername%.mp"

echo Password:%newpassword% >"C:\Miniek's_Program\Users\%newusername


%_account\password.%newpassword%.mp"

echo %newusername%'s Diary>nul >"C:\Miniek's_Program\Users\%newusername


%_account\diary.%newusername%.mp"

cls

echo Account successfully created!

echo Press any key to continue.

pause>nul

goto home
:login

cls

echo Log in to your account.

echo.

set /p username=Username:

echo.

set /p password=Password:

if NOT Exist "C:\Miniek's_Program\Users\%username%_account\password.


%password%.mp" goto login_error

if NOT Exist "C:\Miniek's_Program\Users\%username%_account\username.


%username%.mp" goto login_error

if Exist "C:\Miniek's_Program\Users\%username%_account\role.admin.mp" goto


adminhome

goto homeloggedin

:login_error

echo.

echo No such account found or you entered

echo your password/username incorrectly.

ping localhost -n 3 >nul

goto login

:create_error

echo This username already exists. Please use a diferent one.

ping localhost -n 3 >nul

goto createaccount
:homeloggedin

title Miniek's Program

cls

echo Welcome to Miniek's Program!

echo Logged in as: %username%

echo.

echo 1) Chat

echo 2) Logout

echo 3) Settings

echo 4) Diary

echo 4) Exit

echo.

set /p homeloggedin=Choose your number:

if %homeloggedin% == 1 goto chat

if %homeloggedin% == 2 goto logout

if %homeloggedin% == 3 goto settings

if %homeloggedin% == 4 goto diary

if %homeloggedin% == 5 exit

echo.

echo Sorry, but that's not a valid number.

echo Press any key to continue.

pause>nul

goto homeloggedin

:adminhome

title Miniek's Program: Admin Mode

cls
echo Welcome to Miniek's Program!

echo Logged in as: %username% (Admin)

echo.

echo 1) Chat

echo 2) Logout

echo 3) Admin settings

echo 4) Diary

echo 5) Exit

echo.

set /p homeloggedin=Choose your number:

if %homeloggedin% == 1 goto chat

if %homeloggedin% == 2 goto logoutadmin

if %homeloggedin% == 3 goto adminsettings

if %homeloggedin% == 4 goto diary

if %homeloggedin% == 5 exit

echo.

echo Sorry, but that's not a valid number.

echo Press any key to continue.

pause>nul

goto home

:logout

echo.

echo Are you sure you want to

echo log out user %username%?

echo.

set /p logoutyn=(y/n):
if %logoutyn% == n goto homeloggedin

if %logoutyn% == y goto home

:logoutadmin

echo.

echo Are you sure you want to

echo log out user %username%?

echo.

set /p logoutyn=(y/n):

if %logoutyn% == n goto adminhome

if %logoutyn% == y goto home

:settings

cls

echo 1) Change password

echo 2) Delete account

echo 3) Go back

echo.

set /p settings=Choose your number:

if %settings% == 1 goto changepassword

if %settings% == 2 goto deleteaccount

if %settings% == 3 goto homeloggedin

:adminsettings

cls

echo IMPORTANT NOTE: Never, NEVER abuse your admin powers.

echo.
echo 1) Delete account of chosen user (don't work)

echo 2) Give/remove the admin role of someone

echo 3) Clear the chat

echo 4) Program files

echo 5) Go back

echo.

set /p adminsettings=Choose your number:

if %adminsettings% == 1 goto deleteaccountchosenuser

if %adminsettings% == 2 goto giveadminchosenuser

if %adminsettings% == 3 goto clearchatroom

if %adminsettings% == 4 goto files

if %adminsettings% == 5 goto adminhome

:giveadminchosenuser

cls

echo 1) Give the Admin role to a chosen user

echo 2) Remove the Admin role from a chosen user

set /p adminrolechoice=Choice:

if %adminrolechoice% == 2 goto removeadminchosenuser

cls

echo Please enter the username of the person you

echo want to give Admin to.

set /p giveadmin=Username:

ping localhost -n 3 >nul

echo Role:Admin >"C:\Miniek's_Program\Users\%giveadmin


%_account\role.admin.mp"

echo Successfully given the Admin role to user %giveadmin%!

echo Press any key to continue...

pause >nul
goto adminhome

:removeadminchosenuser

cls

echo Please enter the username of the person you

echo want to remove Admin from.

set /p removeadmin=Username:

cls

ping localhost -n 3 >nul

del "C:\Miniek's_Program\Users\%removeadmin%_account\role.admin.mp"

echo Successfully removed Admin from user %removeadmin%!

echo Press any key to continue...

pause >nul

goto adminhome

:files

explorer "C:\Miniek's_Program"

ping localhost -n 3 >nul

goto adminsettings

:clearchatroom

echo.

echo Searching for file chatroom.mp ...

ping localhost -n 3 >nul

if Exist "C:\Miniek's_Program\Chat\Program_Files\chatroom.mp" goto


movingchatfile

:movingchatfile

echo.
echo File chatroom.mp found.

echo Please enter today's date:

set /p year=Year:

set /p month=Month:

set /p day=Day:

echo Name the archive file:

set /p archivename=Name:

move /-y "C:\Miniek's_Program\Chat\Program_Files\chatroom.mp"


"C:\Miniek's_Program\Chat\Archives"

ping localhost -n 3 >nul

rename "C:\Miniek's_Program\Chat\Archives\chatroom.mp" "chatroom_archive_


%year%_%month%_%day%_%archivename%.mp"

ping localhost -n 3 >nul

echo. >>"C:\Miniek's_Program\Chat\Program_Files\chatroom.mp"

echo File chatroom.mp successfully cleared ...

echo The archive file can be found under:

echo C:\Miniek's_Program\Chat\Archives\ as "chatroom_archive_%year%_%month


%_%day%_%archivename%.mp"

ping localhost -n 3 >nul

goto adminhome

:deleteaccountchosenuser

echo.

echo WARNING: You are about to delete someone's account.

echo Do you want to proceed?

echo.

set /p deleteaccountchosenuser=(y/n):

if %deleteaccountchosenuser% == y goto deleteaccountchosenuseryes

if %deleteaccountchosenuser% == n goto adminhome

echo.
echo Sorry, but that's an invalid choice.

echo Press any key to continue.

pause>nul

goto adminhome

:deleteaccountchosenuseryes

echo.

echo What user's account do you want to delete?

echo.

set /p deleteaccountchosenuseryes=Username:

if NOT Exist "C:\Miniek's_Program\Users\%deleteaccountchosenuseryes


%_account" goto deleteaccount_error

echo.

echo Enter your password to make sure you want to delete this profile.

echo.

set /p deleteaccountchosenuseryesyourpw=Your password:

if Exist "C:\Miniek's_Program\Users\%username%_account\password.
%deleteaccountchosenuseryesyourpw%.mp" del "C:\Miniek's_Program\Users\
%deleteaccountchosenuseryes%_account"

echo.

echo Sorry, but that's not right.

echo Press any key to go back.

pause>nul

goto adminhome

:deleteaccount_error

echo.

echo Error: There is no such user.

echo Press any key to continue.

pause>nul
goto adminhome

:changepassword

cls

echo Are you sure you want to change

echo your password? (y/n)

set /p changepassword=

if %changepassword% == n goto homeloggedin

if %changepassword% == y goto changepasswordyes

echo.

echo Sorry, but that's an invalid choice.

echo Press any key to continue.

pause>nul

goto adminhome

:changepasswordyes

echo.

set /p changedpassword=Enter your new password:

del "C:\Miniek's_Program\Users\%username%_account\password.%password
%.mp"

echo Password:%changedpassword% >"C:\Miniek's_Program\Users\%username


%_account\password.%changedpassword%.mp"

echo.

echo Password successfully changed!

ping localhost -n 3 >nul

goto homeloggedin

:chat

title Miniek's Program: Chat Typer


start C:\Miniek's_Program\Chat\Program_Files\chatviewer.bat

:chat_return

cls

echo Welcome to the chat!

echo.

set /p text=Enter your message:

echo %date% %time% - %username%: %text%


>>"C:\Miniek's_Program\Chat\Program_Files\chatroom.mp"

goto chat_return

:chat_returnhome

if Exist "C:\Miniek's_Program\Users\%username%_account\role.admin.mp" goto


adminhome

if NOT Exist "C:\Miniek's_Program\Users\%username%_account\role.admin.mp"


goto homeloggedin

:diary

start C:\Miniek's_Program\Diary\Program_Files\diaryviewer.bat

:diary_return

cls

echo Welcome to your own, personal diary.

echo Type something and it'll be pushed over to a file that

echo you will be able to open at any time.

echo.

set /p diarytext=Write your diary here:

echo %diarytext% >>"C:\Miniek's_Program\Users\%username%_account\diary.


%username%.mp

Vous aimerez peut-être aussi