Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <title>Login</title>
- <HTA:APPLICATION
- APPLICATIONNAME="Login"
- BORDER="dialog"
- BORDERSTYLE="normal"
- CAPTION="no"
- CONTEXTMENU="no"
- ICON="icon.ico"
- INNERBORDER="yes"
- MAXIMIZEBUTTON="no"
- MINIMIZEBUTTON="no"
- NAVIGABLE="yes"
- SCROLL="no"
- SHOWINTASKBAR="yes"
- SINGLEINSTANCE="yes"
- SYSMENU="yes"
- VERSION="1.1"
- WINDOWSTATE="normal"
- />
- </head>
- <script language = "VBScript">
- window.resizeto 350,200
- Public strUsername, strPassword
- screenWidth=Document.ParentWindow.Screen.AvailWidth
- screenHeight=Document.parentWindow.Screen.AvailHeight
- posLeft=(ScreenWidth-350)/2
- posTop=(screenHeight-200)/2
- window.moveTo posLeft,posTop
- Sub strStart
- strUsername=Username.value
- strPassword=Password.value
- UserInfo.style.visibility="hidden"
- UserNotFound.style.visibility="hidden"
- PassNotFound.style.visibility="hidden"
- UserPassEmpty.style.visibility="hidden"
- if strUsername="" then
- UserNotFound.style.visibility="visible"
- PassNotFound.style.visibility="hidden"
- UserPassEmpty.style.visibility="hidden"
- End if
- if strPassword="" then
- UserNotFound.style.visibility="hidden"
- PassNotFound.style.visibility="visible"
- UserPassEmpty.style.visibility="hidden"
- End if
- if strUsername="" and strPassword="" then
- UserNotFound.style.visibility="hidden"
- PassNotFound.style.visibility="hidden"
- UserPassEmpty.style.visibility="visible"
- end if
- if strUsername<>"" and strPassword<>"" then
- idTimer=setTimeout("strEnter",50,"VBScript")
- End if
- End Sub
- Sub strEnter
- UserNotFound.style.visibility="hidden"
- PassNotFound.style.visibility="hidden"
- UserPassEmpty.style.visibility="hidden"
- UserInfo.style.visibility="visible"
- Set wss = CreateObject("Wscript.shell")
- Set fso = CreateObject("Scripting.FileSystemObject")
- strUsername = Username.Value
- strPassword = Password.value
- strFile = "Login.txt"
- FileArray = fso.OpenTextFile(strFile).ReadAll
- LinebyLine = Split(FileArray, vbCrLF)
- For Each Line in LinebyLine
- 'Have this sub read the files line by line.
- strCheck = Split(Line,"/")
- strUN = strCheck(0)
- strPW = strCheck(1)
- if strUN = strUsername then
- exit for
- end if
- Next
- if strUN=strUsername and strPW=strPassword then
- UserInfo.style.visibility="hidden"
- msgbox "Credentials found. Welcome " & strUsername
- Set wss = CreateObject("WScript.Shell")
- wss.Run "C:\Users\alenp\Desktop\Projects\opentaskbars.hta"
- self.close()
- End if
- if strUN=strUsername and strPW<>strPassword then
- UserInfo.InnerHTML= "Incorrect password"
- End if
- if strUN<>strUsername then
- UserInfo.InnerHTML= "Username not found"
- End if
- End Sub
- Sub enterpassword
- if PasswordArea.value="rose" then
- msgbox"Logged in!"
- Dim wss
- Set wss = CreateObject("WScript.Shell")
- wss.Run "choice.bat"
- else
- msgbox"Invalid password!"
- end if
- end sub
- </script>
- <SCRIPT LANGUAGE="JavaScript">
- function document.onkeydown() {
- var alt=window.event.altKey;
- if (event.keyCode==116 || event.keyCode==27 || alt && event.keyCode==115) {
- event.keyCode=0;
- event.cancelBubble=true;
- return false;
- }
- }
- </SCRIPT>
- <body style="background-color:white; color:black;"style="border: 3pt ridge black">
- <span style="position: relative; color:black;
- top:-3px";
- >
- Username:
- </span>
- <input type="Text" name="Username" size="36" style="background-color:white; color:black; border: 2pt ridge black"> <br> <br>
- <span style="position: relative; color:black;
- top:-3px">
- Password:
- </span>
- <input type="password" name="Password" size="36" style="background-color:white; color:black; border: 2pt ridge black"> <br>
- <br> <input type="button" value="L O G I N" onclick="strStart" style="background-color:white; color:black; border: 2pt ridge black">
- <span id="UserNotFound"; style="position: absolute; top:80; left:83; visibility:hidden">
- Username not found.
- </span>
- <span id="PassNotFound"; style="position: absolute; top:80; left:83; visibility:hidden">
- Incorrect password.
- </span>
- <span id="UserPassEmpty"; style="position: absolute; top:80; left:83; visibility:hidden">
- Enter your credentials
- </span>
- <span id="UserInfo"; style="position: absolute; top:80; left:83">
- </span>
- <p>
- <input type="button" value="Close" name="run_button" onClick="self.close() " style="background-color:white; color:black; border: 2pt ridge black">
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement