Ticket System in PHP - #1 Database Design & HTML Password Reset Form

Introduction:

This tutorial is on how to create a full ticket system in PHP, HTML, and MySQLi. Since ticket systems require a lot of fairly complex code, for beginners, this will be split up in to multiple tutorials/sections. This first section is on the database design, and basic HTML form.

Theory:

The theory behind this system is that it is a slightly more secure way of enabling your users or customers/clients to reset their password, or perform other actions along with verification built in. First a ticket will be generated, then the ticket will be emailed to them, finally they will be able to enter their ticket in to a HTML form/visit a specific link and reset their psasword or perform other actions.

Database Design:

Within our database we will want at least two tables. The first of these will be to hold customer information. The customer information we require for this process is going to be: ID - Int - 5 Length - Primary Key - Auto Increment Username - Text/Varchar - 255 Length Password - Text/Varchar - 255 Length Email - Text/Varchar - 255 Length We will also need a 'tickets' table which will hold the following columns: ID - Int - 5 Length - Primary Key - Auto Increment Ticket - Text/Varchat - 10 Length User - Int - 5 Length

HTML Password Reset Form:

Now for the actual password reset form created in HTML which the user will be able to use once they have entered their ticket ID correctly. This HTML form is going to be a simple form which will send the entered information to the page 'reset.php' (via the 'action' property), through the POST method, as opposed to the unsecured GET method, ready to reset their password. To reset their password we simply want a new password for their account. We would already have their ticket, which in turn would give us their customer record from the other table within our database. We want to take in two password fields to ensure the user has entered their password correctly so they can log in once it has reset for their account.
  1. <form action='reset.php' method='POST'>
  2. <input type='password' placeholder='Password' name='password1' />
  3. <input type='password' placeholder='Password2' name='password2' />
  4. <input type='submit' value='Reset Password' name='resetPassword' />
  5. </form>
The above form would now allow the user to enter a new password, twice which will be checked upon processing via the 'reset.php' page which we will create in a near future tutorial.

Finished!

Add new comment