aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ogs/gridserver/usersessions/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'ogs/gridserver/usersessions/index.php')
-rw-r--r--ogs/gridserver/usersessions/index.php85
1 files changed, 0 insertions, 85 deletions
diff --git a/ogs/gridserver/usersessions/index.php b/ogs/gridserver/usersessions/index.php
deleted file mode 100644
index e7a3817..0000000
--- a/ogs/gridserver/usersessions/index.php
+++ /dev/null
@@ -1,85 +0,0 @@
1<?
2// DIRTY HACK ALERT!!!!!!!!!!!!!
3// The following code shows the vital importance of the r69 revision of the original gareth/ branch
4
5
6// This file parses URLs of the format:
7// usersessions/key/userid/data
8// where key is the key to authenticate with the grid, userid is the user's LLUUID and data is the data about the user's session being requested
9// if the data requested is left out, an XML response will be sent
10
11error_reporting(E_ALL); // Remember kids, PHP errors kill XML-RPC responses and REST too! will the slaughter ever end?
12
13include("../gridserver_config.inc.php");
14include("../../common/database.inc.php");
15include("../../common/util.inc.php");
16
17// Parse out the parameters from the URL
18$params = str_replace($grid_home,'', $_SERVER['REQUEST_URI']);
19$params = str_replace("index.php/","",$params);
20$params = split('/',$params);
21
22// Die if the key doesn't match
23if($params[1]!=$sim_recvkey) {
24 die();
25}
26
27$link = mysql_connect($dbhost,$dbuser,$dbpasswd)
28 OR die("Unable to connect to database");
29
30mysql_select_db($dbname)
31 or die("Unable to select database");
32
33$agent_id = strtolower($params[2]);
34$query = "SELECT * FROM sessions WHERE agent_id='$agent_id' AND session_active=1";
35
36// if we have 4 params, then param 4 is the command
37if(count($params)==4) {
38 $cmd=$params['3'];
39} else if(count($params)==5) {
40 $circuit_code=$params[3];
41 $cmd=$params[4]; // otherwise, 5 is the command and 4 is the circuit code
42}
43
44$result = mysql_query($query);
45if(mysql_num_rows($result)>0) {
46 $info=mysql_fetch_assoc($result);
47 $circuit_code = $info['circuit_code'];
48 if($circuit_code == 0) $circuit_code=$params['4'];
49 $secure_session_id=$info['secure_session_id'];
50 $session_id=$info['session_id'];
51
52 $query = "SELECT * FROM local_user_profiles WHERE userprofile_LLUUID='$agent_id'";
53 $result=mysql_query($query);
54 $userinfo=mysql_fetch_assoc($result);
55 $firstname=$userinfo['profile_firstname'];
56 $lastname=$userinfo['profile_lastname'];
57 $agent_id=$userinfo['userprofile_LLUUID'];
58 $exists=1;
59} else {
60 $exists=0;
61}
62
63// if only 3 params, assume we are sending an XML response
64if(count($params)==3) {
65 output_xml_block("usersession",Array(
66 'authkey' => $sim_sendkey,
67 'circuit_code' => $circuit_code,
68 'agent_id' => $agent_id,
69 'session_id' => $session_id,
70 'secure_session_id' => $secure_session_id,
71 'firstname' => $firstname,
72 'lastname' => $lastname
73 ));
74}
75
76switch($cmd) {
77 case 'exists':
78 echo $exists;
79 break;
80 case 'delete':
81 $query = "UPDATE sessions SET session_active=0, session_end=NOW() WHERE agent_id='$agent_id' LIMIT 1";
82 $deleteresult = mysql_query($query);
83 break;
84}
85?>