CodeIgniter Forums
Tank Auth v1.0 (CI authentication library) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Tank Auth v1.0 (CI authentication library) (/showthread.php?tid=17515)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45


Tank Auth v1.0 (CI authentication library) - El Forum - 02-16-2010

[eluser]Agung Wahyudiono[/eluser]
Ihave a problem when using Tank Auth.
When my code running on XAMPP server, everething is O.K including Authentication using tank Auth.
But When i run my code under my ubuntu server, Tank Auth cannot pass the authnetication.
I'dont know what the trouble....
Please help me...


Tank Auth v1.0 (CI authentication library) - El Forum - 02-17-2010

[eluser]rip_pit[/eluser]
Never tried under linux at home but i hosted a CI projet with TA auth on a linux server (unix ?) and all went fine.

Did you look in your apache error logs ? and php error logs ? sure you'll find some info there.
Let us know if you find something. Maybe your apache or PHP needs mods or settings enabled manually under linux.

can you clarify when does your TA not working ? when you press "login" ? what happens ?


Tank Auth v1.0 (CI authentication library) - El Forum - 02-19-2010

[eluser]bondjp[/eluser]
Hi guys,
I'm trying to add fields to user_profiles table but i'm having trouble doing it.
When i insert the 'firstname' and 'lastname' i get 2 records in the user_profiles table.
One record is id='1' user_id='1' firstname=Blank lastname=Blank
Second record id='2' user_id='0' firstname='Bob' lastname='Warner'

Here's the part where i insert the values:

Code:
if ($this->form_validation->run()) {                                // validation ok
            if (!is_null($data = $this->tank_auth->create_user(
        $use_username ? $this->form_validation->set_value('username') : '',
            $this->form_validation->set_value('email'),
        $this->form_validation->set_value('password'),
        $email_activation))) {                                    // success
                        $firstname=$this->form_validation->set_value('firstname');
$lastname=$this->form_validation->set_value('lastname');
$userprofile = array('firstname' => $firstname,'lastname' => $lastname);
$this->db->insert('user_profiles', $userprofile);

I appreciate any help.
Thanks.


Tank Auth v1.0 (CI authentication library) - El Forum - 02-19-2010

[eluser]bondjp[/eluser]
Ok just found the solution by putting this last code instead.

Code:
$user_id=mysql_insert_id();
$this->db->where('id', $user_id);
$this->db->update('user_profiles', $userprofile);



Tank Auth v1.0 (CI authentication library) - El Forum - 02-19-2010

[eluser]xmonader[/eluser]
Hi, thanks for Tank Auth.

I'm having some troubles starting with Tank Auth.

Steps:
1- Downloaded CodeIgniter 1.7.2
2- Downloaded/Followed the installation instructions: Tank Auth: http://konyukhov.com/soft/tank_auth/

Error:
Quote:
An Error Was Encountered

Unable to locate the model you have specified: users

Code:
[xmonader@localhost application]$ tree models/
models/
├── index.html
└── tank_auth
    ├── login_attempts.php
    ├── user_autologin.php
    └── users.php

--Checking the models loaded in application/libraries/Tank_auth
Code:
$this->ci->load->model('tank_auth/users');
which seems to be okay for CodeIgniter "Loading models"


Tank Auth v1.0 (CI authentication library) - El Forum - 02-20-2010

[eluser]xmonader[/eluser]
Doing some tracking to Loader.php/model
I found the main problem is
Code:
if ( ! file_exists(APPPATH.'models/'.$path.$model.EXT))
which is always True --
Code:
$ php -v
PHP 5.3.1 (cli) (built: Nov 20 2009 12:52:06)
Copyright (c) 1997-2009 The PHP Group



Tank Auth v1.0 (CI authentication library) - El Forum - 02-20-2010

[eluser]bogdan3l[/eluser]
Hello!

I have a stupid question Smile and i need some opinions!!!

The counting of login attempts will work the same if someone have an ipv6 ip address?

*(with the actual table (ip_address = varchar(40))*
*(the same as ipv6)*

Thank you!


Tank Auth v1.0 (CI authentication library) - El Forum - 02-21-2010

[eluser]Unknown[/eluser]
I'm having some really annoying problems adding a new field to the user table. I added the field "security_level" and wrote a new function in the tank_auth.php model that returns the security level:

Code:
function get_security_level()
{
   return $this->ci->session->userdata('security_level');
}

However when I try to use this function I get a null value, usually. It works right after I log in, but after that it stops working. I added an additional line to the login() function in the model that adds in the security level value into the session data just like the username and status are:

Code:
$this->ci->session->set_userdata(array(
    'user_id'    => $user->id,
    'username'    => $user->username,
    'security_level' => $user->security_level,
    'status'    => ($user->activated == 1) ? STATUS_ACTIVATED : STATUS_NOT_ACTIVATED,
));

I had to add the field user_data to my ci_sessions table to make this library work and when I view its contents I see that more often than not the user_data is set to NULL instead of something useful. Making me pull my hair out!

Edit: Oh, and I'm using this code to try to make an "admin" area for those of sufficient security levels:

Code:
echo "Username: " . $this->tank_auth->get_username() . "<br>";
echo "Security level: " . $this->tank_auth->get_security_level() . "<br>";

if($this->tank_auth->is_logged_in() && !is_null($this->tank_auth->get_security_level())) {
    if($this->tank_auth->get_security_level() < 2) {
        echo "You're welcome here";
    } else {
        echo 'You are NOT welcome here';
    }
} else {
    echo "Please login";
}

For the first time after a user logs in this script outputs a security level number just fine, but refreshing the page shows that the security level value is turned into null.


Tank Auth v1.0 (CI authentication library) - El Forum - 02-22-2010

[eluser]rip_pit[/eluser]
lol, it works just fine here.

i did copy/paste your code + adding the new field in user table
(I add all the new code in : \system\application\libraries\Tank_auth.php)


And refreshing or changing page then come back to index, the level is always ok.

It seems a session problem, here's my config if it can help
Code:
//config/config.php :
$config['sess_cookie_name']          = 'ci_session';
$config['sess_expiration']          = 7200;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']      = FALSE;
$config['sess_table_name']          = 'ci_sessions';
$config['sess_match_ip']            = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

let us know


Tank Auth v1.0 (CI authentication library) - El Forum - 02-26-2010

[eluser]stml[/eluser]
Hi there - anyone know about how to ban users under Tank Auth? The documentation mentions banning users by name and IP - but says this is optional.

I can't find how to do this in the code...

I also have another query about adding fields to the user table - if you can help, please have a look at this thread here. Thanks.