MyBB Community Forums

Full Version: PHP - Stop login if already logged in from elsewhere
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Not MyBB

I have a column in my users table for 'online' which updates every 90 minutes with the last time they were online and it displays it like:

2012-11-22 19:15:18

How would I go about stopping people logging in if that user has been online within the last 90 minutes?

People are currently abusing my system by gaining x10 the legitimate amount of site currency by logging in on multiple PC's / Browsers.

I think MyBB use a similar sort of function but I've never tried multi-logging with the same account on a MyBB forum.

Would anybody know how to do this?

Big Grin

Edit:

There is a function to check if they're online but I don't know if that helps:

/* User Session */
$is_online = (isset($_SESSION['EX_login']) ? true : false);
if(isset($_SESSION['EX_login'])){
    $sql				= $db->Query("SELECT *,UNIX_TIMESTAMP(`online`) AS `online` FROM `users` WHERE (`login`='".$_SESSION['EX_login']."' OR `email`='".$_SESSION['EX_login']."')");
    $data				= $db->FetchArray($sql);
	if($data['id'] == ''){
		session_destroy();
	}elseif($data['online']+90 < time()){
		$db->Query("UPDATE `users` SET `online`=NOW() WHERE `id`='".$data['id']."'");
	}
}
Why should we help you, you do not show the MyBB link at the bottom of your page on your MyBB websites.

"support us, and we'll support you."
(2012-11-22, 04:50 PM)Echo Off Wrote: [ -> ]Why should we help you, you do not show the MyBB link at the bottom of your page on your MyBB websites.

"support us, and we'll support you."

Just because I changed the way the support message shows doesn't mean I'm not showing it.

[Image: fJc1L.png]
(2012-11-22, 04:54 PM)Hostpro Wrote: [ -> ]
(2012-11-22, 04:50 PM)Echo Off Wrote: [ -> ]Why should we help you, you do not show the MyBB link at the bottom of your page on your MyBB websites.

"support us, and we'll support you."

Just because I changed the way the support message shows doesn't mean I'm not showing it.

[Image: fJc1L.png]

The was not there 10 minutes ago, you just put that there since I posted that message.
(2012-11-22, 04:55 PM)Echo Off Wrote: [ -> ]
(2012-11-22, 04:54 PM)Hostpro Wrote: [ -> ]
(2012-11-22, 04:50 PM)Echo Off Wrote: [ -> ]Why should we help you, you do not show the MyBB link at the bottom of your page on your MyBB websites.

"support us, and we'll support you."

Just because I changed the way the support message shows doesn't mean I'm not showing it.

[Image: fJc1L.png]

The was not there 10 minutes ago, you just put that there since I posted that message.

Feel free to use any form of wayback machine and check.
(2012-11-22, 04:55 PM)Hostpro Wrote: [ -> ]
(2012-11-22, 04:55 PM)Echo Off Wrote: [ -> ]
(2012-11-22, 04:54 PM)Hostpro Wrote: [ -> ]
(2012-11-22, 04:50 PM)Echo Off Wrote: [ -> ]Why should we help you, you do not show the MyBB link at the bottom of your page on your MyBB websites.

"support us, and we'll support you."

Just because I changed the way the support message shows doesn't mean I'm not showing it.

[Image: fJc1L.png]

The was not there 10 minutes ago, you just put that there since I posted that message.

Feel free to use any form of wayback machine and check.

Mate, I just pressed the back button a few times and it's not there. I'm not stupid, if it was there, I would not have posted that post in the first place.
(2012-11-22, 04:56 PM)Echo Off Wrote: [ -> ]Mate, I just pressed the back button a few times and it's not there. I'm not stupid, if it was there, I would not have posted that post in the first place.

It's fine to make mistakes dude, just don't keep digging a hole.

Anyway we're getting a bit off topic, back on topic please?
(2012-11-22, 04:58 PM)Echo Off Wrote: [ -> ]http://webcache.googleusercontent.com/se.../index.php

Just to prove.

Awkward.
(2012-11-22, 05:01 PM)Hostpro Wrote: [ -> ]
(2012-11-22, 04:58 PM)Echo Off Wrote: [ -> ]http://webcache.googleusercontent.com/se.../index.php

Just to prove.

Awkward.

Yep. Oh well. These things happen, but remember, the MyBB team put a lot of time and effort in for free, the least you can do is keep the link, even if you just put "MyBB" I'm sure they would be fine with that.
Pages: 1 2