Jump to content


* * * * * 1 votes

IP.Board 2.3: Auto-login to ACP


  • Please log in to reply
17 replies to this topic

#1 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 13 June 2008 - 07:36 PM

This is the support topic for the tutorial Auto-login to ACP.  Please post here if you have any questions or feedback.

#2 Schranzer

Schranzer

    Dr Gonzo

  • Banned
  • PipPipPipPipPip
  • 173 posts
  • Location:Germany
  • Real Name:Jerome McLane
  • IPB Version:v2.3.x
Contributor

Posted 15 June 2008 - 12:42 PM

THANK YOU MICHAEL!!!
Nice Idea ;)

#3 manHa

manHa

    Damnn.

  • Members
  • PipPipPipPipPip
  • 186 posts
  • IPB Version:v2.3.x
Contributor

Posted 20 June 2008 - 03:40 AM

Thank you very much Micheal ;)

#4 Adriano Faria

Adriano Faria

    ...a curious guy...

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 3,268 posts
  • Location:Brazil
  • Real Name:Adriano
  • IPB Version:v3.3.x
Contributor

Posted 20 June 2008 - 10:39 AM

It's interesting but some things didn't work such as Edit Member, SQL Toolbox... ;)

#5 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 20 June 2008 - 11:46 AM

Yeah, I found that out too, since you're not actually 'logged in' you don't have any root admin priveleges.
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#6 Adriano Faria

Adriano Faria

    ...a curious guy...

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 3,268 posts
  • Location:Brazil
  • Real Name:Adriano
  • IPB Version:v3.3.x
Contributor

Posted 20 June 2008 - 12:36 PM

View PostMichael, on Jun 20 2008, 08:46 AM, said:

Yeah, I found that out too, since you're not actually 'logged in' you don't have any root admin priveleges.
Exacly! ;)

#7 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 20 June 2008 - 01:24 PM

View PostMichael, on Jun 20 2008, 01:46 PM, said:

Yeah, I found that out too, since you're not actually 'logged in' you don't have any root admin priveleges.
How about adding the "function" that creates and inserts the adsess below the function that's commented out in admin.php?

#8 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 20 July 2008 - 01:07 AM

I just discovered another problem with this tutorial.

While in settings, the root admin will be removed from all group listings. It just caused me 30minutes of head scratching until I thought about this little edit that I did.

#9 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 20 July 2008 - 01:09 AM

I should probably just trash this then.
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#10 GaryK

GaryK

    Coder

  • IM Supporters
  • PipPipPipPipPip
  • 123 posts
  • Location:Miami, FL
  • Real Name:Gary Keith
  • IPB Version:v2.3.x
Contributor

Posted 20 July 2008 - 01:26 AM

Perhaps instead of trashing this mod you could simply change it so that you can easily add/remove some hard-coding in the appropriate file such that the login name (or e-mail) and password form fields are automatically populated and a submit is simulated via JavaScript?

Edited by GaryK, 20 July 2008 - 01:28 AM.

Alright! I know I'm in there! If I don't come out, I'll have to come in after me!

#11 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 20 July 2008 - 01:34 AM

Or just add this piece of code above the code found in tutorial.

if( ! $ipsclass->input['adsess'] )
{
	$ipsclass->DB->build_query( array( 'select'   => 'm.*',
										 'from'	 => array( 'members' => 'm' ),
										 'where'	=> 'm.id='.intval($_COOKIE[$ipsclass->vars['cookie_id'].'member_id']),
										 'add_join' => array( 0 => array(
																		  'select' => 'g.*',
																		  'from'   => array( 'groups' => 'g' ),
																		  'where'  => 'g.g_id=m.mgroup',
																		  'type'   => 'left' ),
															 1 => array(
																		  'select' => 'p.*',
																		  'from'   => array( 'admin_permission_rows' => 'p' ),
																		  'where'  => 'm.id=p.row_member_id',
																		  'type'   => 'left' )
															)
								)	 );
											 
	$ipsclass->DB->exec_query();

	$mem = $ipsclass->DB->fetch_row();

	$ipsclass->sess->member = $mem;
	$ipsclass->sess->build_group_permissions();
	$mem = $ipsclass->sess->member;
	
	if ( $mem['g_access_cp'] != 1 )
	{
		die( "You do not have access to the administrative CP" );
	}
	else
	{
		$extra_query = "";
			
		if ( $_POST['qstring'] )
		{
			$extra_query = urldecode( $_POST['qstring'] );
			$extra_query = str_replace( "{$ipsclass->vars['board_url']}"		   , "" , $extra_query );
			$extra_query = preg_replace( "!/?admin\.{$ipsclass->vars['php_ext']}!i", "" , $extra_query );
			$extra_query = preg_replace( "!^\?!"										 , "" , $extra_query );
			$extra_query = preg_replace( "!adsess=(\w){32}!"							 , "" , $extra_query );
			$extra_query = preg_replace( "!s=(\w){32}!"								  , "" , $extra_query );
			$extra_query = preg_replace( "!act=login!"								   , "" , $extra_query );
			$extra_query = preg_replace( "!code=template-edit-bit!"					  , "" , $extra_query );
			$extra_query = preg_replace( "!code=template-bits-list!"					 , "" , $extra_query );
			$extra_query = preg_replace( "!bitname=(\w)!"								 , "" , $extra_query );
			$extra_query = $ipsclass->parse_clean_value( $extra_query );
		}
		
		$ipsclass->DB->do_delete( 'admin_sessions', 'session_member_id='.$mem['id'] );
		$sess_id = md5( uniqid( microtime() ) );
				
		$ipsclass->DB->do_insert( 'admin_sessions', array (
															   'session_id'				=> $sess_id,
															   'session_ip_address'		=> $ipsclass->ip_address,
															   'session_member_name'	   => $mem['name'],
															   'session_member_id'		 => $mem['id'],
															   'session_member_login_key'  => md5( $mem['joined'] . $mem['ip_address'] ),
															   'session_location'		  => 'index',
															   'session_log_in_time'	   => time(),
															   'session_running_time'	  => time(),
							)						);

		$ipsclass->input['adsess'] = $sess_id;
		
		$extra_query .= "&member_id=".$mem['id'].'&password=ok';
		
		$ipsclass->admin->redirect( $ipsclass->vars['board_url'].'/'.IPB_ACP_DIRECTORY."/index.".$ipsclass->vars['php_ext']."?adsess=".$ipsclass->input['adsess']."&".$extra_query, '"Log In" Successful' );
		
		exit();
		
		
	}
}
It will at least give you some fake security. The only way for someone else to get in now, is to change their member_id cookie.

#12 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 25 July 2008 - 07:28 PM

Just bumping this in case you didn't see it ;)

#13 GaryK

GaryK

    Coder

  • IM Supporters
  • PipPipPipPipPip
  • 123 posts
  • Location:Miami, FL
  • Real Name:Gary Keith
  • IPB Version:v2.3.x
Contributor

Posted 25 July 2008 - 10:09 PM

View Postm4rtin, on Jul 25 2008, 03:28 PM, said:

Just bumping this in case you didn't see it :)
Thanks, I did see it, but decided not to use it. I realized that my development server is connected to the 'net, and I don't trust myself to disable auto-login before I stop working for the day so this is probably not a safe thing for me to be using. ;)

Please correct me if my above assumption is wrong. :)
Alright! I know I'm in there! If I don't come out, I'll have to come in after me!

#14 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 25 July 2008 - 10:40 PM

It is safe against the man in the street, but some leet hackers may find the solution to it.
Just put a .htaccess/.htpasswd lock on the folder, and you as safe as you'll ever be.

You can also ban everyone but yourself using .htaccess.
order deny,allow
deny from all
allow from 127.0.0.1
allow from localhost


#15 GaryK

GaryK

    Coder

  • IM Supporters
  • PipPipPipPipPip
  • 123 posts
  • Location:Miami, FL
  • Real Name:Gary Keith
  • IPB Version:v2.3.x
Contributor

Posted 25 July 2008 - 10:48 PM

I'll have to see if there's a Windows Server 2003 equivalent for that. Thanks for the tip. ;)
Alright! I know I'm in there! If I don't come out, I'll have to come in after me!

#16 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 25 July 2008 - 11:02 PM

http://support.microsoft.com/kb/324064
Like that, maybe?

#17 GaryK

GaryK

    Coder

  • IM Supporters
  • PipPipPipPipPip
  • 123 posts
  • Location:Miami, FL
  • Real Name:Gary Keith
  • IPB Version:v2.3.x
Contributor

Posted 25 July 2008 - 11:09 PM

View Postm4rtin, on Jul 25 2008, 07:02 PM, said:

Thanks. I knew there was a way to handle restrictions, but it's been so long since I used it I'd forgotten how to do it. Now I feel comfortable with the ACP Auto-Login.
Alright! I know I'm in there! If I don't come out, I'll have to come in after me!

#18 Londonms

Londonms

    Member

  • Banned
  • PipPipPip
  • 21 posts
  • IPB Version:v3.0.x

Posted 23 January 2009 - 07:06 PM

I did different Script, i created a file called admin/indice.php with the data of the admin/index.php - after I made the changes in admin/index.php

only in this part, so I put
{
		die( "You do not have access to the administrative CP" );
}
changed for
{
		header( 'Location: indice.php' );
}
what will happen when the admin is not logged in will not get the message but the screen asking logon/password

Such as copies of old admin/index.php was admin/indice.php who always asks password - thought that the best message.

Edited by Londonms, 23 January 2009 - 07:29 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users