Hola Gente..... ahora si.... tamos listos, ya estan hechos y probados cada uno de los archivos....  

Hice 5 archivos: 
index.php, donde tengo un formulario donde tomo y mando el username y pass, 
validar.php, donde hace la busqueda en mi base de datos y verifica si el usuario existe y pones las respectivas cookies, 
resumen.php, que es el archivo o información a proteger, 
logout.php. que es para hacer el logueo y borrar las cookies, 
config.php, que es donde realizo la conexion a la base de datos y por ultimo 
funciones.php, que es donde tengo los datos para la conexcion.....
ahora los archivos mas importantes son
index.php<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
  <form name="form1" method="post" action="validar.php">
    <table width="45%"  border="1">
      <tr>
        <td width="47%">Username</td>
        <td width="53%"><input name="username" type="text" id="username"></td>
      </tr>
      <tr>
        <td>Password</td>
        <td><input name="pass" type="text" id="pass"></td>
      </tr>
      <tr>
        <td> </td>
        <td>
          <div align="right">
            <input name="entrar" type="submit" id="entrar" value="Entrar">
          </div></td>
      </tr>
    </table>
  </form>
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Prueba de acceso</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
		include ("includes/config.php");
		include ("includes/funciones.php");
		//nos conectamos a mysql
		$cnx = conectar ();
		if($_POST["entrar"]){
			if($_POST["username"] && $_POST["pass"]){
				$contraseña = md5("$_POST[pass]"); //esto de md5 es para comparar si guardas la passwd en md5 si no borralo
				$query = mysql_query("SELECT * FROM usuarios WHERE nick='$_POST[username]'");
				$datos = mysql_fetch_array($query); 
				if($datos[pass] == $pass){ // si las pass son =// crea la cookie del usuario con la id el nick y la pass
					setcookie("id",$datos[id],time()+90000);
					setcookie("nick",$datos[nick],time()+90000);
					setcookie("pass",$pass,time()+90000);
					//if($HTTP_REFERER){ // lo redirige
						header("Location: resumen.php"); //} // Esto es lo que tenia header("location: $HTTP_REFERER");
					//else {
					//	header("Location: index.php");
					//}
				} else {
				echo "La contraseña es incorrecta";
				header("Location: index.php");
				}
				} else {
				echo "Faltan campos por rellenar";
			}
		} else {
			echo "Estas haciendo un uso indevido del login";
		}
?>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #0000FF}
-->
</style></head>
<body>
<?php
if($_COOKIE[id]) 
{echo "<h1> </h1>";
 echo "<h1>YES !!</h1>";
// Aqui va el codigo que quieras proteger
} else 
{echo "Solo los usuarios registrados pueden acceder a esta sección";
}//Fin
echo"<p> </p>";
echo"<a href='logout.php'>Salir</a>"
?>
</body>
</html>
<?
//clear the cookie and return to login
$login_page = "index.php";
if($_COOKIE[id] && $_COOKIE[nick] && $_COOKIE[pass]){
setcookie("");
setcookie("");
setcookie("");
if($HTTP_REFERER){
header("location: $HTTP_REFERER");} 
else {
header("location: index.php");}
} else {
echo "No estas logueado!";
header("Location: $login_page");
}
//setcookie ("this_cookie", "", 0, "", "", 0);
//setcookie ("name", "", 0, "", "", 0);
//header("Location: $login_page"); 
//exit();
?>
<?php
$HOSTNAME = "localhost";//SERVIDOR
$USERNAME = "root";		//USUARIO
$PASSWORD = "";		//CONTRASEÑA
$DATABASE = "minasthirit";	//BASE DE DATOS  minasthirit
?>
<?
/***
función conectar
que = se conecta a mysql y devuelve el identificador de conexión
***/
function conectar(){
	$dbh=mysql_connect ("localhost", "USUARIO", "PASS") or die ('I cannot connect to the database because: ' . 	mysql_error());
	mysql_select_db ("minasthirit"); 
	//global $HOSTNAME,$USERNAME,$PASSWORD,$DATABASE;
	//$idcnx = mysql_connect($HOSTNAME, $USERNAME, $PASSWORD) or DIE(mysql_error());
	//mysql_select_db($DATABASE, $idcnx);
	return $idcnx;
}
?>
Aahora...... el problema es que en mi maquina funciono de lo mejor.... se comporto como debia pero cuando lo subi al servidor me mando estos errores
Warning: Cannot modify header information - headers already sent by (output started at /home/publiweb/public_html/access/validar.php:8) in /home/publiweb/public_html/access/validar.php on line 19
Warning: Cannot modify header information - headers already sent by (output started at /home/publiweb/public_html/access/validar.php:8) in /home/publiweb/public_html/access/validar.php on line 20
Warning: Cannot modify header information - headers already sent by (output started at /home/publiweb/public_html/access/validar.php:8) in /home/publiweb/public_html/access/validar.php on line 21
Warning: Cannot modify header information - headers already sent by (output started at /home/publiweb/public_html/access/validar.php:8) in /home/publiweb/public_html/access/validar.php on line 23
No entiendo que es lo que pasa ..... alguna sugerencia.... gracias   
 
  
 
Saludos  
