Solved

User / Password wanted

Posted on 1998-04-11
8
295 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 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
Technology Partners: 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!

 
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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
Java exception bubble up 2 24
hibernate example using maven 12 77
ejb on wildfly 5 45
Delphi Firemonkey: if the Sms contain special characters it won't send it 3 62
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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:

713 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