-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.php
188 lines (187 loc) · 6.4 KB
/
submit.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
<?php
session_start();
$included = true;
include("connect.php");
$cookieT = $_COOKIE['theme'];
include("style.php"); //Style thing.
$submitted = false;
if(isset($_COOKIE[submitted])) {
$submitted = $_COOKIE[submitted];
}
if(isset($_REQUEST[story])) {
$passCaptcha = true;
require_once('recaptchalib.php');
$privatekey = "lekey";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$passCaptcha = false;
}
}
if($passCaptcha) setcookie("submitted", true, time()+300);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="shortcut icon" href="/mlin.ico" type="image/x-icon"/>
<title>MLIN - My Life Is Nerdy | It's the Nerd Life - Submit a Story</title>
<script type="text/javascript" src="/Scripts/jquery.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function() {
<?php
if($submitted || $passCaptcha) {
?>
$("form#submission").slideUp("fast");
<?php
}
?>
});
//-->
</script>
<script type="text/javascript">
<!--
function buttonChange(name) {
document.getElementById(name).style.backgroundColor='<?php echo $button; ?>';
}
function buttonChangeBack(name) {
document.getElementById(name).style.backgroundColor='<?php echo $buttonBack; ?>';
}
function setSearch()
{
if(document.search.q.value == "") {
document.search.q.value = "Search";
}
}
function clearSearch() {
if(document.search.q.value == "Search") {
document.search.q.value = "";
}
}
// -->
</script>
<link rel="stylesheet" href="/<?php echo $theme; ?>" type="text/css" />
</head>
<body>
<div class="mainwrapper"><div class="main">
<?php
include("searcher.php");
?>
<a href="/" class="title">
<p class="title" style="font-size: 20px;">MyLifeIs<span class="title2">Nerdy</span><br />
<span class="color1" style="font-size: 15px; font-family: Arial;"> It's the Nerd Life. </span><a href="http://feeds.feedburner.com/mlin" target="_blank"><img style="border: 0px;" src="/Images/feed.gif" /></a></p></a>
<table style="width: 100%;" cellpadding=4px>
<!-- NAVIGATION -->
<!-- NAVIGATION -->
<!-- NAVIGATION -->
<tr class="navbar">
<td class="navigation" id="nav1">
<a title="localhost: 127.0.0.1" href="/" class="navbar" onmouseover="buttonChange('nav1')" onmouseout="buttonChangeBack('nav1')">
MyLifeIsNerdy</a>
</td>
<td class="navigation" id="nav2">
<a href="/vote" class="navbar" onmouseover="buttonChange('nav2')" onmouseout="buttonChangeBack('nav2')">
Vote On Submissions</a>
</td>
<td class="navigation nSelected" id="nav3">
<a href="/submit" class="navbarSelected" onmouseover="buttonChangeBack('nav3')" onmouseout="buttonChange('nav3')">
Submit a Story</a>
</td>
<td class="navigation" id="nav4">
<a href="http://forums.mylifeisnerdy.co.cc/" target="_blank" class="navbar" onmouseover="buttonChange('nav4')" onmouseout="buttonChangeBack('nav4')">
Forums</a>
</td>
<td class="navigation" id="nav5">
<a href="/about" class="navbar" onmouseover="buttonChange('nav5')" onmouseout="buttonChangeBack('nav5')">
About Us</a>
</td>
</tr>
<!-- END NAVIGATION -->
<!-- END NAVIGATION -->
<!-- END NAVIGATION -->
</table>
<?php
include("wotd2.php");
?>
<br />
<!-- SUBMIT -->
<!-- SUBMIT -->
<!-- SUBMIT -->
<span class="color2">
<center><h2>Submit a Story!</h2></center>
<div style="margin-left: 30px;">
<h2>What's This?</h2>
<ul>
<li>Do us a favor and start with "Today", end with "MLIN" or "MLIN."</li>
<li>Other useless criteria goes here.</li>
<li>You know what to do.</li>
</ul>
<br />
<?php
if(isset($_REQUEST[story])) {
if(!$passCaptcha) {
echo "Sorry, you typed the Captcha wrong, try again.";
}
if($passCaptcha && !$submitted) {
$story3 = trim($_POST[story]);
$type = str_replace("'","'",$_REQUEST[type]);
$startwith = array("the game ", "pokemon", "Pokemon", "dog ", "mlin", "Mlin", "/b/", "\"", "'", " i ");
$replacewith = array("the game (I just lost) ", "pokémon", "Pokémon", "cat ", "MLIN", "MLIN", "(1 & 2)", """, "'", " I ");
$story3 = str_replace($startwith, $replacewith, nl2br(htmlspecialchars ($story3, ENT_QUOTES, 'UTF-8')));
$sql = "INSERT INTO submit VALUES(NOW(),'$story3','0','0','$type','$_SESSION[user]', '$_SERVER[REMOTE_ADDR]')";
mysql_query($sql, $con) or die(mysql_error() . $sql);
echo "Congratulations! You have submitted a story. Now go away. In fact, you should go away, because you can no longer submit another story for the next 5 minutes. So ha!<br /><br /><br />";
}
if($submitted) {
echo "Naughty, naughty, stop trying to submit. Wait 5 minutes.<br /><br /><br /><br />";
}
}
else {
if($submitted) {
echo "Wait more.<br /><br /><br /><br /><br />";
}
}
?>
<form accept-charset="utf-8" action="/submit" method="post" id="submission">
Story:<br />
<textarea name="story" rows="10" cols="105"><?php echo htmlspecialchars(str_replace('\"','"',str_replace("\'","'",$_REQUEST[story])), ENT_QUOTES, 'UTF-8'); ?></textarea><br /><br />
Category:<br />
<select name="type">
<option value="Academic">Academic</option>
<option value="Anime/Manga">Anime/Manga</option>
<option value="Comics">Comics</option>
<option value="Computers - Hardware">Computers - Hardware</option>
<option value="Computers - Software">Computers - Software</option>
<option value="Gamers">Gamers</option>
<option value="I Don't Know" selected="selected">I Don't Know</option>
<option value="Interwebz">Interwebz</option>
<option value="Literary">Literary</option>
<option value="Music">Music</option>
<option value="Nerd Love">Nerd Love</option>
<option value="Other">Other</option>
<option value="Robotics">Robotics</option>
<option value="Doctor Who">Television - Doctor Who</option>
<option value="Firefly">Television - Firefly</option>
<option value="TV - Other">Television - Other</option>
<option value="Trekkies">Trekkies</option>
</select>
<input type="submit" value="Submit" /><br /><br />
<?php
require_once('recaptchalib.php');
$publickey = "lekey"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
</form>
</div>
</span>
<!-- END SUBMIT -->
<!-- END SUBMIT -->
<!-- END SUBMIT -->
</div>
<?php
include('footer.php');
?>
</div></body>
</html>