title: php login works on XAMPP but not web server?
body: <p>I am trying to add a simple login to a website and had it working perfectly on my localhost XAMPP server but now when uploaded to my website I am able to register new users but when I go to login the page just goes blank.</p>
  
  <pre><code> &lt;?php
  $error = '';
  if (isset($_POST['login'])) {
      session_start();
      $username = trim($_POST['username']);
      $password = trim($_POST['pwd']);
      // location to redirect on success
      $redirect = './adminArea_db.php';
      require_once('./includes/authenticate_pdo.inc.php');
  }
  ?&gt;
   &lt;!DOCTYPE HTML&gt;
   &lt;html&gt;
   &lt;link href="css/screen.css" rel="stylesheet" media="screen" /&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Login&lt;/title&gt;
  &lt;/head&gt;
  
   &lt;body&gt;
   &lt;div id="main"&gt;
  &lt;?php
   if ($error) {
   echo "&lt;p&gt;$error&lt;/p&gt;";
   } elseif (isset($_GET['expired'])) { 
  ?&gt;
   &lt;p&gt;Your session has expired. Please log in again.&lt;/p&gt;
   &lt;?php } ?&gt;
   &lt;form id="form1" method="post" action=""&gt;
     &lt;p&gt;
      &lt;label for="username"&gt;Username:&lt;/label&gt;
      &lt;input type="text" name="username" id="username" value=""&gt;
      &lt;/p&gt;
       &lt;p&gt;
      &lt;label for="pwd"&gt;Password:&lt;/label&gt;
      &lt;input type="password" name="pwd" id="pwd"&gt;
       &lt;/p&gt;
       &lt;p&gt;
      &lt;input name="login" type="submit" id="login" value="Log in"&gt;
     &lt;/p&gt;
      &lt;/form&gt;
     &lt;/div&gt;
       &lt;/body&gt; 
      &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Found some errors in my error_log, not sure if useful?</p>
  
  <pre><code>[11-Feb-2014 20:48:52 Europe/London] PHP Warning:  session_start()   [&lt;ahref='function.session-start'&gt;function.session-start&lt;/a&gt;]: Cannot send session cookie - headers already sent by (output started at /home/georgepa/public_html/login_db.php:2) in /home/georgepa/public_html/login_db.php on line 6
  [11-Feb-2014 20:48:52 Europe/London] PHP Warning:  session_start() [&lt;a href='function.session-start'&gt;function.session-start&lt;/a&gt;]: Cannot send session cache limiter - headers already sent (output started at /home/georgepa/public_html/login_db.php:2) in /home/georgepa/public_html/login_db.php on line 6
  [11-Feb-2014 20:48:52 Europe/London] PHP Warning:  session_regenerate_id() [&lt;a href='function.session-regenerate-id'&gt;function.session-regenerate-id&lt;/a&gt;]: Cannot regenerate session id - headers already sent in /home/georgepa/public_html/includes/authenticate_pdo.inc.php on line 28
  [11-Feb-2014 20:48:52 Europe/London] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/georgepa/public_html/login_db.php:2) in /home/georgepa/public_html/includes/authenticate_pdo.inc.php on line 29
  </code></pre>
  
  <p>Think there is a problem with my authenticate_pdo.inc.php file...</p>
  
  <pre><code>  &lt;?php
     require_once('./includes/connection.inc.php');
     $conn = dbConnect();
      // get the username's details from the database
      $sql = 'SELECT salt, pwd FROM users WHERE username = :username';
      // prepare statement
       $stmt = $conn-&gt;prepare($sql);
       // bind the input parameter
       $stmt-&gt;bindParam(':username', $username, PDO::PARAM_STR);
       // bind the result, using a new variable for the password
        $stmt-&gt;bindColumn(1, $salt);
       $stmt-&gt;bindColumn(2, $storedPwd);
         try{
         $stmt-&gt;execute();
         $stmt-&gt;fetch();
        }catch(PDOException $e){
         exit('problem reading from table users'.$e-&gt;getMessage());
        }
  
         dbClose($conn) ;
         // encrypt the submitted password with the salt and compare with stored password
         if (sha1($password . $salt) == $storedPwd) {
          $_SESSION['authenticated'] = 'admin'; // role of authenticated user
           $_SESSION['username']=$username;
           // get the time the session started
           $_SESSION['start'] = time();
           session_regenerate_id();
           header("Location: $redirect");
           exit;
          } else {
          // if no match, prepare error message
           $error = 'Invalid username or password';
          } 
        ?&gt;
  </code></pre>