-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
251 lines (220 loc) · 7.59 KB
/
index.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?php
require_once 'data.php';
require_once 'MysqliDb.php';
$name = $_GET['name'];
$choiceIds = $_GET['choice-ids'];
if ($choiceIds !== null) {
$choiceIds = explode(',', $choiceIds);
}
$db = new MysqliDb(array(
'host' => 'host',
'username' => 'username',
'password' => 'password',
'db' => 'db',
'port' => 'port',
));
$db->where('id', 2);
$count = $db->getOne('simsim_counts');
?>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="심심철학관">
<meta property="og:description" content="내 눈을 바라봐 넌 심상정 찍고">
<meta property="og:image" content="http://minsim.or.kr/simsim/assets/images/title.png">
<meta property="og:url" content="http://minsim.or.kr/simsim">
<meta name="twitter:card" content="summary_large_image">
<title>심심철학관</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="//developers.kakao.com/sdk/js/kakao.min.js"></script>
<link href="./assets/style.css" rel="stylesheet" />
<link rel="shortcut icon" href="./favicon.ico">
</head>
<body>
<div class="nav-background">
</div>
<div class="container">
<div class="nav">
<a href="/simsim">
<img class="logo" src="./assets/images/logo.png"/>
</a>
</div>
<div class="content">
<?php
if ($name === null) {
shuffle($choices);
?>
<ul class="choices">
<?php
foreach ($choices as $index => $choice) {
if ($index < 6) {
$class = '';
if ($index % 3 === 0) {
$class = 'left';
} else if ($index % 3 === 2) {
$class = 'right';
}
?>
<li class="choice <?php echo $class; ?>"
data-id="<?php echo $choice['id']; ?>">
<img src="<?php echo $choice['image']; ?>"/>
<div class="overlay">
<span>선택</span>
</div>
<div class="caption"><?php echo $choice['caption']; ?></div>
</li>
<?php
}
}
?>
</ul>
<h2 class="title">당신은 어떤 심상정인가요?</h2>
<div class="subtitle">(중복 선택 가능)</div>
<ul class="choices">
<?php
foreach ($choices as $index => $choice) {
if ($index >= 6) {
$class = '';
if ($index % 3 === 0) {
$class = 'left';
} else if ($index % 3 === 2) {
$class = 'right';
}
?>
<li class="choice <?php echo $class; ?>"
data-id="<?php echo $choice['id']; ?>">
<img src="<?php echo $choice['image']; ?>"/>
<div class="overlay">
<span>선택</span>
</div>
<div class="caption"><?php echo $choice['caption']; ?></div>
</li>
<?php
}
}
?>
</ul>
<form id="form">
<div class="label-wrapper">
<input type="text" id="name" name="name" placeholder="이름" />
</div>
<button type="submit">심상정책 확인하기</button>
</form>
<div class="counter">
<?php
?>
현재까지 <?php echo number_format($count['count']) ?>명이 참여하셨습니다.
</div>
<?php
} else {
$db->update('simsim_counts', array(
'count' => $db->inc(1),
));
?>
<h2 class="title"><?php echo $name; ?>님을 위한 심상정책!</h2>
<?php
foreach ($choiceIds as $choiceId) {
$choice = $choices[$choiceId];
?>
<div class="choice">
<?php
if ($choice['link']) {
?>
<a href="<?php echo $choice['link']; ?>">
<?php
}
?>
<div class="choice-header">
<img src="<?php echo $choice['image']; ?>"/>
<div class="caption"><?php echo $choice['caption']; ?></div>
</div>
<?php
if ($choice['link']) {
?>
</a>
<?php
}
?>
<ul class="policies">
<?php
foreach ($choice['policies'] as $policy) {
?>
<li>
<?php echo $policy['title'] ?>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
?>
<div class="button-wrapper top">
<a class="button go" href="http://as.justice21.org/v19n10/">
심상정책 더보기
</a>
</div>
<div class="button-wrapper top">
<a class="button go" target="_blank"
href="http://simkoong.org/document/main.php">
복채 내기
</a>
</div>
<div class="button-wrapper">
<a class="button facebook" target="_blank"
href="https://www.facebook.com/dialog/feed?&app_id=1893797674169551&display=popup&link=http://minsim.or.kr/simsim/">페이스북 공유하기</a>
</div>
<div class="button-wrapper">
<a class="button twitter" target="_blank"
href="https://twitter.com/intent/tweet?text=심심철학관&url=http://minsim.or.kr/simsim/">트위터 공유하기</a>
</div>
<div class="button-wrapper">
<a class="button kakao" id="kakao" href="javascript:sendLink()">카카오톡 공유하기</a>
</div>
<div class="button-wrapper">
<a class="button telegram" target="_blank"
href="https://telegram.me/share/url?url=http://minsim.or.kr/simsim/">텔레그램 공유하기</a>
</div>
<div class="button-wrapper">
<a class="button back" href="/simsim/">돌아가기</a>
</div>
<?php } ?>
</div>
</div>
<div class="footer-background">
<p>Created by <a href="http://www.justice21.org/newhome/main/" target="_blank">정의당</a></p>
<p>Developed by <a href="http://leehankyeol.me" target="_blank">이한결</a></p>
</div>
<script src="./assets/script.js"></script>
<script type='text/javascript'>
//<![CDATA[
// Set JavaScript Key of current app.
Kakao.init('6b5031f5fecac6acd1bb61429c0a83c9');
function sendLink() {
Kakao.Link.sendDefault({
objectType: 'feed',
content: {
title: '심심철학관',
imageUrl: 'http://minsim.or.kr/simsim/assets/images/title.png',
imageWidth: 720,
imageHeight: 375,
link: {
webUrl: 'http://minsim.or.kr/simsim',
mobileWebUrl: 'http://minsim.or.kr/simsim',
},
description: '내 눈을 바라봐 넌 심상정 찍고',
},
buttonTitle: '심심철학관 가기',
});
}
//]]>
</script>
</body>
</html>