Solved

User / Password wanted

Posted on 1998-04-11
8
261 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 61
countHi2 challenge 7 44
word0 challenge 4 52
Running Jira on Raspberry PI 2? 3 121
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now