Monday, September 3, 2007

Validity of username and passwords

We have assumed that you have created a table called "users", and that table contain as much fields as you want, you can insert recordsinto that table using a form in html. But be sure to include two fields:name= it is the username of the userpassword= it is the password of each userSimply create a form, using html, and set the action of that forum to a php file where you will include this small piece of code:1){ echo "Sorry, the username and password you submitted are not present in our database";}//if there are found in our database, and there is only one occurence of that username and password//thus making them valid, so inside, you can include the webpage you want to openif(mysql_num_rows($sql1)==1){include("the webpage"); //open up the secure page //instead of "the webpage" type in the path your secure website is located in}?>I know it is a beginner level way to restrict access to a webpage, but it seems to work fine, for a single webpage. Check it out, might be useful.