<?
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
| ID | Author/Program | Comment | Date |
|---|---|---|---|
| 278 | #1000604 (pitcher) | 2015-08-18 00:54:00 | |
| 232 | #1000610 (pitcher) | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { <? 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"; ?> }} | 2015-08-18 00:52:14 |
| 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: | 1334 / 242 |
| Referenced in: | #3000382 - Answer for ferdie (>> t = 1, f = 0) |