public function dologin( )
{
/*if ( ( $this->system->getConf( "system.admin_verycode" ) || $this->login_times_error < $this->system->getConf( "system.admin_error_login_times" ) ) && strtolower( $_POST['verifycode'] ) !== strtolower( $_SESSION['RANDOM_CODE'] ) )
{
$_SESSION['loginmsg'] = __( "验证码输入错误!" );
header( "Location: index.php?ctl=passport&act=login" );
exit( );
}*/
$oOpt =& $this->system->loadModel( "admin/operator" );
$aResult = $oOpt->tryLogin( $_POST );
if ( $aResult )
{
require( "magicvars_sys.php" );
$magic =& $this->system->loadModel( "system/magicvars" );
$now_magic_data = $magic->getList( "var_name", "", 0, -1 );
$tmp_magic_data = array( );
foreach ( $now_magic_data as $m_key => $m_value )
{
$tmp_magic_data[$m_value['var_name']] = 1;
}
$import_data = array_diff_key( $magicvars, $tmp_magic_data );
if ( $import_data )
{
foreach ( $import_data as $me => $i_data )
{
$magic->insert( $i_data );
}
}
if ( $_POST['save_login_name'] )
{
setcookie( "SHOPEX_LOGIN_NAME", $_POST['usrname'], time( ) + 864000 );
}
else
{
setcookie( "SHOPEX_LOGIN_NAME", "" );
}
$status =& $this->system->loadModel( "system/status" );
$_SESSION['SHOPEX_LG_KEY'] = md5( remote_addr( ).$aResult['op_id'] );
setcookie( "SHOPEX_LG_KEY", md5( remote_addr( ).$aResult['op_id'] ) );
$status->update( 1 );
$this->system->op_id = $aResult['op_id'];
$data['lastlogin'] = time( );
$data['logincount'] = $aResult['logincount'] + 1;
$oOpt->setLogInfo( $data, $aResult['op_id'] );
$this->system->setConf( "system.admin_error_login_times", 0 );
if ( $_REQUEST['return'] )
{
header( "Location: index.php#".$_REQUEST['return'] );
}
else
{
header( "Location: index.php" );
}
}
else
{
if ( time( ) < intval( $this->system->getConf( "system.admin_error_login_time" ) + 3600 ) )
{
$this->system->setConf( "system.admin_error_login_times", $this->system->getConf( "system.admin_error_login_times" ) + 1 );
}
else
{
$this->system->setConf( "system.admin_error_login_times", 1 );
}
$this->system->setConf( "system.admin_error_login_time", time( ) );
$_SESSION['loginmsg'] = __( "用户名或密码错误!" );
header( "Location: index.php?ctl=passport&act=login" );
exit( );
}
}