I have a .php file loaded on my server that returns the current dkp for a user.
I am trying to get it to work from within innerspace as a script.
here is the working .php file.
how it would work is you would open up your browser and point it to the site.
www.dkpsite.com/currentdkp.php?name=Playername
and it would return the results for Playername.
Here is what I have come up with using the example from the Wiki.
so far i just want to be able to run currentdkp playername and have it echo back the results for playername.
Any help from anyone would be greatly appreciated.
I am trying to get it to work from within innerspace as a script.
here is the working .php file.
how it would work is you would open up your browser and point it to the site.
www.dkpsite.com/currentdkp.php?name=Playername
and it would return the results for Playername.
PHP:
<?php
$username="Username";
$password="PASSWORD";
$database="DATABASENAME";
// Make a MySQL Connection
$db = mysql_connect(localhost,$username,$password);
@mysql_select_db($database, $db) or die( "Unable to select database");
$name = stripslashes(strip_tags($_REQUEST['name']));
// Retrieve all the data from the "example" table
$query="SELECT (eqdkp_members.member_earned - eqdkp_members.member_spent) + eqdkp_members.member_adjustment AS member_current, eqdkp_members.member_name FROM eqdkp_members WHERE eqdkp_members.member_name = '$name' GROUP BY eqdkp_members.member_name ORDER BY eqdkp_members.member_name ASC";
//print $query . "\r\n";
//echo mysql_errno($db) . ": " . mysql_error($db). "\n";
// store the record of the "example" table into $row
$result=mysql_query($query) or die('stupid error: '.mysql_error());;
//echo mysql_errno($db) . ": " . mysql_error($db). "\n";
//echo "<pre>";
//var_dump($result);
//echo "</pre>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
//echo "<pre>";
//echo mysql_errno($db) . ": " . mysql_error($db). "\n";
// Print out the contents of the entry
echo "<b>Name:</b> ".$row['member_name'].
"<br><b>DKP:</b> ".$row['member_current'];
}
?>
Code:
/*
* Require MySQL module during preprocessing, so the variables can be created as part of script structure
* instead of using DeclareVariable
*/
#if !${LavishScript:LoadModule[MySQL](exists)}
#error MySQL module for LavishScript required.
#endif
function main()
{
variable mysql DB
variable mysqlresult Result
if !${DB:Connect[192.168.1.75,dkpbot,PASSWORD,dkpDB(exists)}
{
echo Could not connect to MySQL database
return
}
if !${DB:Query["SELECT (eqdkp_members.member_earned - eqdkp_members.member_spent) + eqdkp_members.member_adjustment AS member_current, eqdkp_members.member_name FROM eqdkp_members WHERE eqdkp_members.member_name = '$name' GROUP BY eqdkp_members.member_name ORDER BY eqdkp_members.member_name ASC",Result](exists)}
{
echo Query failed
return
}
while ${Result:FetchRow(exists)}
{
echo Player : ${Result.Getstring['member_name']}
echo DKP : ${Result.Getstring['member_current']}
}
}
Any help from anyone would be greatly appreciated.
Last edited: