292911
AndreyRa
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 15:06

  • AndreyRa

  • Just popping in

  • Posts: 17

  • Since: 2003/3/16


So. As I also have thought (and even has written on a pair of minutes) - The problem consists that you have incorrectly updated Xoops.
You should use 2.0RC3 script, which number 2 differs step of installation.

I hope, that at you all will turn out. And if still something will get out - write.



292912
robnelle
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 14:54

  • robnelle

  • Just popping in

  • Posts: 14

  • Since: 2003/5/28


Please Help! I installed this hack and now I can't login at all!

Info:
Xoops version 2.03
PHP version 4.3.2
MySQL version 1.3.27 (Unix)


I installed per the given instructions and I get an 'incorrect login' error everytime I or anyone else tries to login to my site. If I use the lost password function I get the new password just fine but It doesn't work. I installed this hack yesterday and all was well. I stayed logged into my account for over 12 hours but then XOOPS logged me out and I couldn't get back in under any account. What could be wrong? This is what my code looks like after I have finished installing the hack:

file include/common.php
}
                }
                if (
$xoopsModule->getVar('hasconfig') == || $xoopsModule->getVar('hascomments') == || $xoopsModule->getVar'hasnotification' ) == 1) {
                        
$xoopsModuleConfig =& $config_handler->getConfigsByCat(0$xoopsModule->getVar('mid'));
                }
        }
                
//Begin: Autologin hack

if ((empty($HTTP_SESSION_VARS['xoopsUserId'])) &&

(!empty(
$HTTP_COOKIE_VARS['al_pass'])&&(!empty($HTTP_COOKIE_VARS['al_uname']))))

{

         
$myts =& MyTextsanitizer::getInstance();

         
$uname=$HTTP_COOKIE_VARS['al_uname'];

         
$pass=trim($HTTP_COOKIE_VARS['al_pass']);

         
$member_handler =& xoops_gethandler('member');

         
$myts =& MyTextsanitizer::getInstance();

         
$user =& $member_handler->loginUser(addslashes($myts->stripSlashesGPC($uname)),

addslashes($myts->stripSlashesGPC($pass)),true);

         if (
$user != false){

           
setcookie('al_pass'$passtime()+86400*100,'/','',0);

           
setcookie('al_uname'addslashes($uname),

time()+86400*100,'/','',0);

           
$user->setVar('last_login'time());

           if (
session_id()==''){session_destroy(); session_start();};

           
$HTTP_SESSION_VARS = array();

           
$HTTP_SESSION_VARS['xoopsUserId'] = $user->getVar('uid');

           
$HTTP_SESSION_VARS['xoopsUserGroups'] = $user->getGroups();

           if (
$xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] !=

'') {

             
setcookie($xoopsConfig['session_name'], session_id(),

time()+$xoopsConfig['session_expire'], '/',  ''0);

             
$HTTP_COOKIE_VARS[$xoopsConfig['session_name']]=session_id();

            }

           
$user_theme $user->getVar('theme');

           if (
in_array($user_theme$xoopsConfig['theme_set_allowed'])) {

             
$HTTP_SESSION_VARS['xoopsUserTheme'] = $user_theme;

            }


          };

         };

//End: Autologin Hack


file kernel/member.php

/* function &loginUser($uname, $pwd)
    {
        $criteria = new CriteriaCompo(new Criteria('uname', $uname));
        $criteria->add(new Criteria('pass', $pwd));
        $user =& $this->_uHandler->getObjects($criteria, false);
        if (!$user || count($user) != 1) {
            return false;
        }
        return $user[0];
    }   */
    //Begin: Autologin hack

    
function &loginUser($uname$pwd$al_login false)

    {

        
$criteria = new CriteriaCompo(new Criteria('uname'$uname));

        if (!
$al_login){$mypwd=md5($pwd);} else {$mypwd=$pwd;};

        
$criteria->add(new Criteria('pass'$mypwd));

        
$user =& $this->_uHandler->getObjects($criteriafalse);

        if (!
$user || count($user) != 1) {

            return 
false;

        }

        return 
$user[0];

    }

//End: Autologin hack


file include/checklogin.php

//
if ($uname == '' || $pass == '') {
        
redirect_header(XOOPS_URL.'/user.php'1_US_INCORRECTLOGIN);
        exit();
}
if (
false != $user) {
//Begin: Autologin hack

        
if

(!empty(
$HTTP_POST_VARS['union_al'])&&($HTTP_POST_VARS['union_al']=='Yes')){

          
setcookie('al_pass'md5($pass),

time()+86400*100,'/','',0);

          
setcookie('al_uname'addslashes($uname),

time()+86400*100,'/','',0);

         };

//End: Autologin hack
        
if (== $user->getVar('level')) {
                
redirect_header(XOOPS_URL.'/index.php'5_US_NOACTTPADM);
                exit();
        }


file user.php

if ($op == 'logout') {
        
$message '';
        
$HTTP_SESSION_VARS = array();
        
session_destroy();
//Begin: Autologin hack

        
setcookie('al_pass'''time()-33600,'/','',0);

        
setcookie('al_uname'''time()-33600,'/','',0);

//End: Autologin hack
        
if ($xoopsConfig['use_mysession'] && $xoopsConfig['session_name'] != '') {
                
setcookie($xoopsConfig['session_name'], ''time()- 3600'/',  ''0);
        }


I think I should let you know that this hack is not the only alteration to the above mentioned files. I also have IBFM and 4images modules installed which also make changes to the common.php, checklogin.php and member.php. I don't know about user.php. I don't know if there may be a possible hack conflict but I thought it wouldn't hurt to mention the other file alterations just in case. I appreciate any help you can give me. If you need me to provide any other info like the complete .php files mentioned above, just let me know.


I am really looking forward to using this wonderful hack! Thanks AndreyRa for creating it and _masi for the wonderful idea!




292913
AndreyRa
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 14:09

  • AndreyRa

  • Just popping in

  • Posts: 17

  • Since: 2003/3/16


Quote:
_masi wrote:
Hmm, I'm sure there is way to use a "secret" cookie style without changing the internal stored format (ie plain login and hashed password). I'll try and think of a method - it'd be on paper cause I'm off to a vacation soon.

I wish you successful rest!

I here have thought. It is possible to add the third parameter - the control sum. Which sense will be in hashing the line basing on the password of the user + a confidential word. I thought that such word cannot be thought up, since a code of script is open. And has then thought up, that this word should become the password of the administrator (i.e. the user with ID = 1). Thus we receive binding to the password of the administrator as a confidential key. Quite reasonable way of protection. Basically, to break it is possible, but not so it is easy. And it is more probable only individual login, by peeping traffic of the client. The given way will protect system first of all from bruteforce of hashes from the widespread passwords.

Well as? Secure enough?

mmm. Administrator can replace the password! It is necessary to search for other binding. But what?

Quote:

And you don't need to change many things to get something configurable. XOOPS provides a quite advanced configuration system. It uses a general table and an OO-API for access. I'll dig up some info for you how to use it.

For this purpose I was necessary to make changes in SQL. I mean it strong structural changes. Such changes can make impossible successful updating of a XOOPS in future. On this they should be brought extremely by development of the new version (I mean in CVS).

Quote:
Epsylon3 wrote:
uhm, oh yea passw is not stored in cookie, only the md5 hash ?

Yes, so. Now I have made changes to the first message where has specified the given feature separately.

And still I have changed a way of storage of a name of the user in an open kind, for user ID.



292914
Epsylon3
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 12:22

  • Epsylon3

  • Just popping in

  • Posts: 1

  • Since: 2002/10/24


uhm, oh yea passw is not stored in cookie, only the md5 hash ?



292915
_masi
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 11:20

  • _masi

  • Just popping in

  • Posts: 19

  • Since: 2003/3/28


Hmm, I'm sure there is way to use a "secret" cookie style without changing the internal stored format (ie plain login and hashed password). I'll try and think of a method - it'd be on paper cause I'm off to a vacation soon.

And you don't need to change many things to get something configurable. XOOPS provides a quite advanced configuration system. It uses a general table and an OO-API for access. I'll dig up some info for you how to use it.



292916
hal_u1
Re: XoopsGallery Fixes.. Recent Comments Link, New Pics Block showing thumbnail, etc...
  • 2003/6/21 9:39

  • hal_u1

  • Just popping in

  • Posts: 5

  • Since: 2003/4/4 8


Hi, Knight!
You said to me?
Quote:
i wonder you solve the problem already ?

I did not solve..
I applied only session.php, so I will try to change the template.



292917
AndreyRa
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 9:17

  • AndreyRa

  • Just popping in

  • Posts: 17

  • Since: 2003/3/16


Quote:
_masi wrote:
A good start and a fine feature. But I have a few issues.

I don't think it is a good idea to store the actual password in the cookie nor it is to send out a simple hashed version of it. Have a look at sourceforge, they use even a hashed/encrypted login plus a special session_persist cookie.

The password stored as md5 hash. Actually the password stored as hash in XOOPS database. There only one security issue - login stored as is. Basically it is possible to add procedure, for additional converting a name in user-id. And perhaps I shall engage in it in the near future.

For paranoiacs it is possible to add additional hashed parameter as IP + secret word. But in that case it can not work for people with dynamic IP's.

As to sessions is it is possible to realize only the profound programming of a core. Such a format of the given forum - it will be simply impossible to describe. I am afraid, that it can be made only in format of official CVS.

Quote:

And of course this feature has to be configurable
A config to turn it on and off and another one to configure the timeout in days.

It will cause change too many parts of XOOPS too.

Quote:

Anyway I'd love to see this in the official XOOPS.

I work just in this direction. Also I hope, that I shall find mutual understanding with developers of Xoops.
In this direction I have laid out the full list of my works here: Some useful hacks.

Quote:

PS: BTW, I posted an ugly autologin hack myself. It's about an auto-login after an auto-approved registration. Perhaps you could integrate this as well, while you're at it

My hack is not dependent from your hack. I personally used yours hack and have received a heap of pleasure. Thank for good idea! And a good and compact code.



292918
_masi
Re: Autologin for Xoops 2.0.x
  • 2003/6/21 8:26

  • _masi

  • Just popping in

  • Posts: 19

  • Since: 2003/3/28


A good start and a fine feature. But I have a few issues.

I don't think it is a good idea to store the actual password in the cookie nor it is to send out a simple hashed version of it. Have a look at sourceforge, they use even a hashed/encrypted login plus a special session_persist cookie.

And of course this feature has to be configurable
A config to turn it on and off and another one to configure the timeout in days.

Anyway I'd love to see this in the official XOOPS.

PS: BTW, I posted an ugly autologin hack myself. It's about an auto-login after an auto-approved registration. Perhaps you could integrate this as well, while you're at it



292919
jctsup1
NewBB Problem?
  • 2003/6/21 7:39

  • jctsup1

  • Not too shy to talk

  • Posts: 146

  • Since: 2002/5/23


When a "anonymous" user browses my forums & then uses the login block to login, the user is sucessully logged in however the following message appears:


Error: Forum not selected


Then the user is taken to the forum home page i.e. /modules/newbb/. I do not have this issue with any other mod.

Happens with ver 2.02 & 2.03. I can reproduce this problem on Windosws systems running IIS 4, 5, 5.1 & 6. I have tried it both with registe_globals on & off with no change in bahavior.
PHP Version : 4.3.2 Any ideas?



292920
knight
Re: XoopsGallery Fixes.. Recent Comments Link, New Pics Block showing thumbnail, etc...
  • 2003/6/21 7:30

  • knight

  • Just popping in

  • Posts: 29

  • Since: 2002/12/29


i wonder you solve the problem already ?
facing same problem, i just remove the
width="<{$image.width}>" height="<{$image.height}>" from the template and the pic is showing now...

anyway thanx for this patch







Login

Who's Online

138 user(s) are online (99 user(s) are browsing Support Forums)


Members: 0


Guests: 138


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits