0

I want to check whether the same user is logged in more than one locations over different IP and if a user already logged in then the previous session will be destroyed.

Is there any solution on YII framework?

Currently I am trying to develop this project on YII framework.

NoNaMe
  • 6,020
  • 30
  • 82
  • 110
Sanhosh john
  • 103
  • 2
  • 8

3 Answers3

2

you can do like this

  • add a "last_session_ip" column to your userdata table
  • when a user logs in, update its last_session_ip field with its current ip
  • create a function like loginauth() which will compare the current ip with db value . if not same destroy the session

this is not a proper solution but this can put you on right track.

Manoj Dhiman
  • 5,096
  • 6
  • 29
  • 68
0

Without any storage you can't do this. you should use database for logging the log in history and when user log in again, compare the user IP and other things you want by new user which signed in and do what ever you want to that user.

hgh
  • 51
  • 6
-1

Refer this API if you want to store client's locations (Ex: Country, City, ...): checkgeoip.com

Chuyenim
  • 3
  • 1
  • 4