forked from pavpanchekha/BCAMathTournament
/
index.php
49 lines (48 loc) · 1.1 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
<?php
$a = str_ireplace("\n", "", trim(htmlspecialchars($_POST["space"])));
if(strlen($a) != 0) {
file_put_contents("probs.txt", "[prob]".$a."[/prob]\n", FILE_APPEND);
$submitted = 1;
// increment
$x = intval(file_get_contents("count.txt"));
$x++;
file_put_contents("count.txt", $x."\n");
}
?>
<html>
<head>
<title>Problem Submissions</title>
<style type="text/css">
@import 's.css';
</style>
<script type="text/javascript">
function changeBg(a) {
document.submission.space.style.background = ((a)?'#FFFFE0':'white');
}
</script>
</head>
<body>
<h2>BCA Math Competition Problem Submissions</h2>
<?php
printf("So far there are <span style=\"font-weight: 600;\">".file_get_contents("count.txt")."</span> problems in the database.");
?>
<form name="submission" method="post" action="<?php echo $PHP_SELF; ?>">
<h3>Enter a Problem:</h3>
<textarea rows="5"
cols="80"
wrap="soft"
name="space"
onclick="changeBg(1)"
onBlur="changeBg(0)">
</textarea>
<br />
<input type="submit" value="Submit" />
</form>
<?php
if($submitted) {
printf("Thanks for your submission!\n");
$submitted = 0;
}
?>
</body>
</html>