Yii Framework Forum: [EXTENSION]Extended Database Session Class - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION]Extended Database Session Class Additional checks on Full IP/Partial IP and/or User Agent Rate Topic: -----

#1 User is offline   twisted1919 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 643
  • Joined: 23-October 10
  • Location:Romania

Posted 09 January 2011 - 09:17 AM

Because i needed some extra functionality for the DB session class, i created a new extension which does some extra security checks on the user ip and user agent.

The extension can be found here: http://www.yiiframew...ension/session/

Basically, the class extends CDbHttpSession and adds 3 new properties,
1)compareIpBlocks- (integer) How many blocks from the ip address should be compared (defaults to 0). It has an effect only if the value is > 0 and compareIpAddress is set to true.
2)compareIpAddress - (boolean) If the client ip should be checked.  
3)compareUserAgent - (boolean) If the User Agent should be checked. It will check the first 50 chars from the user agent;


So, you can check for a full ip address and/or user agent against the data from database.
Also, you can do a partial lookup on the ip address, matching 1/2/3 ip blocks, this is useful when the users have dynamic ip addresses and you don't want to log them out when the ip changes.

Anyway, you need to test the extension to see how it works.
I tested it and i found no bug, but any feedback is appreciated.
0

#2 User is offline   twisted1919 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 643
  • Joined: 23-October 10
  • Location:Romania

Posted 09 January 2011 - 10:36 AM

Updated to 1.1
0

#3 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 645
  • Joined: 29-November 08
  • Location:Paris, France

Posted 09 January 2011 - 10:44 AM

already ? Posted Image ... ok, I'll download it again Posted Image
0

#4 User is offline   twisted1919 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 643
  • Joined: 23-October 10
  • Location:Romania

Posted 09 January 2011 - 11:10 AM

Yes, see the changelog, i made some improvements after reading on php.net about ip2long .
0

#5 User is offline   twisted1919 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 643
  • Joined: 23-October 10
  • Location:Romania

Posted 18 January 2011 - 06:57 AM

Updated to 1.3, please see: http://www.yiiframew...ension/session/

Version 1.2 introduced a small bug, so updating to 1.3 is recommended if you have 1.2 installed.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users