Making items buyable or not from the item shop ingame
just click the button to SET it to the shop or TAKE IT from it.
PHP Code:
<?php
$host = 'localhost';
$mysqlUser = 'root'; //Edit between the ' ' with your MySQL database connection username
$mysqlPassword = ''; //Edit between the ' ' with your MySQL database connection password
$mysqlDATABASE = 'bots'; //Edit between the ' ' with your BOTS ONLINE database name (default: bots_revolution)
@mysql_connect($host, $mysqlUser, $mysqlPassword) or die(mysql_error()); // remove the @ to allow debug messages
@mysql_select_db($mysqlDATABASE) or die(mysql_error()); // remove the @ to allow debug messages
?>
<html>
<head>
<title>Setting/unsetting Buyable items</title>
</head>
<body>
<center>
Instructions: Click the "SET" button for the item to appear on the Item Shop. Clicking UNSET reverses it.
<table border="1" style="text-align: center;">
<tr style="font-style: bold;"><td>Item name</td><td>Req. Level</td><td>Buy price</td><td>Sell price</td><td>Coins price</td><td>Days sold for</td><td>Bot</td><td>Part</td><td>Bonus</td><td>Set to shop</td></tr>
<?php
$getItems = mysql_query("SELECT id, name, reqlevel, buyable, buy, sell, coins, days, bot, part, script FROM bout_items LIMIT 1000");
while($do = mysql_fetch_array($getItems)) {
print "<tr>";
$name = $do['name'];
print "<td>".$name."</td>";
print "<td>".$do['reqlevel']."</td>";
print "<td>".$do['buy']."</td>";
print "<td>".$do['sell']."</td>";
print "<td>".$do['coins']."</td>";
print "<td>".$do['days']."</td>";
$bot = $do['bot'];
switch($bot) {
case 1:
$bot = "Patch";
break;
case 2:
$bot = "Surge";
break;
case 3:
$bot = "Ram";
break;
}
print "<td>".$bot."</td>";
$parts = $do['part'];
switch($parts) {
case 1:
$parts = "Head";
break;
case 2:
$parts = "Body";
break;
case 3:
$parts = "Arm";
break;
}
print "<td>".$parts."</td>";
print "<td>".$do['script']."</td>";
$id = $do['id'];
$buyable = $do['buyable'];
switch($buyable) {
case 0:
print '<td><form method="post"><input type="submit" value="Set to shop" name="setItem'.$id.'">';
if(isset($_POST['setItem'.$id.''])) {
$setItem = mysql_query("UPDATE bout_items SET buyable = '1' WHERE name='$name'");
$page = $_SERVER['PHP_SELF'];
header('location: '.$page);
}
print '</td></form>';
break;
case 1:
print '<td><form method="post"><input type="submit" value="Take from shop" name="setItem'.$id.'">';
if(isset($_POST['setItem'.$id.''])) {
$setItem = mysql_query("UPDATE bout_items SET buyable = '0' WHERE name='$name'");
$page = $_SERVER['PHP_SELF'];
header('location: '.$page);
}
print '</form></td>';
break;
}
print "</tr>";
}
?>
</table>