//get the post $page['post'] = $pastebin->getPost($pid); if (!isset($page['post']['pid'])) { //post could not be loaded - return a 410 code, mainly for the //benefit of Google - this provides a positive indication that //the post is not coming back and that this is permanent header("HTTP/1.0 410 Gone"); //early bath if you're a robot $is_bot = preg_match('/bot|slurp/i', $_SERVER['HTTP_USER_AGENT']); if ($is_bot) { echo 'Pastebin post expired or deleted - <a href="http://pastebin.com/">click here to make a new post<a/>'; exit; } } if (!$is_admin) { $pastebin->outputExpiryHeaders($page['post']); } //see if we can be quick about this... if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && isset($page['post']['modified'])) { $since = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); if ($page['post']['modified'] <= $since) { header('HTTP/1.1 304 Not Modified'); exit; } } //can we erase? $page['can_erase'] = isset($page['post']['token']) && isset($page['token']) && $page['token'] == $page['post']['token']; //admin can always erase if (isset($_COOKIE['admin']) && $_COOKIE['admin'] == md5($CONF['admin'])) { $page['can_erase'] = true; }