Urgh.. Well if your database has ID, Username, Password (encrypt this when they register(turn it into some strange text like 012121211213012121/dfd) and NEVER decrypt it. To check it, you'd encrpyt the entered pass, and compare it - not decrypt the real pass. Encrypt with $password = md5($password); when they register - before adding it to the db)...
<html><head><title>LOG IN</title></head>
<body>
<form method="post" action="whatever.php">
<input type=text name=username>
<input type=text name=password>
</body>
</html>
<?php
if(!($link_id = mysql_connect($Host, $User, $Pass))) die(mysql_erorr());
mysql_select_db($DB);
//Log in part
$sql = "SELECT ID FROM " . $Table . " WHERE Name='" . addslashes($_POST['username']) . "' AND Password='" . md5($_POST['password']) . "' LIMIT 1";
if(!($result = mysql_query($sql))) die(mysql_error());
// If one row - info was correct, they logged in. so passwords matched.
if(mysql_num_rows($result) == 1) {
// Set cookie saying user logged in | last for a day
setcookie("LoggedIn, TRUE, time()+(3600 * 24));
} else {
echo "Login failed";
}
<?
// Members page
if(!isset($_COOKIE['LoggedIn'])) die("You are not logged in!");
// Put textbox stuff here
Sorry, I'm in a rush. I hope there wasn't any typos, try that.