-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdislike.php
More file actions
executable file
·48 lines (34 loc) · 1.21 KB
/
dislike.php
File metadata and controls
executable file
·48 lines (34 loc) · 1.21 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
<?php
session_start(); //이 문장은 맨위에 들어가야함
$connect = mysqli_connect("localhost","","","") or die("fail");
$number = $_GET['number'];
$query = "select title, content, date, hit, id from board where number =$number";
$result = $connect->query($query);
$rows = mysqli_fetch_assoc($result);
$dislikes = "update board set dislikes=dislikes+1 where number=$number";
if(!isset($_SESSION['dislike'.$number]) && isset($_SESSION['loggedin']))
{
$connect->query($dislikes); ?>
<script>
alert('비추천하셨습니다.');
<?php
session_regenerate_id(true);
$_SESSION['dislike'.$number] = 1;
?>
location.href='https://ydinside.com/view.php?number=<?=$number?>'</script> <?php
}
else if(!isset($_SESSION['loggedin']))
{
?>
<script>
alert('로그인이 필요합니다.');
location.href='https://ydinside.com/YDK-login.html'</script><?php
}
else
{?>
<script>
alert('이미 비추천하셨습니다.');
location.href='https://ydinside.com/view.php?number=<?=$number?>'</script>
<?php
}
?>