1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- session_start();
- include_once("../../untils/conn.php");
- mysqli_query($con, "set names utf8");
- // 判断session中是否存在账号信息
- if (isset($_SESSION["account"])) {
- $proxy_acc = mysqli_real_escape_string($con, $_SESSION["account"]);
- $sql = "select proxy_acc,proxy_pass from proxy where proxy_acc='$proxy_acc';";
- $result = mysqli_query($con, $sql);
- $row = mysqli_num_rows($result);
- if ($row) {
- echo json_encode([
- "code" => 2,
- "msg" => '已登录',
- "data" => $_SESSION["account"]
- ]);
- exit;
- }
- }
- // 判断账号和密码是否都已输入
- if (empty($_POST['account']) || empty($_POST['password'])) {
- echo json_encode([
- "code" => 401,
- "msg" => '请输入账号和密码',
- ]);
- exit;
- }
- $proxy_acc = mysqli_real_escape_string($con, $_POST['account']);
- $proxy_pass = mysqli_real_escape_string($con, $_POST['password']);
- $sql = "select proxy_acc,proxy_pass,proxy_sta,state_ban from proxy where proxy_acc='$proxy_acc';";
- $result = mysqli_query($con, $sql);
- $row = mysqli_fetch_assoc($result);
- // 判断账号是否存在
- if (!$row) {
- echo json_encode([
- "code" => 400,
- "msg" => '账号不存在',
- ]);
- exit;
- }
- if ($row['proxy_sta'] == 0) {
- echo json_encode([
- "code" => 400,
- "msg" => "您的账号已被封禁!请联系平台客服处理!\n封禁原因:" . $row['state_ban'],
- ]);
- exit;
- }
- // 验证密码
- if ($row['proxy_pass'] != $proxy_pass) {
- echo json_encode([
- "code" => 400,
- "msg" => '账号密码错误',
- ]);
- exit;
- }
- // 登录成功
- $_SESSION["account"] = $proxy_acc;
- echo json_encode([
- "code" => 200,
- "msg" => '登录成功',
- ]);
- ?>
|