title: how to implement a login script using PHP
body: <p>I've found this login script and I'm trying to implement it into my website but having a little trouble:
     
  
  <pre><code>// Connects to your Database
  mysql_connect("localhost", "root", "") or die(mysql_error());
  mysql_select_db("testing") or die(mysql_error());
  
  //checks cookies to make sure they are logged in
  if(isset($_COOKIE['ID_my_site']))
  {
      $username = $_COOKIE['ID_my_site'];
      $pass = $_COOKIE['Key_my_site'];
  
      $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or      die(mysql_error());
  
      while($info = mysql_fetch_array( $check ))
      {
          //if the cookie has the wrong password, they are taken to the login page
          if ($pass != $info['password'])
          {
              header("Location: loginscript.php");
          }
  
          //otherwise they are shown the admin area
          else
          {
              echo "&lt;a href=logout.php&gt;Logout&lt;/a&gt;";
          }
      }
  }
  else
      //if the cookie does not exist, they are taken to the login screen
  {
      header("Location: newlogin.php");
  }
  </code></pre>
  
  <p>I want to get rid of:</p>
  
  <pre><code>        else 
  
          { 
  
       echo "&lt;a href=logout.php&gt;Logout&lt;/a&gt;"; 
  
          } 
  </code></pre>
  
  <p>as it messes with my css, I just want the last part of the else statement to work but when i take it out it errors out.</p>
  
  <p>how do I do this??</p>
  
  <p>thanks</p>