wxxy_class/api/avatar/index.php

33 lines
925 B
PHP
Raw Normal View History

2022-09-11 19:25:47 +08:00
<?PHP
/*
* XF_TLS 项目组 API
* 全部代码未开源
*/
// 载入头
include($_SERVER['DOCUMENT_ROOT'].'/api/header-control.php');
// 获取数据
$studentID = htmlspecialchars($_GET['studentID']);
// 函数构建
if (!empty($studentID)) {
// 数据库获取
2022-09-13 13:49:08 +08:00
$result_avatar = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['info']." WHERE studentID='$studentID'");
2022-09-11 19:25:47 +08:00
$result_avatar_object = mysqli_fetch_object($result_avatar);
// 检查是否存在
2022-09-13 13:49:08 +08:00
if (!empty($result_avatar_object->qq)) {
2022-09-11 19:25:47 +08:00
// 若正确信息返回数据
2022-09-13 13:49:08 +08:00
header('location: https://q1.qlogo.cn/g?b=qq&nk='.$result_avatar_object->qq.'&s=640');
2022-09-11 19:25:47 +08:00
} else {
// 如果数据错误返回不存在
header('location: ./logo.jpg');
}
} else {
// 没有参数返回404
header('location: ./404.png');
}
// 处理数据库
mysqli_free_result($result_avatar);
mysqli_close($sql_conn);