1. TechSpot is dedicated to computer enthusiasts and power users. Ask a question and give support. Join the community here.
    TechSpot is dedicated to computer enthusiasts and power users.
    Ask a question and give support.
    Join the community here, it only takes a minute.
    Dismiss Notice

can somebody tell me how to make a username and password box in html?

By praveen198830 ยท 11 replies
Aug 15, 2006
  1. can somebody tell me how to make username and password box in html
  2. fastco

    fastco TS Booster Posts: 1,123

  3. Nodsu

    Nodsu TS Rookie Posts: 5,837   +6

    LOL.. Just like the easiest way to crack a nut is to smash it with a refrigerator :D
  4. fastco

    fastco TS Booster Posts: 1,123

    ^^I'll have to try that.
  5. praveen198830

    praveen198830 TS Rookie Topic Starter Posts: 39

    is there any other codes which is used for multiple users
  6. TCool

    TCool TS Rookie Posts: 64

    <input type="text" size="x" name="x">
    Change the x's to whatever it is you want to use, if you take out the size portion it will just use a default size, and i think it'll work without the name part too, but yer going to want that in there if you want to use the boxes in any way. You can use that same code for passwords, but you can also make a text box that will hide what you type in. For that just replace "text" with "password".

    If your trying to actually make something that you need to have a username/pw to log into you are going to need a lot more code than this tho.
  7. jobeard

    jobeard TS Ambassador Posts: 10,432   +801

    start with a normal form
    on the INPUT TYPE=PASSWORD SIZE=12 NAME=pw field, add a javascript call to encode the
    password, the type=password will obscure the chars typed by the user.
    you should also use method=POST to avoid host loggin of the data.
  8. praveen198830

    praveen198830 TS Rookie Topic Starter Posts: 39

    can u give me any site to look at the steps how to make it please
  9. TCool

    TCool TS Rookie Posts: 64

    Can you give a little more details about what you are trying to do? Then I might be able to help you out.
  10. praveen198830

    praveen198830 TS Rookie Topic Starter Posts: 39

    like all codes can u write the whole code
  11. TCool

    TCool TS Rookie Posts: 64

    Well, you'd have to give specifics of what you want and I can offer you some advice. However I can't code everything for you, don't have the time and how will you learn if you don't do it yourself?:stickout: I really only know how to do a members area that requires username/pw in php right now, there are other ways too, and they are not too hard to learn. Just takes some patience and a lot of reading/trial and error. The best way to do it I guess all depends on what you are trying to do. What exactly do you need the username/login for? Do you have a website up already that you are planning on adding this to? Can you give me specifics of your plans?

    If you decide to use php for what your doing I can tell you that you will need a host that has to support php, and a form of database(probably mysql). How it works is you have the usernames/passwords stored in the database and you use php to access the database. When they type in there username you can have php call up the database and compare the password entered for the username entered to what the database has stored for the password. It will work like:

    select 'password' from db where username='$username' (the "$username" would be what was entered in the username box. "db" would be your database)
    Then php would compare what was entered in the password box with what is in the database something like:
    if $password = dbpassword then allow access else don't allow access. ($password is what was entered in password box, and dbpassword is what was pulled out of the database.)

    This is not exact php code but I think it illustrates how it would work, and it would be much more complicated than just putting in something like "allow access" and "don't allow access".

    It is definately possible to build yourself a members only type area in a web site, and you can do it all for free. It may take you some time to learn how to use php/mysql but if your up for some hefty reading and a lot of trial and error then I'd say go for it. Php is a pretty fun thing to mess around with, and you can do a lot with it.

    If your interested in learning how to do this kind of stuff try using www.webmonkey.com there is some good information there to help you get started. And the best place, in my opinion, would have to be www.php.net a very good place for lots of information on all the functions of php, and ofcourse the place to get updates and stuff. A tool you'll probably want to have is apache triad, it'll install a web server on your computer and php/mysql so you don't have to go through the hassle of doing it. This would be for messing around with php/mysql on your computer and not having to find a host on the web to do it, and then after you build what you want you can just upload it to the web.
  12. Spike

    Spike TS Evangelist Posts: 2,168

    You use the INPUT tags for the fields, and use the submit tag to tell it what acions are performed when the submit button is pressed.

    Other methods include ht.access files, but these are really only a security measure rather than a means of having multiple users with different profiles, and an imperfect security measure at that.
Topic Status:
Not open for further replies.

Similar Topics

Add New Comment

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...