Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- inventoryObjects.php is a script used to grab the values
- of an inventory object and output it so that Simba can read the
- webpage and apply them to a variable in-script
- */
- $username = "[redacted]"; //predefined user and pass
- $password = "[redacted]";
- $db_name = "[redacted]"; //name of the db
- $table = "[redacted]"; //name of the table
- $serverIP = "[redacted]";
- $invObj = str_replace("_", " ", $_GET['name']);
- //connects to the database based on the above parameters
- $database = new mysqli ($serverIP, $username, $password, $db_name);
- if ($database -> connect_errno)
- {
- //if there is an error, print this so simba can read it and
- //terminate, instead of attempting something stupid
- Die(printF("Error: Connect failed. Reason: %s/n", $database -> connect_errno));
- }
- $database -> select_db($table);
- //generates query to get the object's data
- $query = "SELECT * FROM $table WHERE name = '$invObj' LIMIT 1";
- //does the query
- if ($result = $database -> query($query))
- {
- if (($result -> num_rows) <= 0)
- {
- printF("Error. No inventory object named \"%s\" exists in the database.", $invObj);
- }else
- {
- $row = $result -> fetch_assoc();
- printF("Successfully completed query!<br />name = %s<br />mainText = %s<br />normDTM = %s<br />noteDTM = %s<br />height = %d<br />width = %d<br />outlineCount = %d<br />convexity = %s<br />family = %s<br />stacks = %s<br />stacksInBank = %s<br />tradeable = %s<br />value = %d<br />highAlchValue = %d<br />lowAlchValue = %s<br />", $row['name'], $row['mainText'], str_replace(" ", "+", $row['DTM']), str_replace(" ", "+", $row['noteDTM']), $row['height'], $row['width'], $row['outlineCount'], $row['convexity'], $row['family'], $row['stacks'], $row['stacksInBank'], $row['tradeable'], $row['value'], $row['highAlchValue'], $row['lowAlchValue']);
- }
- $result -> close();
- }else
- {
- printF("Error. The query failed.");
- }
- $database -> close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement