<?php
session_start();
include './email.php';
if ($_SESSION['log']) {
echo '已登陆,请勿重复登陆!<meta http-equiv="refresh" content="1;url=./">';
exit;
}
// 获取 POST 数据
$user = $_POST['user'];
$pass = $_POST['pass'];

/*
$cap = $_POST['cap'];
if ($cap != $_SESSION['captcha']) {
echo '图片验证码有误!<meta http-equiv="refresh" content="2;url=./">';
// 生成随机验证码
$captcha_code = '';
for ($i = 0; $i < 5; $i++) {
    $char = chr(rand(97, 122)); // 生成小写字母
    $captcha_code .= $char;
}
$_SESSION['captcha'] = $captcha_code;

    exit;
}

*/

// 定义要检查的文件路径
$filename = './me/' . $user . '/' . $pass . '/black.txt'; // 目录路径

if (file_exists($filename)) {

// 清空 $_SESSION 数组
$_SESSION = [];

// 如果需要，调用 session_destroy() 销毁会话
session_destroy();

echo '账号已禁用!<meta http-equiv="refresh" content="3;url=/">';
exit();
}




// 定义要检查的文件路径
$filename = './me/' . $user . '/' . $pass . '/lock.txt'; // 目录路径


if (file_exists($filename)) {
$_SESSION['log']=1;
$_SESSION['user']=$user;
$_SESSION['pass']=$pass;
$_SESSION['dir']='./me/' . $user . '/' . $pass . '/';
    echo '登陆成功!<meta http-equiv="refresh" content="1;url=./">';
    sendMail($user . '@qq.com', '#Fuxsto Host 账号登陆', "您的账号在IP[".$_SERVER['REMOTE_ADDR']."]处登陆");
    // 生成随机验证码
    log_wt("登陆", "账号登陆成功", "login");
$captcha_code = '';
for ($i = 0; $i < 5; $i++) {
    $char = chr(rand(97, 122)); // 生成小写字母
    $captcha_code .= $char;
}
$_SESSION['captcha'] = $captcha_code;
} else {
    echo "登陆失败!";
}




?>