diff --git a/Class/Mailer/PHPMailer/DSNConfigurator.php b/class/Mailer/PHPMailer/DSNConfigurator.php similarity index 100% rename from Class/Mailer/PHPMailer/DSNConfigurator.php rename to class/Mailer/PHPMailer/DSNConfigurator.php diff --git a/Class/Mailer/PHPMailer/Exception.php b/class/Mailer/PHPMailer/Exception.php similarity index 100% rename from Class/Mailer/PHPMailer/Exception.php rename to class/Mailer/PHPMailer/Exception.php diff --git a/class/Sql.php b/class/Sql.php index ae9df16..91a7ea8 100644 --- a/class/Sql.php +++ b/class/Sql.php @@ -34,6 +34,7 @@ public static function MySqlConn() public static function SELECT(string $Mysql_Query): array { $CC_i = 0; + $Result = null; $Array_OutPut = []; if (preg_match('/^SELECT/', $Mysql_Query)) { $Result = mysqli_query(self::MySqlConn(), $Mysql_Query); @@ -45,6 +46,7 @@ public static function SELECT(string $Mysql_Query): array $Array_OutPut['output'] = 'EmptyResult'; } else $Array_OutPut['output'] = 'TypeError'; + mysqli_free_result($Result); return $Array_OutPut; } diff --git a/index.php b/index.php index b3d9bbc..7061409 100644 --- a/index.php +++ b/index.php @@ -1 +1,8 @@ + + + + + + + Document + + + + + diff --git a/public/api/auth/register/index.php b/public/api/auth/register/index.php new file mode 100644 index 0000000..9b354d2 --- /dev/null +++ b/public/api/auth/register/index.php @@ -0,0 +1,92 @@ += $Data_NowTime-{$Array_ConfigData['Mail']['ExpDate']}"); + if ($AResult_UserEmailVerify['output'] == "EmptyResult") { + // 创建激活码 + if (Sql::INSERT("INSERT INTO `index`.xf_email_verify (`uid`, `code`, `time`) VALUES ('{$PostData['username']}','$Data_Captcha','$Data_NowTime')")) { + // 邮件发送 + if ($ClassMailer->PostMail($PostData['email'], 1, $Data_Captcha)) + Normal::Output(200); + else Normal::Output(201); + } else Normal::Output(300); + } else Normal::Output(500); + } else Normal::Output(300); + } else Normal::Output(600); + } else Normal::Output(401); + } else Normal::Output(400); + } else { + // 数据库查找用户是否存在 + $AResult_User = Sql::SELECT("SELECT * FROM `index`.xf_user WHERE `uid`='{$_COOKIE['user']}'"); + if ($AResult_User['output'] == 'Success') { + $Json_Data = [ + 'output' => "AlReadyLogin", + 'code' => 403, + 'data' => [ + 'message' => "您已登录", + ], + ]; + } else if ($AResult_User['output'] == 'EmptyResult') { + $Json_Data = [ + 'output' => "IllegalLogin", + 'code' => 403, + 'data' => [ + 'message' => "非法登录", + ], + ]; + } else { + $Json_Data = [ + 'output' => $AResult_User['output'], + 'code' => 403, + 'data' => [ + 'message' => "数据库搜索类型错误", + ], + ]; + } + } +} else { + Normal::Output(100); +} \ No newline at end of file diff --git a/public/api/auth/registerCheck/index.php b/public/api/auth/registerCheck/index.php new file mode 100644 index 0000000..49370c1 --- /dev/null +++ b/public/api/auth/registerCheck/index.php @@ -0,0 +1,39 @@ + urldecode(htmlspecialchars($_GET['code'])), +]; + +// 函数构建 +if ($Array_ConfigData['Session'] == $_SERVER['HTTP_SESSION']) { /* 检查通讯密钥是否正确 */ + if (!empty($_COOKIE['user'])) { + + } else { + $Json_Data = [ + 'output' => 'NoLogin', + 'code' => 502, + 'data' => [ + 'message' => '需要登陆', + ], + ]; + } +} else { + // 编译输出 + Normal::Output(100); +} \ No newline at end of file diff --git a/public/api/index.php b/public/api/index.php new file mode 100644 index 0000000..7061409 --- /dev/null +++ b/public/api/index.php @@ -0,0 +1,8 @@ +getToken())) { + // 不匹配Token + $Data_Token = substr($ClassToken->getToken(), 6); + // 生成Token + $Json_Data = [ + 'output' => 'Success', + 'code' => 200, + 'data' => [ + 'message' => '生成完毕', + 'token' => $Data_Token, + ], + ]; + } else { + $Json_Data = [ + 'output' => $ClassToken->getToken(), + 'code' => 502, + 'data' => [ + 'message' => '按需检查对应错误', + ], + ]; + } +} else { + $Json_Data = [ + 'output' => 'TokenNotEmpty', + 'code' => 403, + 'data' => [ + 'message' => "Token不为空", + ], + ]; +} +// 输出JSON +echo json_encode($Json_Data, JSON_UNESCAPED_UNICODE); \ No newline at end of file diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..c1c054f --- /dev/null +++ b/public/index.php @@ -0,0 +1,6 @@ +