-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathanlink.php
135 lines (131 loc) · 3.38 KB
/
anlink.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!--
$=========================================================$
@name Ẩn link
@version 0.0.1
@author Nguyễn Hưng
@facebook https://fb.com/NguyenHung1903
@description Hide my url :"3
@Date create 23/08/2018
@comment Don't sell my products because it's free =))
@public https://github.com/nguyenhung1903/An-link/edit/master/anlink.php
$=========================================================$
-->
<html>
<head>
<title>Ẩn Link</title>
<center>
<?php
/*.htaccess: Rewrite ^hide/([a-zA-z0-9]+)$ anlink.php?url = $1*/
#connect mysql
$server_username = "";
$server_password = "";
$server_host = "";
$database = '';
$conn = mysqli_connect($server_host,$server_username,$server_password,$database) or die("không thể kết nối tới cơ sở dữ liệu");
mysqli_query($conn,"SET NAMES 'UTF8'");
# end connect mysql
function randomQR() {
/*========================================
= Xuất ra một mã ngẫu nhiên =
========================================
*/
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$qr = array();
$alphaLength = strlen($alphabet) - 1;
for ($i = 0; $i < 8; $i++) {
$n = rand(0, $alphaLength);
$qr[] = $alphabet[$n];
}
return implode($qr);
}
if (isset($_GET['url'])){
$url = $_GET['url'];
$link_unhide = "";
$sql = "SELECT * FROM url WHERE url_qr='$url'";
$query = mysqli_query($conn,$sql);
while ($data = mysqli_fetch_array($query)){
$link_unhide = $data['url'];
}
if ($link_unhide == null){
echo "<title>Link không tồn tại</title><p>Link không tồn tại</p>";
} else
echo '<title>Đang chuyển hướng...</title><META http-equiv="refresh" content="0;URL='.$link_unhide.'">';
}else echo '<title>Ẩn link</title><form action="" method="post" accept-charset="utf-8">
<input type="url" name="anlink_input">
<input type="submit" name="anlink_submit" value="ẩn link">
</form>';
if (isset($_POST['anlink_submit'])){
$link = $_POST['anlink_input'];
$url_qr = randomQR();
$sql="INSERT INTO url(url_qr,url) VALUES ('".$url_qr."','".$link."')";
mysqli_query($conn,$sql);
echo '<input type="text" name="" value ="https://aftrue.me/hide/'.$url_qr.'">';
/*Thay https://aftrue.me/hide thành url mà bạn muốn*/
}
?>
</head>
<!-- CSS -->
<style type="text/css" media="screen">
a{
-webkit-transition: 0.3s;
}
a:link, a:visited {
border: 2px solid white;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
body{
background-color: Black;
margin-top:10%;
}
a:hover {
transition: 0.3s;
background-color: white;
color:black;
}
a:active{
background-color: #eeeeee;
color:black;
}
input[type = url]{
width: 540px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 2px solid white;
background-color: Black;
color: white;
}
input[type = text]{
width: 620px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 2px solid white;
background-color: Black;
color: white;
}
input[type = submit]{
width: 80px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 2px solid white;
background-color: Black;
color: white;
}
input[type = submit]:hover{
transition: 0.3s;
background-color: white;
color:black;
}
p{
color:white;
}
</style>
<!--/ CSS-->
</center>
</html>