diff --git a/api/economy.php b/api/economy.php index 7d8e2ef..1ae4f6a 100644 --- a/api/economy.php +++ b/api/economy.php @@ -28,12 +28,6 @@ # updated for Robust installations: BlueWall 2011 # further minor changes by justincc (http://justincc.org) - # Settings - $dbhost = "172.21.0.10"; - $dbname = "Robust"; - $dbuser = "OpenSim"; - $dbpass = "fhsgd63tg27d"; - # Tables $presence = "Presence"; @@ -43,30 +37,19 @@ function validate_user($agent_id, $s_session_id) { - global $dbhost, $dbuser, $dbpass, $dbname; + $stmt = $RUNTIME['PDO']->prepare("SELECT UserID FROM Presence WHERE UserID=? AND SecureSessionID = ?"); + $stmt->execute(array($agent_id, $s_session_id)); - $agentid = mysql_escape_string($agent_id); - $sessionid = mysql_escape_string($s_session_id); + if($stmt->rowCount() == 0) { + return false; + } - $link = mysql_connect($dbhost, $dbuser, $dbpass) - or die('ERROR: '.mysql_error()); - - mysql_select_db($dbname); - - $query = "select UserID from Presence where UserID='".$agentid."' and SecureSessionID = '".$sessionid."'"; - - $result = mysql_query($query) - or die('ERROR: '.mysql_error()); - - $row = mysql_fetch_assoc($result); - - return $row['UserID']; + $res = $stmt->fetch(); + return $res['UserID']; } function buy_land_prep($method_name, $params, $app_data) { - global $dbhost, $dbuser, $dbpass, $dbname; - $confirmvalue = ""; $req = $params[0]; $agentid = $req['agentId'];