title: PHP login/register system with profile-pages
body: <p>I made some code for a PHP login and register system, the only problem is that when a user logs in his username is just posted (<code>$_POST</code>) on his profile page. So my question is: How do I create a login system that when the user logs in his username is Not displayed but the system see's the username in Mysql and display his real name? sorry for the vague explanation but i don't realy know how to explane.</p>
  
  <p>My code: (for the login form)</p>
  
  <pre><code>    session_start();
      $_SESSION['username'] = $_POST['username'];
  
      $con=mysql_connect("host", "user", "pass");
  
      mysql_select_db("db"); 
  
      $username=$_POST['username']; 
      $password=$_POST['password']; 
  
      $user=mysql_real_escape_string($username); 
      $pass=mysql_real_escape_string($password); 
  
      $query=mysql_query("SELECT * FROM login where 
      username='$user' AND  
      password='$pass' ");  
  
      $count=mysql_num_rows($query); 
      if($count==1)  
          /* $count checks if username and password are in same row */
      { 
  
  
   $hour = time() + 3600;   
      /* $hour sets cookie storage time for 1 hour */
  
      /* setcookie() function sets cookie after login */
   setcookie("username", $username, $hour);  
   setcookie("password", $password, $hour); 
  
   header("");  
      /* header() function redirect user to members page */
  } 
  else
  {  
  print " &lt;link rel=\"stylesheet\" type=\"text/css\" href=\"css/global_profile.css\" /&gt;\n";
  print "&lt;h3&gt;" . "Username or password is incorrect" . "&lt;/h3&gt;"; 
  } 
  </code></pre>