corrade-http-templates – Blame information for rev 15
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
15 | eva | 1 | <?php |
2 | |||
3 | ########################################################################### |
||
4 | ## Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3 ## |
||
5 | ########################################################################### |
||
6 | ## This is a script that gives an inventory item by UUID to an agent ## |
||
7 | ## specified by firstname and lastname. ## |
||
8 | ########################################################################### |
||
9 | |||
10 | if(!isset($_POST['uuid']) || |
||
11 | !isset($_POST['firstname']) || |
||
12 | !isset($_POST['lastname'])) return; |
||
13 | |||
14 | $uuid = $_POST['uuid']; |
||
15 | $firstname = $_POST['firstname']; |
||
16 | $lastname = $_POST['lastname']; |
||
17 | |||
18 | ########################################################################### |
||
19 | ## CONFIGURATION ## |
||
20 | ########################################################################### |
||
21 | |||
22 | require_once('config.php'); |
||
23 | require_once('functions.php'); |
||
24 | |||
25 | ########################################################################### |
||
26 | ## INTERNALS ## |
||
27 | ########################################################################### |
||
28 | |||
29 | |||
30 | #### |
||
31 | # I. Send the command to give the avatar the item. |
||
32 | $params = array( |
||
33 | 'command' => 'give', |
||
34 | 'group' => $GROUP, |
||
35 | 'password' => $PASSWORD, |
||
36 | 'item' => $uuid, |
||
37 | 'entity' => 'avatar', |
||
38 | 'firstname' => $firstname, |
||
39 | 'lastname' => $lastname |
||
40 | ); |
||
41 | array_walk($params, |
||
42 | function(&$value, $key) { |
||
43 | $value = rawurlencode($key)."=".rawurlencode($value); |
||
44 | } |
||
45 | ); |
||
46 | $postvars = implode('&', $params); |
||
47 | if (!($curl = curl_init())) { |
||
48 | print 0; |
||
49 | return; |
||
50 | } |
||
51 | curl_setopt($curl, CURLOPT_URL, $URL); |
||
52 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
||
53 | curl_setopt($curl, CURLOPT_POST, true); |
||
54 | curl_setopt($curl, CURLOPT_POSTFIELDS, $postvars); |
||
55 | curl_setopt($curl, CURLOPT_ENCODING, true); |
||
56 | $result = curl_exec($curl); |
||
57 | curl_close($curl); |
||
58 | |||
59 | #### |
||
60 | # II. Process the success status and display any error. |
||
61 | $success = urldecode( |
||
62 | wasKeyValueGet( |
||
63 | "success", |
||
64 | $result |
||
65 | ) |
||
66 | ); |
||
67 | |||
68 | if($success == 'False') { |
||
69 | echo 'Unable to give inventory item: '.urldecode( |
||
70 | wasKeyValueGet( |
||
71 | "error", |
||
72 | $result |
||
73 | ) |
||
74 | ); |
||
75 | die; |
||
76 | } |
||
77 | |||
78 | ?> |
||
79 |