Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/12/2010, 07:32
phpfan
(Desactivado)
 
Fecha de Ingreso: noviembre-2010
Ubicación: Malaga
Mensajes: 225
Antigüedad: 15 años, 10 meses
Puntos: 0
Pregunta ¿Cual es el problema con mi session siempre me sale mal?

-Hola estoy haciendo un inicio de session para administracion pero esto siempre falla nose que ocurre muestro el codigo ,echen una mano porfavor y gracias.


Código PHP:
<?

ob_start
();

 

// connect to the mysql server 
$link = mysql_connect("localhost","","") 
or die (
"Could not connect to mysql because ".mysql_error()); 

// select the database
mysql_select_db("base_de_datos") 
or die (
"Could not select database because ".mysql_error()); 

$match = "select id from ac_users where username = '".$_POST['username']."' 
and password = '"
.$_POST['password']."';"; 

$qry = mysql_query($match) 
or die (
"Could not match data because ".mysql_error()); 
$num_rows = mysql_num_rows($qry); 

if (
$num_rows <= 0) { 
echo 
"Sorry, there is no username or password with: <strong>".$_POST['username']."</strong><br>"; 
echo 
"<a href=login.php>Try again</a>"; 
exit;

} else { 

setcookie("loggedin", "".$_POST['username']."", time()+(3600 * 24));
echo 
"Welcome: <strong>".$_POST['username']."</strong><br>"; 
echo 
"Continue to the <a href='http://www.dominio.com/login_moderador/login.php' style='color:gold'>ir a Administracion</a> section.";

 
}


ob_end_flush();
 
?>