title: Display a comment based on the user name in the PHP login?
body: <p>I have a PHP Login using a flat file (.txt) system with a username and password this is in a file called users.txt and they are in the following layout e.g.</p>
  
  <p>User1||Password1</p>
  
  <p>User2||Password2</p>
  
  <p>User3||Password3</p>
  
  <p>Till now I managed to get users to login based on their username and paswords.</p>
  
  <p>Now I would like a PHP code so that when users login using the above method, a custom comment is displayed based on the username. I would like this in a separate text file, and to be displayed according to how the user logged in e.g.</p>
  
  <p>User1||Hello John, you look great</p>
  
  <p>User2||Don't let the rain spoil your day</p>
  
  <p>User3||Hooray for holidays</p>
  
  <p>So if User1 logs in using his username and password - only they can see their associated comment, and the same for the others.</p>
  
  <p>How can this be done please?</p>
  
  <p>I was thinking of having a code similar to this </p>
  
  <pre><code>$name = $_SESSION["valid_user"]; 
  $comments = $_POST['comments']; 
  $file = file_get_contents("comments.txt"); 
  if(strstr($file, "$name||$comments"))
  </code></pre>