-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
70 lines (61 loc) · 1.25 KB
/
Copy pathindex.php
File metadata and controls
70 lines (61 loc) · 1.25 KB
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
<html>
<body background="bg1.jpg">
<head>
<title>
留言板V2
</title>
<style>
body{
color:white;
margin:0px;
padding:0px;
text-align:center;
}
</style>
</head>
<h1>留言板:</h1>
<hr/>
<?php
$con = mysql_connect("localhost","wpuser1","huanxiangwordpress");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("php", $con);
?>
<?php
if(isset($_GET['logout'])){
setcookie("tuser","",time()-300);
header("Location: index.php");
}
if(!isset($_COOKIE["tuser"]) && !isset($_COOKIE["user1"]))
{
setcookie("user1",time(),time()+6000000);
header("Location: index.php");
}
else if(isset($_GET['login'])){
require_once ('login.php');
}
else
{
require_once('board.php');
}
if(isset($_GET['del']) && isset($_COOKIE["tuser"]) )
{
$del=$_GET['del'];
$getFromdb=mysql_query("SELECT * FROM message WHERE ID='$_GET[del]'");
while($row = mysql_fetch_array($getFromdb)){
if($_COOKIE["tuser"] == $row['Name'])
{
mysql_query("DELETE FROM message WHERE ID='$del'");
header("Location: index.php");
}
else
echo "<script>alert('您无权删除该评论');</script>";
}
}
mysql_close($con);
?>
</body>
</html>