if ($_POST['verify']) { $quotes = $_POST['quotes']; parseQuotes($quotes, 1); } else { if ($_POST['logout']) { unset($_SESSION['loggedin']); } } } } else { ?> <p>Sorry, but I didn't think it would be a great idea if anyone could pop quotes into the database. Clearly other things could get in there... Log in below if I've given you access. kthxbai</p> <p>Password? <input type="password" name="password" /> <input type="submit" name="login" value="GIMME ACCESS" /></p> <?php // This is probably crappy but w/e if ($_POST['login']) { if (md5($_POST['password']) == $pass) { $_SESSION['loggedin'] = true; } else { echo "<p>Log in failed. You suck</p>"; } } else { if ($_SERVER['QUERY_STRING'] != "") { $fake = preg_replace("/[\\w\\d]+=([\\w\\d]+)/", "\${1}", $_SERVER['QUERY_STRING']); echo "<p>Do you really think I would use GET with a password? I'm hurt :(</p><p>And no, the password is not '" . $fake . "'."; } } } echo "</form>"; $Q->disconnect(); include 'footer.php';
// Need to search by term/year too // Need new search/better. search should accept "stuff?stuff?" or something $quotes = $update->getQuotes($_POST['search']); echo "<table><tr><th>Quote</th><th>Prof</th><th>Course</th><th>Term/Year</th></tr>\n"; foreach ($quotes as $quote) { echo "<tr><td><input type='text' name='quote[]' value=\"" . $quote['quote'] . "\" /></td>"; echo "<td><input type='text' name='prof[]' value='" . $quote['prof'] . "' /></td>"; echo "<td><input type='text' name='course[]' value='" . $quote['course'] . "' /></td>"; echo "<td><select name='term[]'><option>" . $quote['term'] . "</option><option>Winter</option><option>Spring</option><option>Fall</option></select> "; echo "<input type='text' name='year[]' value='" . $quote['year'] . "' /></td></tr>"; } echo "</table>"; echo "<input type='submit' name='update' value='Update Quotes' />"; } else { if ($_POST['update']) { echo "<pre>"; print_r($_POST); echo "</pre>"; foreach ($_POST['quote'] as $quote) { echo "<p>" . $quote . " " . $prof . " " . $course . " " . $term; } } } $update->disconnect(); } else { ?> <p>You need the password to enter this area. <a href="parser.php">Try here</a></p> <?php } include 'footer.php';