-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsubmit.php
More file actions
25 lines (23 loc) · 928 Bytes
/
submit.php
File metadata and controls
25 lines (23 loc) · 928 Bytes
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
<?php
session_start();
$_SESSION[id] = intval($_SESSION[id]);
require("config.php");
require("functions/db.php");
require("functions/links.php");
require("functions/forms.php");
require("functions/common.php");
if($_SESSION[id] == 0) { header("Location: ".PREFIX); } // Redirect to index if we aren't logged in.
checkLogin($_SESSION[id]);
printHeader();
if($_POST) {
$input = cleanLink($_POST); // Sanitize the input
if(!linkErrors($input)) { // Post/edit the link and redirect to the comment page
$linkid = sendLink($input);
if($_POST[edit]) { $linkid = intval($_POST[edit]); }
if(REWRITE == 'on') { header("Location: ".PREFIX."category/$input[cat]/comments/" . base36($linkid)); }
else { header("Location: ".PREFIX."comments.php?category=$input[cat]&linkid=" . base36($linkid)); }
}
$errors = linkErrors($input); // Output error messages
}
print "<section class=loginform>";
print(linkform($errors,$input));