PHP SOLUTIONS: DYNAMIC WEB (Cool web site) DESIGN MADE EASY no
PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY no way that you can send users password reminders if they forget them; you must generate a new password. Nevertheless, good security demands encryption. Another precaution that s worth taking is adding a salt to the password before encrypting it. This is a random value that s added to make decryption even harder. Even if two people choose the same password, adding a unique value to the password before encryption ensures that the encrypted values are different. Sounds difficult? Not really, as you ll see over the next few pages. You need to create a user registration form that checks the following: The password and username contain a minimum number of characters. The password matches a second entry in a confirmation field. The username isn t already in use. PHP Solution 9-6: Creating a file-based user registration form This PHP Solution assumes that you have set up a private folder that PHP has write access to, as described in Chapter 7. It also assumes that you are familiar with Appending content with fopen() in the same chapter. The finished code for this section is in register02.php in the download files. 1. Create a page called register.php in the sessions folder, and insert a form with three text input fields and a submit button. Lay out the form, and name the input elements as shown in the following screen. If you want to save time, use register01.php in the download files. 2. When building a script to process the input from a form, it s a good idea to map out the flow of the script as comments, and then fill in the details. As always, you want the processing script to run only if the form has been submitted, so everything needs to be enclosed in a conditional statement that checks whether the name attribute of the submit button is in the $_POST array. Then you need to
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.