-
-
Notifications
You must be signed in to change notification settings - Fork 74
/
auth.php
35 lines (31 loc) · 1.05 KB
/
auth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
include_once("cf.class.php");
function msg($s)
{
$_SESSION["login_msg"] = $s;
header("Location: index.php");
exit(0);
}
if (Enable_reCAPTCHA) {
if (!empty($_POST["g-recaptcha-response"])) {
if (!($cloudflare->reCAPTCHA($_POST["g-recaptcha-response"]))) {
msg("请完成验证码");
}
} else {
msg("请完成验证码");
}
}
if ((!empty($_POST["email"])) && (!empty($_POST["password"]))) {
$r = $cloudflare->login($_POST["email"], $_POST["password"]);
if ($r["result"] == "success") {
$_SESSION["user_key"] = $r["response"]["user_key"];
$_SESSION["email"] = $r["response"]["cloudflare_email"];
$_SESSION["api_key"] = $r["response"]["user_api_key"];
//if (Enable_TXT_Verification) $_SESSION["txt_verification"] = password_hash(Random_String.$_SESSION["email"],PASSWORD_BCRYPT );
header("Location: domains.php");
} else {
msg("失败:" . $r["msg"]);
}
} else {
msg("用户名和密码不能为空");
}