-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrite_action.php
More file actions
53 lines (41 loc) · 979 Bytes
/
Copy pathwrite_action.php
File metadata and controls
53 lines (41 loc) · 979 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
46
47
48
49
50
51
52
53
<!DOCTYPE>
<html>
<head>
</head>
<body>
<?php
//작성한 글 저장
$connect = mysqli_connect("localhost", "tnwjd4623", "1q2w3e4r","tnwjd4623") or die ("connect fail");
$type = $_GET[type];
$id = $_GET[id];
$title = $_GET[title];
$content = $_GET[content];
$date = date('Y-m-d H:i:s');
$isbn = $_GET[isbn];
$URL = "./main.php";
$query;
if($type==0){
$query = "insert into board_sell (number, title, content, date, hit, id, isbn)
values(null, '$title', '$content', '$date', '0', '$id', '$isbn')";
}
else if($type==1) {
$query = "insert into board_buy (number, title, content, date, hit, id, isbn)
values(null, '$title', '$content', '$date', '0', '$id', '$isbn')";
}
$result = $connect->query($query);
if($result) {
?>
<script>
alert("글이 등록되었습니다.");
location.replace("<?php echo $URL?>");
</script>
<?php }
else{
?> <script>
alert("fail");
</script>
<?php }
mysqli_close($connect);
?>
</body>
</html>