summaryrefslogtreecommitdiff
path: root/post.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-04-23 00:38:25 +1000
committerSavetheinternet <savetheinternet@n0v4.com>2011-04-23 00:38:25 +1000
commit2ac8dc2c0fff26265ab911440b66e4a51923c173 (patch)
tree2bccdd043c264be9b0ec25945c7c4ae6ef81a03f /post.php
parente7a0eb14f4171943d4ab034d751bd74cfb5dd788 (diff)
cleanup
Diffstat (limited to 'post.php')
-rw-r--r--post.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/post.php b/post.php
index d0474838..9da9d96d 100644
--- a/post.php
+++ b/post.php
@@ -36,7 +36,7 @@
}
}
- sql_open();
+
// Check if banned
checkBan();
@@ -97,7 +97,7 @@
}
}
- sql_open();
+
// Check if banned
checkBan();
@@ -176,9 +176,6 @@
if(time()-$user['appeared']<LURKTIME) error(ERROR_LURK);
*/
- // Open database connection
- sql_open();
-
// Check if banned
checkBan();
@@ -487,15 +484,17 @@
buildIndex();
- // Tell Javascript that we posted successfully
- if(isset($_COOKIE[$config['cookies']['js']]))
- $js = json_decode($_COOKIE[$config['cookies']['js']]);
- else
- $js = (object) Array();
- // Tell it to delete the cached post for referer
- $js->{$_SERVER['HTTP_REFERER']} = true;
- // Encode and set cookie
- setcookie($config['cookies']['js'], json_encode($js), 0, $config['cookies']['jail']?$config['cookies']['path']:'/', null, false, false);
+ if(isset($_SERVER['HTTP_REFERER'])) {
+ // Tell Javascript that we posted successfully
+ if(isset($_COOKIE[$config['cookies']['js']]))
+ $js = json_decode($_COOKIE[$config['cookies']['js']]);
+ else
+ $js = (object) Array();
+ // Tell it to delete the cached post for referer
+ $js->{$_SERVER['HTTP_REFERER']} = true;
+ // Encode and set cookie
+ setcookie($config['cookies']['js'], json_encode($js), 0, $config['cookies']['jail']?$config['cookies']['path']:'/', null, false, false);
+ }
$root = $post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
@@ -514,7 +513,7 @@
exit;
} else {
if(!file_exists($config['has_installed'])) {
- sql_open();
+
// Build all boards
$boards = listBoards();