![]() |
|
|
|||||||
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||
|
[PHP]Simple Flat File Login Form
In this tutorial, I will show you have to creat a simple flatfile PHP login system. This is our code, I will break it down at the end: Login.php: HTML Code:
<html>
<head>
<title>Login</title>
</head>
<body>
<form action="./login.php" method="post">
<input type="text" name="uname">
<input type="password" name="pwd">
<input type="submit" value="Login!">
</form>
</body>
</html>
<?
if ($_POST[pwd] !== "test" || $_POST[uname] !== "test") {
echo "Sorry, try again!";
} else {
echo "Welcome $_POST[uname]!";
}
?>
To break it down, the HTML is pretty simple. It is a form that will verify on it's self. The PHP between the <? ?> tags verifys than information. Right now we have the username & password set to 'test'. You can set these to anything you wish. The != says if the username & password are NOT equal to test, do this. I have it set to echo Sorry, try again. If it is equal, it will go the the } else { and display anything under that. I hope this tutorial helped some. I will soon do one with MySQL and cookies.
__________________
http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/...ogorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a> Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!! |
|
|
|
||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|