xoops forums


Just popping in
Posted on: 2007/11/8 19:48
diegoflash (Show more)
Just popping in
Posts: 1
Since: 2007/11/8

Double User / Login

Hi everybody,

Sorry about my English...But I´ll Try explain my problem and i hope someone help me.

I can login with one user "test" in my site, but if a try login agina, i can.There are multiple sessions conections.

I want to limit form one user.

If this user was loged,he won´t get login.

I edited include/checklogin.php file end I did some changes.

if (!defined('XOOPS_ROOT_PATH')) {
include_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php';
$uname = !isset($_POST['uname']) ? '' : trim($_POST['uname']);
$pass = !isset($_POST['pass']) ? '' : trim($_POST['pass']);
if ($uname == '' || $pass == '') {
redirect_header(XOOPS_URL.'/user.php', 1, _US_INCORRECTLOGIN);
$member_handler =& xoops_gethandler('member');
$myts =& MyTextsanitizer::getInstance();
$user =& $member_handler->loginUser($myts->addSlashes($uname), $myts->addSlashes($pass));
if (false != $user) {
if (0 == $user->getVar('level')) {
redirect_header(XOOPS_URL.'/index.php', 5, _US_NOACTTPADM);

After this cod, I put this hack.


$query = $xoopsDB->queryF('SELECT * FROM '.$xoopsDB->prefix('online').' WHERE online_uname="'.$uname.'"');
$total = $xoopsDB->getRowsNum($query);
if ($user->getVar('uid')!='1'){
if ($total){
$msg = 'Desculpe '.$uname.' mas não foi possível efetuar o login no site!! <br />
<p align="left" style="color:red;">
Possíveis causas:<br />
- Você já está logado no site.<br />
- Alguém logou no site utilizando seu nome de usuário e senha.<br />
- Você saiu do site ou fechou a janela do navegador sem clicar no link de logout.<br />
Aguarde alguns minutos e tente novamente. Caso o problema persista entre em contato conosco através do formulário de contato clicando
<a href="'.XOOPS_URL.'/modules/contact/">aqui</a>.';
redirect_header(XOOPS_URL.'/index.php', 12, $msg);

But, doesn´t work.I don´t know why.

Someone, help me plz ?

thanks !!!


Just can't stay away
Posted on: 2007/11/8 20:25
svaha (Show more)
Just can't stay away
Posts: 896
Since: 2003/8/2 2

Re: Double User / Login

Preventing multilogins by the same user is an option in XOOPS exm/xm, but I don't know where they implemented this code.