03-03-2007, 02:54 PM
|
#2 (permalink)
|
| DNOA Member Join Date: May 2004
Posts: 5,040
| Code: <form method="post" action="login.php">
Username field here...
Password field here...
</form> then in login.php.... ????: NamePros.com http://www.namepros.com/programming/300814-php-and-mysql-login-script-help.html PHP Code: <?php
//Start the session variable.
session_start();
//Put that line at the very top of every file
//that you need to be logged in for, or
//uses session vars.
if (!$_POST['username_textbox_name_here'] || !$_POST['password_textbox_name_here'])
{
echo("ERROR > Please type a username and password");
exit;
}
/*
At this point, you want to verify the login information
against stored data. This could be hard-coded here if
you have 1 or 2 permanent users, or checked with a database.
If you need help there are examples around the Internet.
*/
//If the login is good, then set the session variable
$_SESSION['loginname'] = $uname;
//...or something to that extent.
//To check the login, make sure the session var is set
//to a good value.
?> If you need details or further examples, the Internet has this all *over* the place. If you have a question, go ahead and reply/ask. |
| |