Skip to content
Snippets Groups Projects
Commit 1d53b772 authored by Graham Cole's avatar Graham Cole
Browse files

make pastebin serve redirect to newly pasted items. closes #54

parent eae39279
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,8 @@ define('_SCRIPT_NAME', 'PasteBin/'); ...@@ -39,7 +39,8 @@ define('_SCRIPT_NAME', 'PasteBin/');
define('_TABLE_NAME', 'pastebin'); define('_TABLE_NAME', 'pastebin');
$smarty->assign('urifragment', '/Tools/PasteBin/'); $smarty->assign('urifragment', '/Tools/PasteBin/');
$smarty->assign('uri', 'http://'.$_SERVER['SERVER_NAME'].'/pb/'); $pburi = 'https://'.$_SERVER['SERVER_NAME'].$baseurl;
$smarty->assign('uri', $pburi.'/pb/');
// Init // Init
$id = ''; $id = '';
...@@ -168,6 +169,11 @@ if (isset($_POST['code'])) { ...@@ -168,6 +169,11 @@ if (isset($_POST['code'])) {
'INSERT INTO ' . _TABLE_NAME . ' ( id, code, username, retain_til, language) ' . 'INSERT INTO ' . _TABLE_NAME . ' ( id, code, username, retain_til, language) ' .
'VALUES (?, ?, ?, ?, ?)', 'VALUES (?, ?, ?, ?, ?)',
array( $id, $code, $session->username, $retainTil, $pblang)); array( $id, $code, $session->username, $retainTil, $pblang));
//bump user to uri of newly pasted item
header('Status: 303 See Other');
header("Location: $pburi/Tools/PasteBin/$id");
$userInfo = 'Created By ' . $session->username . ' at ' . date('Y/m/d H:i'); $userInfo = 'Created By ' . $session->username . ' at ' . date('Y/m/d H:i');
$smarty->assign('id', $id); $smarty->assign('id', $id);
$smarty->assign('userInfo', $userInfo); $smarty->assign('userInfo', $userInfo);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment