-
Notifications
You must be signed in to change notification settings - Fork 0
/
modify.php
61 lines (54 loc) · 2.16 KB
/
modify.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
<?php $connect = mysqli_connect("localhost", "root", "mysql", "phpbbs") or die("connect fail");
$number = $_GET['number'];
$query = "SELECT title, content, date, id FROM board where number=$number";
$result = $connect->query($query);
$rows = mysqli_fetch_assoc($result);
$title = $rows['title'];
$content = $rows['content'];
$usrid = $rows['id'];
session_start();
$URL = "./index.php";
if (!isset($_SESSION['userid'])) {
?> <script>
alert("권한이 없습니다.");
location.replace("<?php echo $URL ?>");
</script>
<?php } else if ($_SESSION['userid'] == $usrid) {
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.3/css/all.css" integrity="sha384-SZXxX4whJ79/gErwcOYf+zWLeJdY/qpuqC4cAa9rOGUstPomtqpuNWT9wdPEn2fk" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Zen+Tokyo+Zoo&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap" rel="stylesheet">
<title>BBS SITE</title>
</head>
<body>
<div class="writeContainer">
<div class="writeIntro">
<h2>수정하기</h2>
</div>
<form method="post" action="modify_action.php" class="write">
<input type="hidden" name="id" value="<?= $_SESSION['userid'] ?>">
<input type="hidden" name="number" value="<?= $number ?>">
<p>
<input type="text" class="writeName" id="name" name="title" value="<?= $title ?>">
</p>
<p>
<textarea name="content" class="writeContent" id="message"><?= $content ?></textarea>
</p>
<input type="submit" class="writeBtn" value="등록">
</form>
</div>
</body>
</html>
<?php } else {
?> <script>
alert("권한이 없습니다.");
location.replace("<?php echo $URL ?>");
</script>
<?php }
?>