Zubrag.com
May 22, 2012, 08:10:28 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Restrict login / Do not allow multiple login per user  (Read 1761 times)
lx
Newbie
*
Posts: 2


« on: May 25, 2010, 05:57:01 pm »

Hi all,
I'm successfully using the great script but wonder how I can restrict it to restrict user login?

I don't want to allow users from different workstations to access with the same user/pass, since the system behind the login is quite complex and rather useful for one dedicated login.

Thanks.

Cheers.  Wink

Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #1 on: May 26, 2010, 01:36:25 am »

Do you want to tie login to IP? If yes, then

before this line
$LOGIN_INFORMATION = array(

insert this map of user IPs (update list to match your user ips)
$IPS = array(
  'user1' => '123.456.789.012',
  'user2' => '45.234.245.134'
);
function getUserIP() {
    if (isset($_SERVER['HTTP_X_FORWARD_FOR']) && $_SERVER['HTTP_X_FORWARD_FOR']) {
        return $_SERVER['HTTP_X_FORWARD_FOR'];
    } else {
        return $_SERVER['REMOTE_ADDR'];
    }
}


also find this code
|| (USE_USERNAME && ( !array_key_exists($login, $LOGIN_INFORMATION) || $LOGIN_INFORMATION[$login] != $pass ) )

and insert this code after it, or place this code into next line
|| $IPS[$login] !== getUserIP()


also find this code
if ($_COOKIE['verify'] == md5($lp)) {

and replace with this code
if (($_COOKIE['verify'] == md5($lp)) && ($IPS[$key] == getUserIP())) {

script will check user ip in addition to login/password. If user is under proxy - it will check proxy ip.
Logged
lx
Newbie
*
Posts: 2


« Reply #2 on: June 02, 2010, 11:12:28 am »

Hi zubrag,

That's kind of what I was looking for. Thanks for this, I'll have a go with it and try to make it work for the site.
Actuall I need to find a way how to grab a local IP because I need restrictions for that and also global IPs e.g. from ISP.

LX
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC