Chronus88
15 Apr 2007, 02:51 AM
(I'm new at this....)
I'm trying to make a very basic login system for a FTP server I own. I am trying to keep it very simple by having two main pages
Page 1: User inputs userID and password and submits
Page 2: If user...
Has valid login/pass they may see the webpage & continue normally
Or
Has an invalid pass they will be told so and will be denied from continuing to continue normally
I first tried to do this is with Javascripting but found little success, I then moved to VBscript because I am very familiar with visual basic. This is the VBscript I have, it does not work in its entirety.
<html>
<HEAD>
<TITLE>Validation Required</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!-- Instruct non-IE browsers to skip over VBScript modules.
Option Explicit
Dim isvalid
Sub cmdSubmit_OnClick
' Check to see if the user entered anything.
If (Len(document.frmLogin.txtuid.value) = 0) Then
MsgBox "You must enter your Username before submitting."
Exit Sub
End If
If (Len(document.frmLogin.txtpwd.value) = 0) Then
MsgBox "You must enter your Password before submitting."
Exit Sub
End If
If (document.frmLogin.txtuid.value = "username") Then
If (document.frmLogin.txtpwd.value = "password") Then
MsgBox "Login Successful."
isvalid="true"
window.open( "website" )
End if
Else
MsgBox "Invalid"
End if
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Validation required</H1>
<FORM NAME="frmLogin">
<TABLE>
<TR>
<TD>Username:</TD>
<TD><INPUT TYPE="Text" NAME="txtuid" SIZE="14"></TD>
<TD>Password:</TD>
<TD><INPUT TYPE="Text" NAME="txtpwd" SIZE="14"></TD>
<TR>
<TD><INPUT TYPE="Button" NAME="cmdSubmit" VALUE="Login"></TD>
<TD></TD>
</TR>
</TABLE>
</FORM>
</BODY>
Keep in mind I am trying to keep this extremely simple.
The main problem I am having is finding a way to pass my "isvalid" variable onto the new webpage that will be opened (I was going to use 'isvalid' to determine if they were allowed access). I would much rather use Javascript, as VBScript seems quite ill-equiped as far as compatibility is concerned. If anyone can help me with my current code, or knows a simpler way of doing this (preferrably with Javascript) I would greatly appreciate it, as I have been unable to find any decent examples that don't require 3rd party script files and extensive complexity.
Thanks
I'm trying to make a very basic login system for a FTP server I own. I am trying to keep it very simple by having two main pages
Page 1: User inputs userID and password and submits
Page 2: If user...
Has valid login/pass they may see the webpage & continue normally
Or
Has an invalid pass they will be told so and will be denied from continuing to continue normally
I first tried to do this is with Javascripting but found little success, I then moved to VBscript because I am very familiar with visual basic. This is the VBscript I have, it does not work in its entirety.
<html>
<HEAD>
<TITLE>Validation Required</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!-- Instruct non-IE browsers to skip over VBScript modules.
Option Explicit
Dim isvalid
Sub cmdSubmit_OnClick
' Check to see if the user entered anything.
If (Len(document.frmLogin.txtuid.value) = 0) Then
MsgBox "You must enter your Username before submitting."
Exit Sub
End If
If (Len(document.frmLogin.txtpwd.value) = 0) Then
MsgBox "You must enter your Password before submitting."
Exit Sub
End If
If (document.frmLogin.txtuid.value = "username") Then
If (document.frmLogin.txtpwd.value = "password") Then
MsgBox "Login Successful."
isvalid="true"
window.open( "website" )
End if
Else
MsgBox "Invalid"
End if
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Validation required</H1>
<FORM NAME="frmLogin">
<TABLE>
<TR>
<TD>Username:</TD>
<TD><INPUT TYPE="Text" NAME="txtuid" SIZE="14"></TD>
<TD>Password:</TD>
<TD><INPUT TYPE="Text" NAME="txtpwd" SIZE="14"></TD>
<TR>
<TD><INPUT TYPE="Button" NAME="cmdSubmit" VALUE="Login"></TD>
<TD></TD>
</TR>
</TABLE>
</FORM>
</BODY>
Keep in mind I am trying to keep this extremely simple.
The main problem I am having is finding a way to pass my "isvalid" variable onto the new webpage that will be opened (I was going to use 'isvalid' to determine if they were allowed access). I would much rather use Javascript, as VBScript seems quite ill-equiped as far as compatibility is concerned. If anyone can help me with my current code, or knows a simpler way of doing this (preferrably with Javascript) I would greatly appreciate it, as I have been unable to find any decent examples that don't require 3rd party script files and extensive complexity.
Thanks