function validcode($key, $time) { return time() - $time > 0 && time() - $time < 3600 && securitycode($time) == $key; }
$datafilehandle = fopen($datafile, "w"); fwrite($datafilehandle, unescape_quotes($_POST['text'])); fclose($datafilehandle); header('Location: ' . $deliciousroot . "admin"); } } print "<html><head>"; print "<title>Edit Bookmarks</title>"; print "<style>textarea { width:100%; height:75%; }</style>"; print "</head><body>"; print "<h1>Edit Bookmarks</h1>"; print "<form method='post'>"; print "<textarea name='text' cols='100' rows='40'>"; $datafilehandle = fopen($datafile, "r"); while (true) { $line = fgets($datafilehandle); if (strlen($line) == 0) { break; } clean_output($line); } fclose($datafilehandle); print "</textarea>"; print "<input type='submit' value='Save' />"; print "<input type='hidden' name='action' value='save'>"; print "Remember to leave a blank line at the end of the text."; print "<input name='time' type='hidden' value='" . $time . "' />"; print "<input name='key' type='hidden' value='" . securitycode($time) . "' />"; print "</form>"; footer($deliciousroot, ""); print "</body></html>";