• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
block access to a function

#1
[eluser]pam81[/eluser]
Hi all,
I'm making a typical class call user so there is a function register where you get the register's form wich could be access like www.mysyte.com/user/register

Code:
function register()
  {
  
   $this->load->view("header");
   $this->load->view("register");
   $this->load->view("footer");
  }

but there is another function add wich is call from the form to insert the user but I don't wanna somebody access like www.mysite.com/user/add because this only must be called from the register's form.

There is a way to prevent this kind of access?

Thanks in advance

#2
[eluser]minhbu[/eluser]
function _add()
{
//your code here
}

if you want to use above function
$this->_add();

#3
[eluser]n0xie[/eluser]
[quote author="pam81" date="1275995035"]but there is another function add wich is call from the form to insert the user but I don't wanna somebody access like www.mysite.com/user/add because this only must be called from the register's form.
[/quote]
Do you mean you want to POST to /user/add from the register form? In that case no, you can't block access. The only thing to do is to check in your add function if there is POST data available.

#4
[eluser]Clooner[/eluser]
Or check the referrer using the User Agent Class

#5
[eluser]pam81[/eluser]
Ok thanks a lot!! I think to check POST is which i would try because the referer could by but only if somebody try to access from another site.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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