In this tutorial we will be covering Login.
We will be making three files
connect.php <--to connect to the database
login.php <--that will have the login form on it
auth.php <--will authorize the login, making sure the info is correct.

So first off your going to need to make a "connect.php" so that the login script can connect to the mysql database to get, and submit info.

connect.php
PHP Code:
<?php

$db 
mysql_connect("localhost","root","") or die("Could not connect to db");
if(!
$db)
die(
"no db");
if(!
mysql_select_db("database",$db))
die(
"No Database Selected");

?>
Now im using "WAMP" as so i can set up PHP and MySQL dependent sites on my localhost.

Because you will need to set up a MySQL database for this.
PHP Code:
$db mysql_connect("localhost","Mysqlusername","Mysqlpassword")
if(!
mysql_select_db("Mysqldatabasename",$db)) 
login.php
PHP Code:
      <form method="POST" action="auth">
User Name   
        
<input type="text" name="name" size="21">   
        <
br>
        
Password        
<input type="password" name="password" size"21" mask="x">   
        <
br>
<
input type="submit" value="Login" name="submit">
</
form
auth.php
PHP Code:
<?php
include_once 'connect.php';
session_start();

if (isset(
$_POST['submit']))
{
  
$user=$_POST['name'];
  
$password=$_POST['password'];
  
$user=strip_tags($user);
  
$password=strip_tags($password);
  
$password=md5($password);
  
  
$query "select name, password from user where name='$user' and '$password'";
  
$result mysql_query($query) or die("COULD NOT QUERY USER");
  
$result2 mysql_fetch_array($result);
  if (
$result2)
  {
    
$_SESSION['name']=$user;
    
?>
    
<script type="text/javascript">
window.location = "index.php"
</script>
<?php
  
}
  else
  {
    echo 
"<big>Wrong Username Or Password.<a href='login.php'>Try Again</a></big>";
  }
}
?>
So you should really get to know how MySQL databases /php works before trying these sort of things, im kind of in a rush right now so i cant explain it much, so if you have any questions just PM
Enjoy
__________________________________________________ _______________________________
Originally made for Tech Forumz