Skip to content
This repository
tree: a943598a3c
Fetching contributors…

Cannot retrieve contributors at this time

file 67 lines (56 sloc) 2.339 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
<?php

include("dbconfig.php");
$path = explode("/",$_SERVER['REQUEST_URI']);
include("settings_".$path[count($path)-2].".php");

// connect to db
$link = mysql_connect($hostname, $username, $password) or die(mysql_error());
mysql_select_db($database, $link);

$slot = mysql_real_escape_string($_GET['slot']);

// build the SQL string for the query, use $mainhand and $offhand from settings.php
// greater essence slot can be filled with lesser essences
if($slot=="mainhand") $slot = $mainhand;
else if($slot=="offhand") $slot = $offhand;
else if($slot=="greater") $slot = "slot='greater' or slot='lesser'";
else $slot = "slot='$slot'";
$result = mysql_query("SELECT itemid,name,source,sourcename,sourcelocation FROM items WHERE (".$slot.") AND itemid IN (SELECT itemid FROM class WHERE ".$spec."='1') ORDER BY name");

while ($record = mysql_fetch_assoc($result))
{
$aName[] = stripslashes($record['name']);
$source = $record['source'];
$sourcename = stripslashes($record['sourcename']);
$sourcelocation = stripslashes($record['sourcelocation']);
if($source=="mob") $source = "Dropped by ".$sourcename." in ".$sourcelocation;
if($source=="quest") $source = "Quest: ".$sourcename;
if($source=="zone") $source = $sourcelocation." (Zone Drop)";
if($source=="vendor") $source = $sourcename;
if($source=="crafting") $source = "Crafted Item +".$sourcename;
if($source=="other") $source = $sourcename;
if($source==NULL) $source = "Unknown";
$aInfo[] = $source;
}
mysql_close($link);

$input = strtolower( $_GET['input'] );
$len = strlen($input);

$aResults = array();

if ($len)
{
for ($i=0;$i<count($aName);$i++)
{
if (strtolower(substr($aName[$i],0,$len)) == $input)
{
$aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aName[$i]), "info"=>htmlspecialchars($aInfo[$i]) );
}
}
}

header ("Expires: Mon, 1 Jan 1970 00:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header ("Content-Type: text/xml");

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?><results>";
for ($i=0;$i<count($aResults);$i++)
{
echo "<rs id=\"".$aResults[$i]['id']."\" info=\"".$aResults[$i]['info']."\">".$aResults[$i]['value']."</rs>";
}
echo "</results>";

?>
Something went wrong with that request. Please try again.