php - redirecting user to another page using header() -


i've looked everywhere , tried solutions it's still not getting me anywhere. here's code:

<?php if(!empty($_session['loggedin']) && !empty($_session['username']))  {     header('location: /public_html/index.php');   exit;  } elseif(!empty($_post['username']) && !empty($_post['password'])) {     $username = mysql_real_escape_string($_post['username']);     $password = md5(mysql_real_escape_string($_post['password']));      $checklogin = mysql_query("select * users username = '".$username."' , password = '".$password."'");      if(mysql_num_rows($checklogin) == 1)     {         $row = mysql_fetch_array($checklogin);         $email = $row['emailaddress'];          $_session['username'] = $username;         $_session['emailaddress'] = $email;         $_session['loggedin'] = 1;          header('location: /public_html/index.php');         exit;     }     else     {         echo "<h1>error</h1>";         echo "<p>sorry, account not found. please <a href=\"index.php\">click here try again</a>.</p>";     } }      ?> 

when upload server , login brings me blank php page. doing wrong code? i've tried using " instead of ' . i'm trying redirect user page outside of folder hence "/public_html/". appreciated.

if outside folder use

header("location:../public_html/index.php"); 

Comments