Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating A Login Page

    Simply, I would like to know how to create a login page. To my knowledge, this task is relatively easy. However, due to my lack of knowledge of Java/Javascript, I am immensely stuck.

    Given the following (a very simple Username/Password login area -- as I have posted (below) and shown here: http://www.geocities.com/simple_userpass/index.htm )...

    Code:
    <html>
    <head>
    <title>Login</title>
    </head>
    <body>
    
    <form name='main' method='INeedAMethod' action='INeedAnAction'>
       <input type='hidden' name='cmd' value='INeedAValue'>
    
       <table border='1' bgcolor="#CCCCCC">
       <tr>
       <td>
       Username
          <input type='text' name='j_username' size='10' maxlength='25' >
       Password
          <input type='password' name='j_password' size='10' maxlength='25' >
       <!--Login-->
          <input type='submit' value='Login'>
    </form>
    
    </body>
    </html>
    ...how can I create a login page that allows only authorized users to be redirected to the main webpage. I presume this would be similar to that of a forum's Login page, as you must login in order to post (and have other capabilities). However, for my Login page, I do not want to allow 'guests' to roam the webpage. If a guest wants access to the webpage, they must email an administrator that will then determine their eligibility. This login page is meant to only allow those eligibile to view the information on the webpage. The goal is to make everyone that accesses the domain pass through this step before they can access the information therein.

    Naturally, since I don't have much knowledge on the subject, as mentioned above, feel free to explain to me (the many) other 'things' I would need. I feel that this process is pointless unless there is a 'document' that checks the inputted username/password with the username/password in a file somewhere else.

    If there is a premade login page already created, where I would have to simply change the fields, that may also be helpful.

    The username/password fields in the given login page (above) are not final, so if someone wants to 'shred' my code, be my guest.

    If you don't mind, please leave a means of communication where I would be able to reach you, else I'll post in this thread.

    Thank you very much for any help.

    Regards,
    -Nxp

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Bristol, UK
    Posts
    147
    Thanks
    6
    Thanked 2 Times in 2 Posts
    hi,

    there are many ways of doing what you want to do, but none of them include javascript!

    You need to use a Serverside script, like php, asp, or perl.

    I think along with many other users on the forum, i would recommend PHP.

    There are still a few ways you can do it, how secure do you need it to be? You can store the username and password in a text file and put it on the server, or you can store the usernames and passwords in a database and have the script look in there for it.

    As far as your form goes, the method you would use would be "post" and the action would be the name of the script that you will be using i.e. login.php.

    Another option would be to use .htaccess files, but i havent heard people talking about them for a long time, so im not sure whether anyone else would still recommend them, also not sure how secure this method would be.


    Jon
    "You only live once, play it right, and once is enough" - me :)
    "When i die only god can take my soul" - me again! :P

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    A server-side script is naturally to be preferred, but a secure log-on can be
    achieved with JavaScipt.

    See Borgtex's ingenious scripts at

    Secure Login with javascript

  • #4
    New to the CF scene
    Join Date
    May 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Jonny and Philip. You both have been very helpful.

    To answer: I need the site to be secure enough so that people can't just pass over the initial login stage, and must enter username/password to get access. Additionally, I can't have it possible for 'hackers' to read the files in my directory and thus get alternate ways of accessing protected webpages.

    Moreover, if I were to make a server-side script, how would I go along trying that?

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,620
    Thanks
    0
    Thanked 645 Times in 635 Posts
    You can't create a secure page using Javascript as there are always ways of obtaining the page source bypassing the Javascript. The closest you can get would be to "encrypt" the web page and require a password to be entered in order to "decrypt" it (as described at the bottom of http://www.felgall.com/javatip4.js ). Even then someone could just analyse the Javascript code in the page in order to decrypt the content without needing to know the password.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #6
    Regular Coder thesmart1's Avatar
    Join Date
    Dec 2005
    Posts
    369
    Thanks
    7
    Thanked 3 Times in 3 Posts
    Your best bet I think would be to use some kind of server-side language like Jon suggested. I can only assume Geocities supports one if not more of these. You should find out what they support before you go researching server-side languages (unless anyone else here knows).

  • #7
    New to the CF scene
    Join Date
    May 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am using geocities for testing, but I doubt I will use it for the final webpage.

    Otherwise, I would love to use a server-side language, as it seems to be the most secure.

    Now the question is: How should I go about creating this page using a server-side language? It seems PHP has the most popularity. Ergo, should I create the same thread in the PHP forum?

    Thanks for the help felgall and thesmart1!

  • #8
    Regular Coder
    Join Date
    May 2006
    Location
    Bristol, UK
    Posts
    147
    Thanks
    6
    Thanked 2 Times in 2 Posts
    i think along with many other members i would recomment going to www.w3schools.com and reading through the pages on PHP and MySQL, as you will need at least a basic understandin of php and mysql before you can create even a simple login script.

    Have a quick read just to familiarise your self with both langauges, then it will make more sense when we explain what you need to do.

    Hope that helps

    Jon
    "You only live once, play it right, and once is enough" - me :)
    "When i die only god can take my soul" - me again! :P

  • #9
    New to the CF scene
    Join Date
    May 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again for the help Jonny.

    I'm sorry if this sounds pathetic (or simply lazy), but...
    Would it be possible to find a (server-side) login script already made, where I would only have to change (a majority of) the fields.

  • #10
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    You will find quite a few pre-made (free) scripts at www.hotscripts.com.

    A good example is to be found at
    http://www.hotscripts.com/Detailed/58398.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •