Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
MoeCinnamo authored Apr 15, 2022
1 parent e7309f1 commit 783efa7
Show file tree
Hide file tree
Showing 13 changed files with 668 additions and 0 deletions.
3 changes: 3 additions & 0 deletions functions/basic_redirect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
location.href = '<?php echo str_replace("'", "",$url); ?>';
</script>
14 changes: 14 additions & 0 deletions functions/count.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

$today = date("Y-m-d");
$result1 = $db->query("SELECT * FROM links");
$num_rows1 = $db->num_rows($result1);


$result2 = $db->query("SELECT * FROM links WHERE DATE(date) = '$today' ");
$num_rows2 = $db->num_rows($result2);

$result3 = $db->query("SELECT SUM(hits) FROM links");
$row3 = $db->fetch_array($result3);
$num_rows3 = $row3['SUM(hits)'];
?>
110 changes: 110 additions & 0 deletions functions/created.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html class="full" lang="en">

<head>
<base href="<?php echo $info['URL']; ?>/" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<title>成功生成短链接</title>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">

<!-- Custom CSS for the Template -->
<link href="css/style.css" rel="stylesheet">

<link href="https://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet">
<link rel="stylesheet" href="./css/all.css" integrity="sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz" crossorigin="anonymous">
<style>
a { color: inherit; }
</style>
<style>
<?php echo $info['cstm-style']; ?>
</style>
</head>

<body>

<?php
include "functions/menu.php";
?>
<div class="container" style="margin-top: -20px;">
<div class="row logo">
<div class="col-lg-12" style="text-align:center">
<?php
include "functions/logo.php";
include "functions/darkmode.php";
?>
</div>
</div>
</div>
<div class="container animated fadeIn">

<div class="row">
<div class="col-lg-10 col-lg-offset-1" style="margin-bottom: -25px;">
<div class="alert alert-dismissable alert-default text-center">
<h4 style="margin-bottom: -4px; color: #707070;"> 短链接及二维码成功生成! </h4>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="input-group">
<input id="urlbox" class="form-control cz-shorten-input" readonly name="url" value="<?php echo $created_link; ?>" type="text">
<span class="input-group-btn">
<button class="btn btn-large btn-primary cz-shorten-btn" type="submit" id="copy-button">复制</button>
</span>
</div>
</div>
</div>
<div class="row" style="margin-top: 30px;">
<div class="col-lg-4 text-center">
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-inverted" style="font-weight:bolder;color: #fff;">短链二维码</h3>
</div>
<div class="panel-body">
<img src="https://api.pwmqr.com/qrcode/create/?url=<?php echo $created_link; ?>&size=180">
</div>
</div>
</div>

<!-- row -->
<div class="row" style="margin-top: -0px;margin-right:15px;margin-left:15px;">
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title newsize" style="font-weight:bolder;">您的短链专属统计链接</h3>
</div>
<div class="panel-body">
<h4 style="margin-bottom: 20px; color: #707070;font-size: 20px;color: #ff0000;margin-top:10px;"> 这是你的专属短链统计页面链接请自行保存! </h4>
<a style="color: #2296f3;"href="<?php echo $info['URL'] . '/stats.php?id=' . $rand1; ?>"> <h3> <?php echo $info['URL'] . '/stats.php?id=' . $rand1; ?></h3></a>

<h4 style="margin-bottom: 20px; color: #707070;font-size: 24px;color: #ff0000;margin-top:28px;"> 严禁生成违法链接!一经发现直接删除!并举报违规链接! </h4>

</div>
</div>
</div>
<!-- row -->
</div>
<!-- JavaScript -->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/jquery.zclip.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$("#copy-button").click(function () {
$(this).html("已成功复制到粘贴板");
$("#urlbox").select();
document.execCommand("copy");
});
});
</script>


</body>
</html>
39 changes: 39 additions & 0 deletions functions/darkmode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<a id="dark-mode-btn" title="Toggle night mode" href="javascript:void(0)" onclick="toggleNightMode(this)"><i class="fas fa-moon"></i></a>
<script>
toggleNightMode("cookies")

function toggleNightMode(e) {
const body = document.querySelector("body");
const button = document.querySelector("#dark-mode-btn");
const logo = document.querySelector("#main-logo");
if (window.innerWidth < 650) {
body.append(button);
}
if (e == "cookies") {
// HERE GOES IDB STUFF
let now = document.cookie.split("dark=");
now = now[1].split(";");
if (Boolean(Number(now[0]))) {
body.classList.add("dark-mode");
button.classList.add("active");
if (logo) {
logo.src = "<?php echo $logo_url[1]; ?>";
}
};

return;
};
if (body.classList.toggle("dark-mode")) {
document.cookie = "dark=1";
if (logo) {
logo.src = "<?php echo $logo_url[1]; ?>";
}
} else {
document.cookie = "dark=0";
if (logo) {
logo.src = "<?php echo $logo_url[0]; ?>";
}
}
button.classList.toggle("active");
}
</script>
85 changes: 85 additions & 0 deletions functions/database.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

ini_set('display_errors', 1);
ini_set('log_errors', 1);

class MySQLDatabase {

private $host = "localhost"; //the host
private $db_user = "dwz2"; //Your username
private $pass = "6kAJmfihSzf4JjWJ"; // Your password
private $dbase = "dwz2"; // database name
private $connection;

function __construct() {
$this->open_connection();
}

public function crud() {
try {
$DB_con = new PDO("mysql:host={$this->host};dbname={$this->dbase}", $this->db_user, $this->pass);
$DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
};
return new crud($DB_con);
}

public function open_connection() {
$this->connection = mysqli_connect($this->host, $this->db_user, $this->pass, $this->dbase);
if (mysqli_connect_errno()) {
die("Database connection failed: " .
mysqli_connect_error() .
" (" . mysqli_connect_errno() . ")"
);
}
}

public function close_connection() {
if (isset($this->connection)) {
mysqli_close($this->connection);
unset($this->connection);
}
}

public function query($sql) {
$result = mysqli_query($this->connection, $sql);
$this->confirm_query($result);
return $result;
}

private function confirm_query($result) {
if (!$result) {
die(mysqli_error($this->connection));
}
}

public function escape_value($string) {
$escaped_string = mysqli_real_escape_string($this->connection, $string);
return $escaped_string;
}

// "database neutral" functions

public function fetch_array($result_set) {
return mysqli_fetch_assoc($result_set);
}

public function num_rows($result_set) {
return mysqli_num_rows($result_set);
}

public function insert_id() {
// get the last id inserted over the current db connection
return mysqli_insert_id($this->connection);
}

public function affected_rows() {
return mysqli_affected_rows($this->connection);
}

}

$database = new MySQLDatabase();
$db = & $database;
?>
68 changes: 68 additions & 0 deletions functions/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php

$data = $db->query("SELECT * FROM settings");
$info = $db->fetch_array($data);

$ads = $db->query("SELECT * FROM ads");
$ads_info = $db->fetch_array($ads);
?>
<!DOCTYPE html>
<html class="full" lang="zh">

<head>
<base href="<?php echo $info['URL']; ?>/" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<title>Error - <?php echo $info['name']; ?></title>

<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">

<!-- Custom CSS for the Template -->
<link href="css/ziti/fonts.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<style>
<?php echo $info['cstm-style']; ?>
</style>
</head>

<body>
<?php
include "functions/menu.php";
?>
<div class="container" style="margin-top: -20px;">
<div class="row logo">
<div class="col-lg-12" style="text-align:center">
<?php
include "functions/logo.php";
?>
</div>
</div>
</div>
<div class="container animated shake">

<div class="row">
<div class="col-lg-10 col-lg-offset-1" style="margin-top: 100px;">
<div class="alert alert-dismissable alert-danger text-center">
<h3 style="color: #707070;"> 哎呀!<?php echo $error_msg; ?> </h3>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-10 col-md-offset-1" style="text-align: center; margin-top: 20px; ">
<?php echo '' . $ads_info['ad2'] . ''; ?>
</div>
</div>

</div>
<!-- JavaScript -->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.js"></script>

</body>

</html>
17 changes: 17 additions & 0 deletions functions/logo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
$logo_url = $info['logo_url'];
if (strpos($logo_url,";")) {
$logo_url = explode(";",$logo_url);
if (empty($logo_url[1])) {
$logo_url[1] = $logo_url[0];
}
} else {
$logo_url = [$logo_url,$logo_url];
}
if ($info['logo_type'] == 1) {
$logo_tag = '<a style="color: inherit;margin:auto;" href="' . $info['URL'] . '" ><img id="main-logo" alt="'.$info['name'].' Logo" src="' . $logo_url[0] . '" class="sized" /></a>';
} else {
$logo_tag = '<a class="logo-text" style="color: inherit;" href="' . $info['URL'] . '" ><p class="font"><strong>' . $info['name'] . '</strong></p></a>';
}
echo $logo_tag
?>
Loading

0 comments on commit 783efa7

Please sign in to comment.