php authenticate,Authenticate.php

session_start();

header("Content-type:text/html;charset=utf-8");

unset($_SESSION['nick']);

unset($_SESSION['authenticated_user_id']);

unset($_SESSION['app_unique_key']);

unset($_SESSION['topsession']);

require_once('config.php');

require_once('modules/Users/Users.php');

require_once('include/logging.php');

global $mod_strings;

global $app_strings;

$focus = new Users();

// Add in defensive code here.

$focus->column_fields["user_name"] = to_html($_REQUEST['user_name']);

$user_password = $_REQUEST['user_password'];

$theme = $_REQUEST['login_theme'];

$focus->load_user($user_password);

if($focus->is_authenticated()) {

$query = "UPDATE ec_users SET is_online='1', last_ping='".time()."' WHERE user_name='".$focus->column_fields["user_name"]."'";

$adb->query($query);

$usip=$_SERVER['REMOTE_ADDR'];

$intime=date("Y/m/d H:i:s");

require_once('modules/Users/LoginHistory.php');

$loghistory=new LoginHistory();

$Signin = $loghistory->user_login($focus->column_fields["user_name"],$usip,$intime);

unset($_SESSION['login_password']);

unset($_SESSION['login_error']);

unset($_SESSION['login_user_name']);

unset($_SESSION['login_theme']);

$_SESSION['login_company_name'] = $company_name;

$_SESSION['authenticated_user_id'] = $focus->id;

$_SESSION['app_unique_key'] = $application_unique_key;

$_SESSION['nick'] = $_REQUEST['user_name'];

$_SESSION['topsession'] = $application_unique_key;

// store the user's theme in the session

if (isset($_REQUEST['login_theme'])) {

$authenticated_user_theme = $_REQUEST['login_theme'];

}

else {

$authenticated_user_theme = $default_theme;

}

// store the user's language in the session

if (isset($_REQUEST['login_language'])) {

$authenticated_user_language = $_REQUEST['login_language'];

}

else {

$authenticated_user_language = $default_language;

}

$_SESSION['authenticated_user_theme'] = $authenticated_user_theme;

$_SESSION['authenticated_user_language'] = $authenticated_user_language;

redirect("index.php?module=Home&action=index");

} else {

$_SESSION['login_user_name'] = $focus->column_fields["user_name"];

$_SESSION['login_password'] = $user_password;

$_SESSION['login_theme'] = $theme;

//$_SESSION['login_error'] = $mod_strings['ERR_INVALID_PASSWORD'];

// go back to the login screen.

// create an error message for the user.

redirect("Login.php?login_error=".rawurlencode("用户名和密码不对"));

}

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值