ya corregí el error de los headers y ya me funciona bien pero ahora si coloco un usuario existente siempre me manda que no existe este es el código:
Código PHP:
<?php
include( "conex/conect.php");
$link=Conectarse();
$usuario =mysql_real_escape_string($_POST['usuario']);
$pass=md5($_POST["txtpass"]);
if(trim($usuario)!= "" && trim($pass)!= ""){
$sql="SELECT * FROM 'empresa' where usuario = '$usuario' and pass= '$pass'";
$rs = mysql_query($sql,$link);
if($row = mysql_fetch_array($rs)){
if($row['usuario']==$usuario){
if($row['pass']==$pass){
$_SESSION['user']='si';
$_SESSION["usuario"]=$row["usuario"];
header("Location:/admin/index.php");
echo $usuario;
}else{header("Location:index.php?msg='1'");}
}else{header("Location:index.php?msg='2'");}
}else{header("Location:index.php?msg='3'");}
}else{header("Location:index.php?msg='4'");}
mysql_close($link);
?>