Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Need Help Optimizing code.

Hey, could anyone help me optimize this code i have written or make it more effective in less code if possible?

Code
@echo off
title Login
:login
cls
echo======
echo  Login
echo======
set /p username="Username: "
set /p password="Password: "
IF %username% EQU thorandodin  IF %password% EQU thorandodin goto :menu
IF %username% NEQ thorandodin  IF %password% NEQ thorandodin goto :error
cls

Obviously i can write an else command to take the user to :error if the password is wrong but any other ideas? thanks in advance. 👍
Password scripts in batch are rather insecure unless the password is hidden in another file, try hiding the password in a png file and check it with a for loop. I would post some code to help out but I am on my phone right now.
(Apr 2, 2015 11:48 PM)Nakamoto. Wrote:  Password scripts in batch are rather insecure unless the password is hidden in another file, try hiding the password in a png file and check it with a for loop. I would post some code to help out but I am on my phone right now.
Thanks, i was think about doing something like this... will try and figure out how to code this i guess...
For god sakes please post your code between code tags. Here it is, and follow Ren's advice.
Code
@ECHO OFF
TITLE LOGIN
:login
cls
echo ======
echo Login
echo ======
SET /P username=Username?:
CLS
SET /P password=Password?:
IF %username% == thorandodin (
GOTO MENU
) ELSE (
GOTO ERROR
)

:ERROR
CLS
ECHO Incorrect Username.
PAUSE >NUL & GOTO login

:MENU
CLS
ECHO Menu
PAUSE >NUL
(Apr 3, 2015 12:38 AM)'Palladium Wrote:  For god sakes please post your code between code tags. Here it is, and follow Ren's advice.
Code
@ECHO OFF
TITLE LOGIN
:login
cls
echo ======
echo Login
echo ======
SET /P username=Username?:
CLS
SET /P password=Password?:
IF %username% == thorandodin (
GOTO MENU
) ELSE (
GOTO ERROR
)

:ERROR
CLS
ECHO Incorrect Username.
PAUSE >NUL & GOTO login

:MENU
CLS
ECHO Menu
PAUSE >NUL
fixed, and thanks for the code 🤝
(Apr 3, 2015 04:02 AM)annikk.exe Wrote:  Here is a cat version:

Code
@echo off
title Login
echo======
echo  Login
echo======
set /p name="Username: "
set /p pass="Password: "
if "%name%" == "thorandodin" if "%password%" == "thorandodin" goto :menu
goto :error

A few notes below.

Spoiler (Click to View)

::purr::

Thanks man! this will help a lot can i contact you about something i could use your help with?
(Apr 3, 2015 04:02 AM)annikk.exe Wrote:  Here is a cat version:

Code
@echo off
title Login
echo======
echo  Login
echo======
set /p name="Username: "
set /p pass="Password: "
if "%name%" == "thorandodin" if "%password%" == "thorandodin" goto :menu
goto :error

A few notes below.

Spoiler (Click to View)

::purr::

Thanks man! this will help a lot can i contact you about something i could use your help with?
Only if it's something deeply personal between us two. :> Otherwise, I'd prefer if we talk about it on the open forum. That way everyone can benefit from our discussions. :>
(Apr 3, 2015 04:19 AM)annikk.exe Wrote:  Only if it's something deeply personal between us two. :> Otherwise, I'd prefer if we talk about it on the open forum. That way everyone can benefit from our discussions. :>

its to do with a personal project that im not sure if it will be publicly released yet, ❓
(Apr 3, 2015 04:28 AM)ThorAndOdin Wrote:  its to do with a personal project that im not sure if it will be publicly released yet, ❓

Even still, the best way to get support is through open channels where you're not restricting it to one person helping. In cases where a project has to be protected, post as much as you can without revealing the whole picture, and then explain exactly what you feel is wrong or you need help with. There's quite a few members here who are more than smart enough to handle just about any problem that can arise, and they'll probably be able to figure out what the project is with some educated guessing, but we're all good enough to keep secrets secret.
(Apr 3, 2015 04:11 AM)ThorAndOdin Wrote:  Thanks man! this will help a lot can i contact you about something i could use your help with?
Yeah sure, no problem :) Just helping out noobs like you (no offence).
(Apr 3, 2015 07:35 PM)'Palladium Wrote:  Yeah sure, no problem :) Just helping out noobs like you (no offence).

I'm not sure he was talking to you (no offense).
(Apr 3, 2015 09:29 PM)WOLGA Wrote:  I'm not sure he was talking to you (no offense).

And I'm not sure he is qualified to call anyone else a noob ( ).
(Apr 3, 2015 09:29 PM)WOLGA Wrote:  I'm not sure he was talking to you (no offense).
He was before because I helped him optimize his code.

(Apr 3, 2015 01:20 AM)ThorAndOdin Wrote:  fixed, and thanks for the code 🤝
(Apr 4, 2015 01:09 AM)'Palladium Wrote:  He was before because I helped him optimize his code.

Oh, is that why he was quoting annikke?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by n00b.caJul 20, 2020 08:27 PM 11 373 Jul 20, 2020 08:27 PM
Last Post: n00b.ca
[Python] by n00b.caApr 4, 2020 12:39 PM 3 205 Apr 4, 2020 12:39 PM
Last Post: n00b.ca
[Java] by Dyst0piaSep 20, 2016 10:24 AM 6 204 Sep 20, 2016 10:24 AM
Last Post: Goodies