Solved

User / Password wanted

Posted on 1998-04-11
8
302 Views
Last Modified: 2008-02-01
Can someone program for me a box just like the one for logging on at the experts exchange. It must ask for a password and username for any file accessed in that directory.
Lots of points on offer here!
'A' grade given to person who answers!
0
Comment
Question by:gravity
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
8 Comments
 
LVL 2

Author Comment

by:gravity
ID: 1234024
Edited text of question
0
 
LVL 2

Author Comment

by:gravity
ID: 1234025
Adjusted points to 245
0
 
LVL 6

Accepted Solution

by:
jpk041897 earned 240 total points
ID: 1234026
Experts-Exchange actualy uses a JavaScript placed in a linked style sheet. (The address to the style sheet is: http://www.experts-exchange.com/topics/defaultcss).

The way to actualy implement the password varies depending on what you want to achieve.

The simplest approach is to use a JacaScript form along the lines of:

<HTML>
<HEAD>
<TITLE>JavaScript Password File</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--

function testEncode(form) {
        var dater = new Date();
        Month = dater.getMonth();
        dater = null;
        var Ret = encode (form.inputbox1.value, Month)          // change to var Ret=x, where x is 1
                                                        // to 63, if you don't want change every month
        location = "null/" + Ret + ".htm"
}

function encode (OrigString, CipherVal) {
        Ref="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz._~"
        CipherVal = parseInt(CipherVal)
        var Temp=""
        for (Count=0; Count < OrigString.length; Count++) {
                var TempChar = OrigString.substring (Count, Count+1)
                var Conv = cton(TempChar)
                var Cipher=Conv^CipherVal
                Cipher=ntoc(Cipher)
                Temp += Cipher
        }
        return (Temp)
}

function cton (Char) {
        return (Ref.indexOf(Char));
}

function ntoc (Val) {
        return (Ref.substring(Val, Val+1))
}

// -->
</SCRIPT>
</HEAD>
<BODY>
<H1>JavaScript Password Example</H1>
<FORM NAME="testform" onSubmit=false;>
Please enter your password: <BR>
<INPUT TYPE="text" NAME="inputbox1" VALUE=""><P>
<INPUT TYPE="button" NAME="button" Value="Submit" onClick="testEncode(this.form)"><BR>
<INPUT TYPE="hidden" NAME="hidden" VALUE=""><P>
</FORM>
</BODY>
</HTML>

You can then setup a CGI on the recieving end of a form and process the input, determine if the user passes verification and send back the next page.

The same effect can be achieved using a JavaBean, a Server Side Include (SSI), a Java servlet (if your server supports them) or SSL (Just place the HTML page and an Applet on the same directory behind an SSL layer and the browser will ask for the password).

Exactly which mechanism to use depends on what you want to acomplish. For simple access like expert-exchanges, a JScript + CGI will do (The use of the style sheet is to attempt to hide the simple security mechanism).

If you are going to run secure transactions, then either the SLL trick described above or a bean programmed to send a user:password  pair would be more convinient. (Code for accesing a page or file behind secure layer was documented in the Febuary issue of JavaWorld at: http://www.javaworld.com/javaworld/javatips/jw-javatip47.html , which given the ammount of points you are assigning to this question is probably closer to your needs.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 2

Author Comment

by:gravity
ID: 1234027
Cheers for that...I'm impressed, although what I meant was that box that comes up when you go to htpp://www.experts-exchange.com/topics

and then asks for your username and password...

..even so, this is pretty good...
Also, the address you gave comes up an error, stating that the file doesn't exist...Help!
0
 
LVL 2

Author Comment

by:gravity
ID: 1234028
I'm going to give you the points, but could you mail me as with how to implement. I'm only just starting when it comes to CGI, and although I could do what I wanted in Shockwave, it takes too long and too much space.

Cheers,
Tom Buck
gravity@lycosmail.com
0
 
LVL 2

Author Comment

by:gravity
ID: 1234029
I'm going to give you the points, but could you mail me as with how to implement. I'm only just starting when it comes to CGI, and although I could do what I wanted in Shockwave, it takes too long and too much space.

Cheers,
Tom Buck
gravity@lycosmail.com
0
 
LVL 2

Author Comment

by:gravity
ID: 1234030
Sorry 'bout the grade-it buggered up when I pressed the submit button...

0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1234031
I'll mail you the link gladly, and then help out with the code over the next few weeks.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question