<?php require_once '../lib/config.php'; require_once '../lib/func/comm.func.php'; require_once '../lib/func/admin.func.php'; require_once '../lib/class/node.class.php'; require_once '../lib/class/invite_code.class.php'; //检测是否登录,若没登录则转向登录界面 if (!isset($_COOKIE['admin_name']) || !isset($_COOKIE['admin_uid']) || !isset($_COOKIE['admin_pwd'])) { header("Location:login.php"); exit; } else { //co $uid = $_COOKIE['admin_uid']; $admin_name = $_COOKIE['admin_name']; $admin_pwd = $_COOKIE['admin_pwd']; $admin_email = get_user_email($uid); //验证cookie $pw = get_user_pass($uid); $pw = co_pw($pw); if ($pw != $admin_pwd) { header("Location:login.php"); } } //admin config $admin_title = "管理中心";
$check = new \Ss\User\UserCheck(); if (!empty($_POST)) { //获取_POST并赋值 $username = mysqli_real_escape_string($dbc, trim($_POST['username'])); $pwd = md5($_POST['password']); //md5加密 $rem = $_POST['remember_me']; $rt = $check->login_check($username, $pwd); if ($rt == 1) { if ($rem = "week") { $ext = 3600 * 24 * 7; } else { $ext = 3600; } //获取用户id $id = $u->get_user_uid($username); //获得用户user_name,email登录的时候需要 $s = new Ss\User\Ss($id); $username = $s->get_user_info_array()['user_name']; //处理密码 $pw = co_pw($pwd); setcookie("user_name", $username, time() + $ext); setcookie("user_pwd", $pw, time() + $ext); setcookie("user_uid", $id, time() + $ext); header("location: index.php "); exit; } else { echo ' <script>alert("用户名或密码错误!")</script> '; echo " <script>window.location='login.php';</script> "; } }