To start you off!
You need to write something similar to this...(using your own file names of course!)...
Create a simple login form i.e "login.php" which contains username & password <form action = "authenticated.php".....
Create a "users" table in MySQL which contains the users username & password.
"authenticated.php"
<?php
session_start();
if ($_SESSION['logged_in'] != "true"){
$username = $_POST['username'];
$password = $_POST['password'];
}
else {$username = $_SESSION['username'];
$password = $_SESSION['password'];
}
$self = $_SERVER['PHP_SELF'];
$referer = 'login.php';
if( ( !$username ) or ( !$password ) )
{ header( "Location:$referer" ); }
$conn = @mysql_connect( "localhost", "xxx", "xxx" )
or die ( "Could not connect" );
$rs = @mysql_select_db( "xxx", $conn )
or die( "Could not select database" );
$sql="select * from xxx where username = '" . $username . "'
and password = '". $password . "'";
$rs = mysql_query( $sql, $conn )
or die(mysql_error() . "Could not execute query" );
$num = mysql_numrows( $rs );
if( $num != 0 ){
$_SESSION['logged_in'] = "true";
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
$rs = @mysql_select_db( "xxx", $conn )
or die( "Could not select database" );
$sql = "select * from xxx where username = '" . $username . "'";
$rs = mysql_query( $sql, $conn )
or die(mysql_error() . "Could not execute query" );
The above example would first authenticate the user then secondly connect to another table to extract data.
It's now up to you what you want to do with this???