forked from jxj666/2code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurl_html.php
More file actions
37 lines (32 loc) · 910 Bytes
/
url_html.php
File metadata and controls
37 lines (32 loc) · 910 Bytes
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
<?php
header("Access-Control-Allow-Origin: *");
$id = isset($_GET["id"]) ? $_GET["id"] : '';
// 连主库
//$conn = mysqli_connect('路径'.':'.'端口','账号','密码','库名');
include 'conn_sql.php';
// Check connection
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
class Verify {
public $code = '00';
public $url = '00';
}
$verify = new Verify();
$sql = "SELECT * FROM `2code_code` WHERE id = '" . $id . "'";
$result = $conn->query($sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$k = $row["content"];
$v=$row["num"]+1;
$sql = "UPDATE `2code_code` SET `num` = '".$v."' WHERE `2code_code`.`id` = '".$id."'";
$result2 = $conn->query($sql);
$verify->url = $k;
$verify->code = 1;
}
} else {
$verify->code = 0;
}
echo json_encode($verify);
mysqli_close($conn);
?>