-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpost.php
More file actions
254 lines (236 loc) · 8.64 KB
/
Copy pathpost.php
File metadata and controls
254 lines (236 loc) · 8.64 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
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
252
253
254
<?php
session_start();
include_once("./include/head_line.inc.php");
include_once("./include/db/configure.php");
include_once("./include/commonFunction.php");
checkLogin();
if (isset($_POST["postcode"]) && !empty($_POST["postcode"])) {
$code = getData($_POST['postcode']);
}
if (isset($_SESSION["uid"]) && !empty($_SESSION["uid"])) {
$uid = $_SESSION["uid"];
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<title>Post</title>
<style>
table {
margin-left: 30%;
vertical-align: middle;
margin: 100px auto;
overflow-y: scroll;
position: absolute;
width: 800px;
}
h1 {
font-family: "Inconsolata", sans-serif;
color : white;
background-color:black;
margin-top: 100px;
margin-left: 50px auto;
margin-right: auto;
margin: 100px auto;
text-align: center;
width: 950px;
}
.cont {
height: 200px;
width: 450px;
position: absolute; /*絕對位置*/
top: 0%;
left: 20%;
margin-left: auto;
margin-right: auto;
}
</style>
<style>
.rating {
display: inline-block;
position: relative;
bottom: 500px;
top: 10px;
left : 0px;
height: 25px;
width: 400px;
line-height: 25px;
font-size: 25px;
}
.rating label {
position: absolute;
bottom: 500px;
top: 0;
left: 10px;
height: 0;
cursor: pointer;
}
.rating label:last-child {
position: absolute;
}
.rating label:nth-child(1) {
z-index: 5;
}
.rating label:nth-child(2) {
z-index: 4;
}
.rating label:nth-child(3) {
z-index: 3;
}
.rating label:nth-child(4) {
z-index: 2;
}
.rating label:nth-child(5) {
z-index: 1;
}
.rating label input {
position: absolute;
top: 0px;
left: 10%;
opacity: 0;
}
.rating label .icon {
float: center;
color: transparent;
}
.rating label:last-child .icon {
color: #dddddd;
}
.rating:not(:hover) label input:checked ~ .icon,
.rating:hover label:hover input ~ .icon {
color: #ffdd6b;
}
.rating label input:focus:not(:checked) ~ .icon:last-child {
color: #dddddd;
text-shadow: 0 0 5px #ffdd6b;
}
</style>
<script>$(':radio').change(function() {
console.log('New star rating: ' + this.value);
});
</script>
</head>
<body>
<div class = "cont"> <!-- style="text-align: center;"-->
<?php //include("startest.php");?>
<h1>Post the Article !</h1>
<?php
//include("startest.php");
?>
<form action="post_function.php" method="post" Enctype="multipart/form-data" style="margin-top:-180px;margin-left: 30%;">
<table style="vertical-align: middle;">
<tr style="vertical-align: middle;margin-left: 35%;">
<td style="vertical-align: middle;">Title:</td>
<?php if(isset($title)){ ?>
<td style="vertical-align: middle;"><input style="width:510px;height:40px;text-align: center;" type="text" name="title"
value="<?=htmlspecialchars($title)?>" /></td>
<?php }else{ ?>
<td style="vertical-align: middle;"><input style="width:510px;height:40px;text-align: left;" type="text" name="title" /></td>
<?php } ?>
</tr>
<tr>
<td><br>Validate:</td>
<td>
<br>
<input type="radio" name="category" value="private"/> private
<input type="radio" name="category" value="public"/> public
<br>
</td>
</tr>
<tr>
<td><br>Language:</td>
<td>
<br>
<input type="radio" name="lang" value="c"/> C
<input type="radio" name="lang" value="cpp"/> C++
<br>
</td>
</tr>
<tr>
<td><br>Difficuty:</td>
<td>
<div class = "rating">
<label>
<input type="radio" name="stars" value="1" />
<span class="icon">★</span>
</label>
<label>
<input type="radio" name="stars" value="2" />
<span class="icon">★</span>
<span class="icon">★</span>
</label>
<label>
<input type="radio" name="stars" value="3" />
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
</label>
<label>
<input type="radio" name="stars" value="4" />
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
</label>
<label>
<input type="radio" name="stars" value="5" />
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
</label>
</div>
</td>
</tr>
<tr>
<td>Content:</td>
<td><br><textarea name="content" rows="5" cols="65" style="text-align: left;"><?php
if(isset($content)){
echo $content;
}
?></textarea><br>
</td>
</tr>
<tr>
<td>Code:</td>
<td><br><textarea name="code" rows="15" cols="65" style="text-align: left;"><?php
if(isset($code)){
echo $code;
}
?></textarea><br><br>
</td>
</tr>
<tr>
<td colspan="2" style = "text-align: center;">
<br>
<input type="button" value="not now" style="width:120px;height:40px;border:2px blue none;color:#fff;background: #898989;position:absolute;right:220px; " onclick = "CheckNot()">
<input name = "ensure" type="submit" value="submit" style="width:120px;height:40px;border:2px blue none;color:#fff;background: #000;position:absolute;right:60px;" onclick="return CheckFunc();">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
<script>
function CheckNot() {
if(confirm("When you leave this page the content all you type will disappear, do you want to leave?")){
window.location.href="./index_new.php#C#default";
}
}
function CheckFunc() {
msg = "";
if(document.forms[0].title.value == "") msg = "請輸入標題";
else if(document.forms[0].category.value == "") msg = "請選擇公開或隱藏";
else if(document.forms[0].stars.value == "") msg = "請評分難度";
else if(document.forms[0].content.value == "") msg = "請輸入內文";
else if(document.forms[0].code.value == "") msg = "請輸入程式";
else return true;
alert(msg);
return false;
}
</script>