Cleaned up PHP
parent
7a54467bed
commit
6857bed981
|
@ -1,16 +0,0 @@
|
|||
<?
|
||||
// All the asset server specific stuff lives here
|
||||
|
||||
// The asset server's relative URL to the root of the webserver
|
||||
// If you place this at http://servername/assets then this would be set to /assets/index.php
|
||||
// wikipedia style URLs need to be implemented - and will be (en.wikipedia.org/wiki/blabla rather than en.wikipedia.org/wiki/index.php?something=bla or en.wikipedia.org/wiki.php/bla)
|
||||
$asset_home = "/ogs/assetserver/";
|
||||
|
||||
// The key we expect from sims
|
||||
$sim_recvkey = "1234";
|
||||
|
||||
// The path where the asset repository is stored, this should be readable by the webserver but NOT in the document root
|
||||
// The default below is BAD for production use and intended to be simply generic - change it or risk copyright theft
|
||||
// greater than you could ever imagine, alternatively use .htaccess or other mechanisms.
|
||||
$asset_repos = "/usr/local/sites/osgrid.org/web/ogs/assetserver/assets";
|
||||
?>
|
|
@ -1,25 +0,0 @@
|
|||
<?
|
||||
error_reporting(0); // Remember kids, PHP errors kill XML-RPC responses and REST too! will the slaughter ever end?
|
||||
|
||||
include("assetserver_config.inc.php");
|
||||
|
||||
// Parse out the parameters from the URL
|
||||
$params = str_replace($asset_home,'', $_SERVER['REQUEST_URI']);
|
||||
$params = str_replace("index.php/","",$params);
|
||||
$params = split('/',$params);
|
||||
|
||||
// Die if the key doesn't match
|
||||
if($params[1]!=$sim_recvkey) {
|
||||
die();
|
||||
}
|
||||
|
||||
// Send requested data
|
||||
switch($params[0]) {
|
||||
case 'getasset':
|
||||
if($params[3]=="data") {
|
||||
Header("Content-Length: ". (string)filesize($asset_repos . "/" . $params[2] . "/data"));
|
||||
readfile($asset_repos . "/" . $params[2] . "/data");
|
||||
}
|
||||
break;
|
||||
}
|
||||
?>
|
|
@ -1,5 +0,0 @@
|
|||
Options +FollowSymlinks
|
||||
|
||||
RewriteEngine on
|
||||
RewriteOptions MaxRedirects=1
|
||||
RewriteRule .* index.php [L]
|
|
@ -1,85 +0,0 @@
|
|||
<?
|
||||
// DIRTY HACK ALERT!!!!!!!!!!!!!
|
||||
// The following code shows the vital importance of the r69 revision of the original gareth/ branch
|
||||
|
||||
|
||||
// This file parses URLs of the format:
|
||||
// usersessions/key/userid/data
|
||||
// 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
|
||||
// if the data requested is left out, an XML response will be sent
|
||||
|
||||
error_reporting(E_ALL); // Remember kids, PHP errors kill XML-RPC responses and REST too! will the slaughter ever end?
|
||||
|
||||
include("../gridserver_config.inc.php");
|
||||
include("../../common/database.inc.php");
|
||||
include("../../common/util.inc.php");
|
||||
|
||||
// Parse out the parameters from the URL
|
||||
$params = str_replace($grid_home,'', $_SERVER['REQUEST_URI']);
|
||||
$params = str_replace("index.php/","",$params);
|
||||
$params = split('/',$params);
|
||||
|
||||
// Die if the key doesn't match
|
||||
if($params[1]!=$sim_recvkey) {
|
||||
die();
|
||||
}
|
||||
|
||||
$link = mysql_connect($dbhost,$dbuser,$dbpasswd)
|
||||
OR die("Unable to connect to database");
|
||||
|
||||
mysql_select_db($dbname)
|
||||
or die("Unable to select database");
|
||||
|
||||
$agent_id = strtolower($params[2]);
|
||||
$query = "SELECT * FROM sessions WHERE agent_id='$agent_id' AND session_active=1";
|
||||
|
||||
// if we have 4 params, then param 4 is the command
|
||||
if(count($params)==4) {
|
||||
$cmd=$params['3'];
|
||||
} else if(count($params)==5) {
|
||||
$circuit_code=$params[3];
|
||||
$cmd=$params[4]; // otherwise, 5 is the command and 4 is the circuit code
|
||||
}
|
||||
|
||||
$result = mysql_query($query);
|
||||
if(mysql_num_rows($result)>0) {
|
||||
$info=mysql_fetch_assoc($result);
|
||||
$circuit_code = $info['circuit_code'];
|
||||
if($circuit_code == 0) $circuit_code=$params['4'];
|
||||
$secure_session_id=$info['secure_session_id'];
|
||||
$session_id=$info['session_id'];
|
||||
|
||||
$query = "SELECT * FROM local_user_profiles WHERE userprofile_LLUUID='$agent_id'";
|
||||
$result=mysql_query($query);
|
||||
$userinfo=mysql_fetch_assoc($result);
|
||||
$firstname=$userinfo['profile_firstname'];
|
||||
$lastname=$userinfo['profile_lastname'];
|
||||
$agent_id=$userinfo['userprofile_LLUUID'];
|
||||
$exists=1;
|
||||
} else {
|
||||
$exists=0;
|
||||
}
|
||||
|
||||
// if only 3 params, assume we are sending an XML response
|
||||
if(count($params)==3) {
|
||||
output_xml_block("usersession",Array(
|
||||
'authkey' => $sim_sendkey,
|
||||
'circuit_code' => $circuit_code,
|
||||
'agent_id' => $agent_id,
|
||||
'session_id' => $session_id,
|
||||
'secure_session_id' => $secure_session_id,
|
||||
'firstname' => $firstname,
|
||||
'lastname' => $lastname
|
||||
));
|
||||
}
|
||||
|
||||
switch($cmd) {
|
||||
case 'exists':
|
||||
echo $exists;
|
||||
break;
|
||||
case 'delete':
|
||||
$query = "UPDATE sessions SET session_active=0, session_end=NOW() WHERE agent_id='$agent_id' LIMIT 1";
|
||||
$deleteresult = mysql_query($query);
|
||||
break;
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue