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

remove buggy method for obtaining ID of just-pasted item. closes #55

parent 7c823d0b
No related branches found
No related tags found
No related merge requests found
...@@ -163,12 +163,11 @@ if (isset($_POST['code'])) { ...@@ -163,12 +163,11 @@ if (isset($_POST['code'])) {
} else { } else {
// Additional user validation needed here // Additional user validation needed here
//$retainTil = date('Y/m/d H:i:s', time() + $retain); //$retainTil = date('Y/m/d H:i:s', time() + $retain);
$id = $DB->GetOne("SELECT nextval('pastebin_id_seq'::regclass)");
$DB->Execute( $DB->Execute(
'INSERT INTO ' . _TABLE_NAME . ' ( code, username, retain_til, language) ' . 'INSERT INTO ' . _TABLE_NAME . ' ( id, code, username, retain_til, language) ' .
'VALUES (?, ?, ?, ?)', 'VALUES (?, ?, ?, ?, ?)',
array( $code, $session->username, $retainTil, $pblang)); array( $id, $code, $session->username, $retainTil, $pblang));
//$id = $DB->Insert_ID();
$id = $DB->GetOne('SELECT id FROM ' . _TABLE_NAME . ' WHERE code = ? AND username = ? AND retain_til = ?', array($code,$session->username,$retainTil));
$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