Revision 2271,
907 bytes
checked in by alexandrecorreia, 15 years ago
(diff) |
Ticket #986 - Reimplementar interface mais leve para o IM, sem a necessidades de plugins adicionais.
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[2271] | 1 | <?PHP |
---|
| 2 | /** Basic JSON Store php script. |
---|
| 3 | * You can use this if you have PHP installed, or implement your own. |
---|
| 4 | * |
---|
| 5 | * Note: this is only as secure as the session mechanism you use. |
---|
| 6 | * |
---|
| 7 | * TODO: define store interaction here |
---|
| 8 | * update removes keys with null values |
---|
| 9 | */ |
---|
| 10 | session_start(); |
---|
| 11 | if ($_REQUEST['set']) { |
---|
| 12 | $setArr = json_decode(stripslashes($_REQUEST['set'])); |
---|
| 13 | if ($setArr) { |
---|
| 14 | foreach ($setArr as $key => $value) { |
---|
| 15 | $_SESSION[$key] = $value; |
---|
| 16 | } |
---|
| 17 | print "OK"; |
---|
| 18 | } else { |
---|
| 19 | print "Error " . $_REQUEST['set']; |
---|
| 20 | } |
---|
| 21 | } elseif ($_REQUEST['get']) { |
---|
| 22 | foreach (split(",", $_REQUEST['get']) as $getvar) { |
---|
| 23 | $return_array[$getvar] = $_SESSION[$getvar]; |
---|
| 24 | } |
---|
| 25 | print json_encode($return_array); |
---|
| 26 | } elseif ($_REQUEST['del']) { |
---|
| 27 | foreach (split(",", $_REQUEST['del']) as $getvar) { |
---|
| 28 | unset($_SESSION[$getvar]); |
---|
| 29 | } |
---|
| 30 | } else { |
---|
| 31 | print "JSONStore"; |
---|
| 32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.