thanks, now it works!
the unreadable font was exactly the problem!!!
http://www.loyalma.com
major in lady’s products(lingerie,uniform,adults products,shoes)
high quality,lowest prices,and free shipment,quick to order!
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
April 07, 2009 12:13pm
Subscribe [192]#406 / Jul 09, 2011 6:35am
thanks, now it works!
the unreadable font was exactly the problem!!!
http://www.loyalma.com
major in lady’s products(lingerie,uniform,adults products,shoes)
high quality,lowest prices,and free shipment,quick to order!
#407 / Jul 10, 2011 9:52am
I use CodeIgniter + Tank Auth. “/auth/forgot_password” doesn’t work. The result always is: “Your activation key is incorrect or expired. Please check your email again and follow the instructions.”
The registration and activation are all right.
Make sure you are setting the correct time zone in php.ini (eg: date.timezone = Europe/London)
If not the db query always return false because of mysql & php unix timestamp is different when comparing expire time.
#408 / Jul 17, 2011 5:01pm
When retrieving a user’s id, shouldn’t it be converted to an int?
For example I’m doing this.
$user_id = (int) $this->tank_auth->get_user_id();Would that be recommended?
#409 / Jul 17, 2011 5:27pm
When retrieving a user’s id, shouldn’t it be converted to an int?
For example I’m doing this.
$user_id = (int) $this->tank_auth->get_user_id();Would that be recommended?
Since php is loosely typed, I would say that it is not necessary unless you want to check for value + type (== vs ===) somewhere else in your code.
ex:
$int_id = 1;
$str_id = '1';
echo ($int_id == $str_id); // true
echo ($int_id === $str_id); // false, one is an int the other is a stringI hope I didn’t say something you know already.
#410 / Jul 18, 2011 12:04pm
Hello,
I added a basic user level support in this way:
Added a field in the ‘users’-table in MySQL
—————————————————————-
field:user_level
type:tinyint(16)
attr:UNSIGNED
Null:No
Default:0
in the Tank_auth.php - library I changed this:
around line 71:
$this->ci->session->set_userdata(array(
'user_id' => $user->id,
'username' => $user->username,
'status' => ($user->activated == 1) ? STATUS_ACTIVATED : STATUS_NOT_ACTIVATED,
));into this :
$this->ci->session->set_userdata(array(
'user_id' => $user->id,
'username' => $user->username,
'userlevel' => $user->user_level,
'status' => ($user->activated == 1) ? STATUS_ACTIVATED : STATUS_NOT_ACTIVATED,
));
And around line 587:
$this->ci->session->set_userdata(array(
'user_id' => $user->id,
'username' => $user->username,
'status' => STATUS_ACTIVATED,
));into this:
$this->ci->session->set_userdata(array(
'user_id' => $user->id,
'username' => $user->username,
'userlevel' => $user->user_level,
'status' => STATUS_ACTIVATED,
));and somewhere around line 155 (after get_username()-function) I added these 2 functions:
/**
* Get userlevel
*
* @return string
*/
function get_userlevel()
{
return $this->ci->session->userdata('userlevel');
}
/**
* Validate userlevel
*
* @return bool
*/
function validate_userlevel($level = 0)
{
if($this->ci->session->userdata('userlevel') >= $level)
{
return TRUE;
}
return FALSE;
}
Usage in your controllers:
To get the users level:
$data['user_id'] = $this->tank_auth->get_user_id();
$data['username'] = $this->tank_auth->get_username();
$data['userlevel'] = $this->tank_auth->get_userlevel();
$this->load->view('welcome', $data);To validate the userlevel:
if($this->tank_auth->validate_userlevel(1))
{
// show or do something…
}The validation is simple:
a standard user gets level 0, every higher level is allowed to see the lower levels.
So if you create an admin user and give it level 9, you have 10 levels. But you can make it as high as you want.
In the example code level 0 is blocked and level 1 and up are granted access.
#411 / Jul 23, 2011 6:39am
Hi all,
I have this small warning in my app. Can anyone help me to find the solution for this?
A PHP Error was encountered
Severity: Warning
Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead
Filename: tank_auth/users.php
Line Number: 335All help reaaly appreciated!
Michel
#412 / Jul 27, 2011 11:29pm
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:
An Error Was EncounteredUnable to locate the model you have specified: users
[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
$this->ci->load->model('tank_auth/users');which seems to be okay for CodeIgniter “Loading models”
So how to resolve this? Or, where is the answer? i need it, i got this same trouble too, please.
#413 / Jul 28, 2011 1:21pm
@gangstar, it should work unless you placed the Tankauth files in wrong locations or did not follow instructions properly. Make sure as well that you have a recent version of Codeigniter.
#414 / Jul 28, 2011 5:53pm
Hi there. Let me start out by saying that Tank Auth works amazingly, my question is surely a matter of just being a novice. I currently have Tank Auth setup so my clients can login and it will redirect them to their view which requires a user to be logged on. Their secret files however, are all grouped in a main client folder outside codeigniter (css, .js, and images) which anyone with half a brain could easily get to, and I don’t want to force the user to login twice, once through TankAuth and another through .htpasswd. I would like to allow access to these files only if the user has logged in, is there anyway to do this with .htpasswd? I can’t figure it out. Have any suggestions that may guide me in the right direction?
#415 / Jul 28, 2011 10:53pm
@gangstar, it should work unless you placed the Tankauth files in wrong locations or did not follow instructions properly. Make sure as well that you have a recent version of Codeigniter.
yups… thanks. its work now… i havent set right permission yet. now, it worked like a charm after i set it 775 or 777.
#416 / Jul 28, 2011 10:54pm
@gangstar, it should work unless you placed the Tankauth files in wrong locations or did not follow instructions properly. Make sure as well that you have a recent version of Codeigniter.
yups… thanks. its work now… i havent set right permission yet. now, it worked like a charm after i set it 775 or 777.
it’s also resolve captcha problem, when it had not been displayed. thanks.
#417 / Jul 29, 2011 6:38pm
Does
$this->tank_auth->get_user_id()return an integer? For cheking if a user id matches is it secure to use
if ($var == $this->tank_auth->get_user_id())or
if ($var === $this->tank_auth->get_user_id())?
#418 / Jul 30, 2011 9:10pm
i think it’s more on questioning in php programming rather than how to using code igniter. :long:
you can ask this on php forum discussing about programming in php especially.
#419 / Jul 31, 2011 4:41am
U R welcome Please let me know if you’ll have any problem with the library
#420 / Aug 03, 2011 3:44pm
I perform many queries based on a user’s id. I’m concerned about security, namely users changing their user id. When using library functions like
$this->tank_auth->get_user_id()does it check if the password used to log in matches the one in the database for the respective user? I searched the files but couldn’t find a where clause for this.