[php]<?php
$headers = apache_request_headers();
//$objectgrid = $headers[“X-SecondLife-Shard”];
$objectname = $headers[“X-SecondLife-Object-Name”];
$objectkey = $headers[“X-SecondLife-Object-Key”];
//$objectpos = $headers[“X-SecondLife-Local-Position”];
$ownerkey = $headers[“X-SecondLife-Owner-Key”];
$ownername = $headers[“X-SecondLife-Owner-Name”];
$regiondata = $headers[“X-SecondLife-Region”];
//$regiontmp = explode ("(",$regiondata); // cut cords off
$regionpos = explode (")",$regiontmp[1]); //
//$regionname = substr($regiontmp[0],0,-1); // cut last space from simname*/
include “getconfig.php”;
mysql_connect($server, $mysql_user, $mysql_pass) or die(“Failed to connect to the database”);
mysql_select_db($mysql_db) or die(“Couldn’t select database”);
if($_POST[‘md5’] != md5(“7053e70ab4d312b725b1bfb946f1b5ce$objectkey:27485555”) )
{
die(“bad hash|”.$ownername);
}
if ($_POST['ACTION'] == "STATIONCHECK")
{
$stationname = $_POST['STATIONNAME']; $name = $_POST['NAME'];
$query = "SELECT * from craftingstations where station_name = '$stationname'";
$aresult = mysql_query($query);
if (!$aresult) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$prim_row = mysql_fetch_array($aresult,MYSQL_NUM);
for ($i = 0; $i < (count($prim_row)); $i++)
{
if ($i == 1)
{
//this is the area with issue (testing outside for to ensure not another issue
$query = "SELECT * from craftresponse where chatname = '$prim_row[1]'";
//when rename this $query to $thequery and echo $thequery replies with: SELECT * from craftresponse where chatname = 'Wheat Bread'
//Code works fine if I don't use the variable and type Wheat Bread direct
//"SELECT * from craftresponse where chatname = Wheat Bread"; works perfectly.....
$result = mysql_query($query); //if echo this result I get a proper Resource id #5
$info = mysql_fetch_array($result,MYSQL_ASSOC); //if echo $info with no association it returns nothing not even Array....
$lvltype = $info["leveltype"];
//end issue area
$thequery = "SELECT * from user_levels where name = '$name'";
$dresult = mysql_query($query); $userlevels = mysql_fetch_array($dresult,MYSQL_ASSOC);
$userlvl = $userlevels[$lvltype];
$info = array();
$prim_row = array_filter($prim_row);
$newdata .= $prim_row[$i] ."|";
//want to use the $lvltype to make an if here with the $userlvl to check if user has level requirement
//but no point in adding if until $info loads with data....
}
else
{
$prim_row = array_filter($prim_row);
$newdata .= $prim_row[$i] ."|";
}
}
//trying to test using only this to confirm
$query = "SELECT * from craftresponse where chatname = '$prim_row[1]'";
$result = mysql_query($query); $info = mysql_fetch_array($result,MYSQL_ASSOC);
$lvltype = $info["leveltype"];
echo $info;
//end testing
// echo $newdata;
}
?>
[/php]