title: Class design of object oriented login system in php
body: <p>I've started to improve my OOP skills, by solving some rather easier issues, when building a website. So it started with a login system, i have followed a tutorial on youtube, that helped me made a Login class, but as it went on, it raised many doubts (btw. The code is 100 lines so i'll pass on pasting it).</p>
  
  <p>So in this Login class, there are verification methods etc. but it comes to a point where there's session verification, that with given before parameteres in construct, it can't be used (atleast in this class scope):</p>
  
  <pre><code>    $this-&gt;_username = ($this-&gt;_login)? $this-&gt;filter($_POST['username']) : $_SESSION['username'];
      $this-&gt;_password = ($this-&gt;_login)? $this-&gt;filter($_POST['password']) : '';
      $this-&gt;_passmd5 = ($this-&gt;_login)? md5($this-&gt;_password) : $_SESSION['password'];
  </code></pre>
  
  <p>So in that case i cannot use the verifySession() method, when there are no session variables set (to distinct what logged user should see on main page for example).</p>
  
  <p>So my question is - is that design correct, and how should i build rest of the login system: loggedIn verification on every page and logging out - should each one of them be in seperate class (and what about methods, that repeat in particular class, should i always inherit them). I realise that there are different approaches to OOP, but is there any particular, that i should follow as a beginner (that will help me understand oop to the best of it).</p>