?
Solved

User / Password wanted

Posted on 1998-04-11
8
Medium Priority
?
314 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
  • 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 480 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

807 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