Can someone help me with a log in box?

I know html log in boxes aren't very secure, but I need help with a code. I need to be able to input my members' usernames and passwords, so please show me where to input those in the code and add a place to input them if there isn't one. Also, i need it to log in to a certain page. Please call that URL, in the code, "LOGGED IN PAGE". Thank you so much in advance! Here is the code in its current stage:

<font face="verdana,arial" size=-1>

<center><table cellpadding=2 cellspacing=0 border=0>

<tr><td bgcolor="black"><table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td bgcolor="black" align=center style="padding:2;padding-bottom:4"><b><font size=-1 color="white">Members' Login</font></th></tr>

<tr><td bgcolor="white" style="padding:5"><br>

<form method="post" action="http://www.authpro.com/cgi-bin/auth.fcgi%22 name=pform>

<input type="hidden" name="action" value="login">

<input type="hidden" name="user" value="deluxe">

<input type="hidden" name="hide" value="">

<center><table>

<tr><td><font face="verdana,arial" size=-1>Login:</td><td><input type="text" name="login"></td></tr>

<tr><td><font face="verdana,arial" size=-1>Password:</td><td><input type="password" name="password"></td></tr>

<tr><td><font face="verdana,arial" size=-1> </td><td><font face="verdana,arial" size=-1><input type="submit" value="Enter"></td></tr>

<tr><td colspan=2><font face="verdana,arial" size=-1> </td></tr>

<tr><td colspan=2><font face="verdana,arial" size=-1>Lost your username or password? Find it <a href="INSERT URL HERE">here</a>!</td></tr>

<tr><td colspan=2><font face="verdana,arial" size=-1>Not member yet? Click <a href="INSERT URL HERE">here</a> to register.</td></tr>

</table></center>

</form>

</td></tr></table></td></tr></table>

Thank you again!

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    This code is simply the interface for the login code. You need to add some server-side code for it to work.

    You need to start with a form (here it is, cleaned up a little, to understand it better):

    <form action="LOGIN CHECK PAGE" method="post">

    <p>

    <label for="username">Login:</label>

    <input type="text" name="username" id="username" value="" />

    </p>

    <p>

    <label for="password">Password:</label>

    <input type="password" name="password" id="password" value="" />

    </p>

    <p>

    <input class="submit" type="submit" value="Enter" />

    </p>

    <br class="clear" />

    <p>Lost your username or password? Find it <a href="FORGOT PASSWORD PAGE">here!</a></p>

    <p>Not member yet? Click <a href="REGISTRATION PAGE">here</a> to register.</p>

    </form>

    This form requires a style sheet:

    <style type="text/css">

    <!--

    #loginbox{

    border:solid black 1px;

    border-top:solid black 20px;

    width:350px;

    padding:10px;

    font-family:verdana,arial, sans-serif;

    font-size:10pt;

    }

    #loginbox p{

    margin:5px;

    margin-right:0;

    margin-left:0;

    width:100%;

    }

    #loginbox label{

    width:100px;

    float:left;

    }

    #loginbox input{

    width:200px;

    float:left;

    }

    #loginbox input.submit{

    width:80px;

    margin-left:100px;

    }

    .clear{

    clear:both;

    }

    -->

    </style>

    Then, you need a server-side script for the "LOGIN CHECK PAGE" :

    <?php

    $username = $_POST['username'];

    $password = $_POST['password'];

    // check user name and password in the database

    // See tutorial here:

    // http://php.about.com/od/finishedphp1/ss/php_login_...

    // If the username and password are in the database,

    // forward to the "LOGGED IN PAGE"

    header("Location: LOGGED IN PAGE");

    ?>

Still have questions? Get your answers by asking now.