<?
header("Content-type: text/plain");
include('../tb/tb.inc.php');
$username = $_REQUEST['user'];
$password = $_REQUEST['pass'];
$ip = $_SERVER['REMOTE_ADDR'];
$id = intval($_REQUEST['id']);
$progid = intval($_REQUEST['progid']);
$text = $_REQUEST['text'];
if ($username)
quicklogin($username, $password);
echo "user_id=$user_id\n";
if (!$id) die("Nothing to do.");
if (!$progid) die("Need prog ID.");
$where = "c_snippetid=$id and c_programid=$progid";
dbDo("start transaction");
$oldText = dbSingleValue("select c_text from tb_comment where $where");
if (!strcmp($oldText, $text)) die ("Text unchanged!");
# save old comment
dbUpdate("insert into tb_comment_old
(c_snippetid, c_programid, c_author, c_modified, c_text)
select c_snippetid, c_programid, c_author, c_modified, c_text
from tb_comment where $where");
# delete
dbDo("delete from tb_comment where $where");
# update
$commentID = dbInsert("insert into tb_comment set
c_snippetid=$id,
c_programid=$progid,
c_clientip=".dbQuote($clientIP).",
c_created=now(),
c_modified=now(),
c_text=".dbQuote($text).",
c_author=$user_id");
dbDo("commit");
echo "Done. Comment ID: $commentID";
?>Actual PHP code from web site. (tb-int/...)
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
2 comment(s) hidden. show
| Snippet ID: | #1000602 |
| Snippet name: | update-comment.php |
| Eternal ID of this version: | #1000602/1 |
| Text MD5: | 7bc579c1adbf886c74512a205fc3a35d |
| Author: | stefan |
| Category: | |
| Type: | Document |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-08-15 23:49:12 |
| Source code size: | 1224 bytes / 50 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1336 / 242 |
| Referenced in: | [show references] |