..
In this articollo we will see how to create a complete system of Ajax-based user authentication.
To achieve our aim we use the jQuery library (which makes life easier for us to develop client-side), what language PHP for server-side operations and MySQL for the data stirage user access.
The purpose of the field believe it is absolutely clear: "id" is the unique identifier, in the "username" we're going to record the user's name and, finally, in the "password" we're going to save passwords go through the dopoaverle md5 () function.
For the purposes of this article is not material to create the user registration page. Let avoi the boatswain, therefore, to populate the database with some test data.
To create a login form we need, of course, an HTML form. Let's follow the code of our form:
<form method="post" id="modulo_login" /> <table border="0"> <tr> <td> Username: </ td> <input <td> name="username" type="text" id="username" maxlength="10" style="width: 250px"/> </ td> </ tr> <tr> <td> Password: </ td> <input <td> name="password" type="password" id="password" maxlength="10" style="width: 250px"/> </ td> </ tr> <tr> <td> <input type="submit" id="submit" value="Entra" /> </ td> <div <td> id="messaggio"> </ div> </ td> </ tr> </ Table> </ Form>
In order to look nice in our work we need a few lines of CSS.
Of course, all aspects of the style sheet can be tailored to fit your needs:
div
input {
font-family: arial, verdana;
font-size: 12px;
}
. Correct,
. Error {
padding: 3px;
text-align: center;
}
. Correct,
. Error {
width: auto;
font-weight: bold;
border: 1px solid # 349534;
background: # C9FFCA;
color: # 008000;
}
. Error {
border: 1px solid # CC0000;
background: # F7CBCA;
color: # CC0000;
}
| |
ASP Zero (Ebook)
Learning Microsoft ASP and VBScript from scratch. At only 29 €. |
| |
Javascript (Course)
Complete guide to client-side scripting. From 39 €. |
| |
PHP (Course)
Full course for creating dynamic Web sites. From 49 €. |