title: How to display a user profile pics while the user is logged in php?
body: <p>I have successfully created a form that submits data and a picture of a user into my online folder and the path directory stored in the database.
  My question is this how do I get users to see their picture once they are logged in?</p>
  
  <p>Well Guys thanks for everything but still not getting right here is all my code</p>
  
  <p><strong>Sign Up</strong></p>
  
  <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  #apDiv1 {
      position:absolute;
      width:328px;
      height:216px;
      z-index:1;
      left: 347px;
      top: 111px;
  }
  --&gt;
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="apDiv1"&gt;
  &lt;form method="post" action="logon.php" enctype="multipart/form-data"&gt;
    &lt;table width="332" height="210" border="0"&gt;
      &lt;tr&gt;
        &lt;td width="155"&gt;Email&lt;/td&gt;
        &lt;td width="167"&gt;&lt;input type="text" name="email" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Username&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="username" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Password&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="password"  /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Upload Passport&lt;/td&gt;
        &lt;td&gt;&lt;label&gt;
          &lt;input type="file" name="photo"  /&gt;
        &lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td&gt;&lt;label&gt;
          &lt;input type="submit" name="submit" value="Sign Up" /&gt;
        &lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Logon.php</strong></p>
  
  <pre><code>&lt;?php
  include('connection.php');
  if (!isset($_FILES['photo']['tmp_name'])) {
      echo "";
      }else{
      $file=$_FILES['photo']['tmp_name'];
      $image= addslashes(file_get_contents($_FILES['photo']['tmp_name']));
      $image_name= addslashes($_FILES['photo']['name']);
  
              move_uploaded_file($_FILES["photo"]["tmp_name"],"photos/" . $_FILES["photo"]["name"]);
  
              $email=$_POST['email'];
              $username=$_POST['username'];
              $password=$_POST['password'];
              $photo="photos/" . $_FILES["photo"]["name"];
  
              $save=mysql_query("INSERT INTO info (id, email, user_name, password,  photo) VALUES ('','$email','$username','$password','$photo')");
              /* Redirect visitor to the thank you page */
  echo '&lt;script language="javascript"&gt;alert("Registration Succesful....")&lt;/script&gt;';
  echo '&lt;script language="javascript"&gt;window.location = "index.php"&lt;/script&gt;';
              exit();                 
      }
  ?&gt;
  </code></pre>
  
  <p><strong>Index.php</strong></p>
  
  <pre><code>&lt;?php
  include('login.php'); // Includes Login Script
  ?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  #apDiv1 {
      position:absolute;
      width:391px;
      height:178px;
      z-index:1;
      left: 334px;
      top: 166px;
  }
  #apDiv2 {
      position:absolute;
      width:259px;
      height:115px;
      z-index:1;
      left: 380px;
      top: 137px;
  }
  --&gt;
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="apDiv2"&gt;
  &lt;form method="POST" action=""&gt;
    &lt;table width="260" height="88" border="0"&gt;
      &lt;tr&gt;
        &lt;td width="131"&gt;Username&lt;/td&gt;
        &lt;td width="119"&gt;&lt;label&gt;
          &lt;input type="text" name="username" /&gt;
        &lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Password&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="password" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td&gt;&lt;label&gt;
          &lt;input type="submit" name="submit" value="Submit" /&gt;
        &lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;table width="259" border="0"&gt;
      &lt;tr&gt;
        &lt;td align="center"&gt;&lt;a href="signup.html"&gt;Sign Up&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/form&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>login.php</strong></p>
  
  <pre><code>&lt;?php
  session_start(); // Starting Session
  $error=''; // Variable To Store Error Message
  if (isset($_POST['submit'])) {
  if (empty($_POST['username']) || empty($_POST['password'])) {
  $error = "User ID or Password is invalid";
  }
  else
  {
  // Define $username and $password
  $username=$_POST['username'];
  $password=$_POST['password'];
  // To protect MySQL injection for Security purpose
  $username = stripslashes($username);
  $password = stripslashes($password);
  
  // Establishing Connection with Server by passing server_name, user_id and password as a parameter
  $connection = @mysql_connect("localhost", "root", "");
  // Selecting Database
  $db = mysql_select_db("lesson", $connection);
  // SQL query to fetch information of registerd users and finds user match.
  $query = mysql_query("select * from info where password='$password' AND user_name='$username'", $connection);
  $rows = mysql_num_rows($query);
  if ($rows == 1) {
  $_SESSION['login_user']=$username; // Initializing Session
  header("location: customer_login.php"); // Redirecting To Other Page
  } else {
  $error = "User ID or Password is invalid";
  }
  mysql_close($connection); // Closing Connection
  }
  }
  ?&gt;
  </code></pre>
  
  <p><strong>customer_login.php</strong></p>
  
  <pre><code>&lt;?php
  include('session_connect.php');
  ?&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;style type="text/css"&gt;
  &lt;!--
  #apDiv1 {
      position:absolute;
      width:259px;
      height:173px;
      z-index:1;
      left: 25px;
      top: 92px;
  }
  --&gt;
  &lt;/style&gt;
  &lt;div id="apDiv1"&gt;
    &lt;p&gt;Email: &lt;?php echo $email; ?&gt; &lt;/p&gt;
    &lt;p&gt;Username: &lt;?php echo $username; ?&gt; &lt;/p&gt;
    &lt;p&gt;Password: &lt;?php echo $password; ?&gt; &lt;/p&gt;
    &lt;p&gt;Passport: &lt;?php echo $photo; ?&gt; &lt;/p&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>session_connect.php</strong></p>
  
  <pre><code>&lt;?php
  // Establishing Connection with Server by passing server_name, user_id and password as a parameter
  $connection = @mysql_connect("localhost", "root", "");
  // Selecting Database
  $db = mysql_select_db("lesson", $connection);
  session_start();// Starting Session
  // Storing Session
  $user_check=$_SESSION['login_user'];
  // SQL Query To Fetch Complete Information Of User
  $ses_sql=mysql_query("select * from info where user_name='$user_check'", $connection);
  $row=mysql_fetch_array($ses_sql);
  $login_session =$row['user_name'];
  
      $email = $row['email'];//." ".$row['vLastName'];
      $username = $row['user_name'];
      $password = $row['password'];
      $photo = $row['photo'];
  if(!isset($login_session)){
  mysql_close($connection); // Closing Connection
  header('Location: index.php'); // Redirecting To Home Page
  }
  ?&gt;
  </code></pre>
  
  <p>Instead the above code shows me the pathway in the database i want the actual image to show...thank you</p>