title: Where's the loop in this php code?
body: <p>I'm trying to create a restriction to a form in a website Im desingning so if you dont log in you cant open that form but apparently there's a loop I dont know where and I tried changing the headers locations and still the same, heres the code:</p>
  
  <p>this one is for the login</p>
  
  <pre><code>&lt;?php
    include ("conexion/conexion.php");
  
  
  $usuario= $_POST['usuario'];
  $clave= $_POST['clave'];
  
  
  $sql="SELECT usuario,clave FROM usuarios WHERE usuario='".$usuario."' and clave='".$clave."'";
          $result=mysql_query($sql);
          $count=mysql_num_rows($result);
  
          if($count==1){ // The user exists
              $_SESSION["username"] = $usuario;
              $_SESSION["mypassword"] = $clave;  
              $_SESSION['login']=true;      
              header("location:loginusuario.php"); // page to redirect to
  
  
          }
          else {
  header ("location: contacto.php");
  }
  
  
  ?&gt;
  </code></pre>
  
  <p>and this one for the file I created to restrinc the page</p>
  
  <pre><code>&lt;?php
  session_start();
  if(!IsSet($_SESSION['login']) AND $_SESSION['login'] != true) {
  header ("location: contrataciones.php");
  }
  else {
  header ("location: loginusuario.php");
  }
  ?&gt;
  </code></pre>
  
  <p>if you can please copy and paste the edited code I need to finish this before tomorrow</p>