Welcome Guest, Not a member yet? Register   Sign In
Controllers
#1

[eluser]marcin346[/eluser]
Hello. I'm new 'coder' form Poland.
How can I use function from controller A in controller B ?
For example:
site.php:
...........
...........
...........
function check_login()
{
IF($cookie = $this->input->cookie('cicookie', True))
{
$dane = unserialize(base64_decode($cookie));
IF(is_array($dane))
{
$a = $this->User;
$b = $a->get_user_by_login($dane['user']);
$ar = $b->result_array();
IF(isset($ar[0]) and $ar[0]['user_last_login_ip'] == $this->input->ip_address() and sha1(md5($ar[0]['user_login'].$ar[0]['user_password'])) == $dane['pass'])
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
...................................................
...................................................

add_news.php:

..........................
..........................
function add()
{
check_login();
......................
....................
....................
......................
}
...................................
...............................
...........................
#2

[eluser]gyo[/eluser]
Give a look at this library: Wick

...and welcome! Wink
#3

[eluser]marcin346[/eluser]
Thank you for fast reply also I'm sorry for my bad language.
It's useful library.
Thanks a lot!




Theme © iAndrew 2016 - Forum software by © MyBB