-
Notifications
You must be signed in to change notification settings - Fork 0
/
codeRealTimeSaver.php
69 lines (63 loc) · 1.31 KB
/
codeRealTimeSaver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* @todo:
* @version
* 1.0
*/
require_once('common.php');
$my_report_id = -1;
require_once('incl-auth.php');
/*Init*/
/*$objData = array(
'myNewCodeName'=>"",
'myCodeName'=>""
);*/
/*$_GET['newCodeName'] ='';
$_GET['oldCodeName'] ='';
*/
/*Receive Data*/
/*$loadedCodeId = $_GET['loadedCodeId'];*/
$data = file_get_contents("php://input");
$objData = json_decode($data);
/*var_dump($objData->myCodeName);
var_dump($objData->myCodeOwner);
var_dump($objData->myCodeBody);
var_dump($objData->myCodeCreateDate);*/
$db = db::logs();
$sql = "
UPDATE php_console_history_beta_mycode
SET
myCodeBody = '$objData->myCodeBody'
WHERE
myCodeId='$objData->myCodeId';
";
$db = db::logs();
$res = $db->query( $sql );
if(!$res){echo ("res for update is not found!");}else{echo ("Success!");};
/*$sql = "
SELECT
myCodeId,
myCodeName,
myCodeOwner,
myCodeBody,
myCodeTimesUsedCount,
myCodeValueAsMins,
myCodeCreateDate,
myCodeLastEditDate,
isSnippet,
isDeleted,
isMyFavorite
FROM
php_console_history_beta_mycode
WHERE
myCodeOwner = '$objData->myCodeOwner'
ORDER BY
myCodeLastEditDate DESC
LIMIT 1
";
$res = $db->query( $sql );
if(!$res){echo ("res for select is not found!");}
$result = $res->fetch_object();
$objData = json_encode($result);
echo $objData;*/
?>