Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


User / Password wanted

Posted on 1998-04-11
Medium Priority
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!
Question by:gravity
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

Author Comment

ID: 1234024
Edited text of question

Author Comment

ID: 1234025
Adjusted points to 245

Accepted Solution

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:

<TITLE>JavaScript Password File</TITLE>

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) {
        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
                Temp += Cipher
        return (Temp)

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

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

// -->
<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>

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.
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.


Author Comment

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!

Author Comment

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.

Tom Buck

Author Comment

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.

Tom Buck

Author Comment

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


Expert Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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

618 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