Welcome Guest, Not a member yet? Register   Sign In
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.




Theme © iAndrew 2016 - Forum software by © MyBB