-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdoaddadv.php
More file actions
45 lines (40 loc) · 959 Bytes
/
Copy pathdoaddadv.php
File metadata and controls
45 lines (40 loc) · 959 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
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<?php
include '../conn.php';
//接受数据
$advsname = $_REQUEST['advsname'];
$keywords = $_REQUEST['keywords'];
$picture = $_REQUEST['picture'];
$link = $_REQUEST['link'];
//拼装sql
$sql = "insert into adv(name,keywords,picture,link) values('".$advsname."','".$keywords."','".$picture."','".$link."')";
//写入数据库
if ($conn->query($sql)==TRUE) {
echo "添加广告成功!正在跳转...";
?>
<script type="text/javascript">
//休眠5秒,跳转广告列表
$(function() {
sleep(500);
location.href="advlist.php";
});
function sleep(n) { //n表示的毫秒数
var start = new Date().getTime();
while (true) if (new Date().getTime() - start > n) break;
}
</script>
<?php
}else {
echo "添加失败请重试!";
}
//返回状态
?>
</body>
</html>