para poder manejar sessiones tienes que usar la libreria de session que trae php en tu caso...
fijate, te voy a pasar un script que fue el que yo hice ase tiempo, cuando esta aprendiendo a crear sessiones.
funciona con base de datos local, claro esta, la base de datos se llama prueba, y la tabla se llama usuario con atributos:
-id
-usuario
-pass
a continuación el script:
session.php: muestra la vista principal para el inicio de session
<body onload=setfocus();>
<p> </p>
<hr width="150%" />
<h1 align="center"> </h1>
<h1 align="center"><span class="style9">INICIO DE SESION </span></h1>
<p align="center"><span class="style1">Favor de autentificarse </span></p>
<p align="center"> </p>
<center>
<?php
if ($_GET['errorusuario'] == 1)
{
echo "<span class='style9'> Datos incorrectos </span> ";
}
else
{
echo "<span class='style9'> Introduce tu clave de acceso </span> ";
}
?>
<form id="form1" name="form1" method="post" action="control.php">
<table width="355" border="0" bordercolor="#000000" bgcolor="#BDC6FD">
<tr>
<td width="168"><span class="style2"> <strong> Usuario: </strong> </span></td>
<td width="171"><label>
<input name="usuario" type="text" id="usuario" />
</label></td>
</tr>
<tr>
<td><span class="Estilo2"> Contraseña </span>:</td>
<td><label>
<input name="password" type="password" id="password" />
</label></td>
</tr>
</table>
<p>
<label>
<input type="submit" name="Submit" value="Enviar" />
</label>
</p>
</form>
<p align="center" class="style8"> </p>
</center>
</body>
control.php: valida si el usuario tipeado esta registrado, si lo quieres hacer estatico para un solo usuario, que es el caso de tu script alla ariba, pues lo que tendrias que hacer es ubicarte en la linea de validacion y añadirle el usuario y la contraseña que quieres que sea por defecto.
<?php
include("conexion.php");
$usuario=$_POST['usuario'];
$password=$_POST['password'];
if( $usuario != NULL )
{
$resultado=mysql_query("select usuario from usuario where usuario='$usuario' and pass='$password' ",$conexion);
if($validar == TRUE)
{
$_SESSION['autentificado']="1";
$_SESSION['user']=$_POST['usuario'];
$_SESSION['pass']='password';
header("location:principal.php"); }
else
{
header('Location:sesion.php?errorusuario=1'); }
}
else
{
header('Location:sesion.php?errorusuario=1'); }
?>
seguridad.php: sirve para restriguir el acceso a varios sitios cuando el usuario NO esta logueado.
<?
if($_SESSION['autentificado']!="1"){
header("location:sesion.php"); }
?>
principal.php: es mostrado cuando el usuario ya esta logueado.
<?
include ('seguridad.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Index</title>
</head>
<body>
<p>Bienvenido, ya ha iniciado su sesion exitosamente</p>
<p> </p>
<p><a href="otro.php">otro script</a><br />
<p><a href="salir.php">Cerrar Sesion</a>
</p>
</body>
</html>
otro.php: lo añadi por si quieres añadir algun otro script que quieres que el usuario vea
<?
include ('seguridad.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>otro php</title>
</head>
<body>
<p>otro script php</p>
<p> </p>
<p><a href="salir.php">Cerrar Sesion</a>
</p>
</body>
</html>
salir.php: script que destruye la session del usuario que ya inicio la session
<?
header("location:sesion.php"); ?>
si quieres descargar el script completo aqui te dejo el link:
http://www.4shared.com/rar/JWHmpQgl/login.html
espero te sirva!..
saludos!!