title: Security for a User web application
body: <p>I've been wondering about the security aspect of my application.
  I'm using CodeIgniter PHP Framework for my project.</p>
  
  <p>I'd like to know some "expert" opinions on this.
  I have a login function.
  When a user logged in, the session is store in database. I added information like user Id in the information session.
  A user can create a company. But to do that, I first check his account to see if he already has one. 
  This session user Id allows me to run a DB request to find that out.
  For example :</p>
  
  <pre><code>function create(){
      $hasCompany = $this-&gt;Accountmodel-&gt;hasCompany($this-&gt;session-&gt;userdata('id'));
      if($hasCompany){
          $data['company'] = $this-&gt;Companymodel-&gt;getCompanyInfo($this-&gt;session-&gt;userdata('id');
          $this-&gt;load-&gt;view('company/panel', $data);
      }
      else{
          $this-&gt;load-&gt;view('company/create');
      }
  
  }
  </code></pre>
  
  <p>And then if he has one, I can print the company edit/delete panel.
  It allows me to avoid the use of id parameters in the url like :
  myserver.com/company/edit/[id]</p>
  
  <p>So to get to the point, I was wondering if, in term of security, this is ok or there is some kind of vulnerability.</p>
  
  <p>Any advices are welcome !</p>