• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hide functions for public


I recently started out with CodeIgniter, and I really like it. It's an powerful framework which makes coding much easier and quicker.

I now have a system up and running, and trying to check some security things.. and what I want is to hide functions for the public, I can dothis with _functionname(){}

But I still want my method to be accessible from the URL, because I have ancors that link to that url. What I get if I go to this url: http://localhost/ci/properties/ I get the error:
Quote:A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Reservation::properties()
Filename: controllers/reservation.php
Line Number: 51
Plus it shows my SQL statement, which is unsafe.

That's because my method properties($id); needs an argument, so if I use this url: /properties/4/ I will get the data.. but I don't want to get that message when someone tries to acces without the ID how can I accomplish this?


function properties($id)
        if(!$this->session->userdata('is_loggedin') && !$this->session->userdata('level') > 2 )

[eluser]Eric Barnes[/eluser]
Why not just change it to something like:
function properties($id = '')
  if ( ! is_numeric($id))

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.