70 lines
3.2 KiB
PHP
70 lines
3.2 KiB
PHP
<link href="https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
|
<!--Color Switcher Mockup-->
|
|
<link href="css/color-switcher-design.css" rel="stylesheet">
|
|
<!-- Color Themes -->
|
|
<link id="theme-color-file" href="css/color-themes/default-color.css" rel="stylesheet">
|
|
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon">
|
|
<link rel="icon" href="images/favicon.png" type="image/x-icon">
|
|
<!-- Responsive -->
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
<!-- Stylesheets -->
|
|
<meta name="360-site-verification" content="fe8d8c3da251df36a0252d7c2fd03d0f" />
|
|
<link href="css/bootstrap.css" rel="stylesheet">
|
|
<link href="css/style.css" rel="stylesheet">
|
|
<link href="css/responsive.css" rel="stylesheet">
|
|
<meta name="robots" content="index, follow">
|
|
|
|
|
|
<?php include('../cms_admin/db_connection.php');?>
|
|
|
|
<?php
|
|
// 首先,检查是否有传参
|
|
$page_title = isset($title) ? $title : '';
|
|
$page_description = isset($description) ? $description : '';
|
|
$page_keywords = isset($keywords) ? $keywords : '';
|
|
|
|
// 如果没有传参,则从数据库中获取默认值
|
|
if (empty($page_title) || empty($page_description) || empty($page_keywords)) {
|
|
// 查询数据库
|
|
$fetch_query = "SELECT * FROM basic_info LIMIT 1";
|
|
$result = $conn->query($fetch_query);
|
|
|
|
// 如果查询到数据,则从数据库获取值
|
|
if ($result->num_rows > 0) {
|
|
$row = $result->fetch_assoc();
|
|
|
|
// 只有在未设置的情况下才从数据库中设置值
|
|
$page_title = empty($page_title) ? $row['m_title_CN'] : $page_title;
|
|
$page_description = empty($page_description) ? $row['m_desc_CN'] : $page_description;
|
|
$page_keywords = empty($page_keywords) ? $row['m_keywords_CN'] : $page_keywords;
|
|
}
|
|
}
|
|
?>
|
|
|
|
<title><?php echo $page_title; ?></title>
|
|
<meta name="title" content="<?php echo $page_title; ?>">
|
|
<meta name="description" content="<?php echo $page_description; ?>">
|
|
<meta name="keywords" content="<?php echo $page_keywords; ?>">
|
|
|
|
|
|
<?php
|
|
// Get the visitor's IP address
|
|
$ip_address = $_SERVER['REMOTE_ADDR'];
|
|
// Get the current date
|
|
$current_date = date('Y-m-d');
|
|
|
|
// Prepare and execute the check query
|
|
$check_query = "SELECT id FROM visitors WHERE ip = '$ip_address' AND date = '$current_date'";
|
|
$check_result = mysqli_query($conn, $check_query);
|
|
|
|
if (mysqli_num_rows($check_result) == 0) {
|
|
// If no matching IP and date, insert a new record
|
|
$insert_query = "INSERT INTO visitors (ip, date) VALUES ('$ip_address', '$current_date')";
|
|
mysqli_query($conn, $insert_query);
|
|
}
|
|
?>
|
|
|
|
|