<?php require_once 'sql.php'; header('Content-Type: text/html; charset=utf-8'); session_start(); $login = $_SESSION['zalogowany']; $loginId = GetValue("select `id` from user where login = '******'"); echo "<table>"; $tab = GetPacket("select speed, str, agi, live from `character` where userid = '{$loginId}'"); $stat = array('Szybkość', 'siła', 'Zręczność', 'Życie'); $i = 0; foreach ($tab[0] as $row) { echo "<tr><td>{$stat[$i]}</td>"; echo "<td>" . $row . " </td>"; echo "<td><a href='staty.php?stat={$i}'>+</a> </td></tr>"; $i++; } echo "</table>"; $statsik = $_GET['stat']; $licz = $tab[0][$statsik] + 1; $AP = GetValue("select ap from `CHARACTER` where userid='{$loginId}'"); echo "<p>AP: {$AP}</p>"; if (isset($statsik) && $AP > 0) { $AP--; switch ($statsik) { case 0: ex("update `character` set speed = {$licz}, ap={$AP} where userid='{$loginId}'"); break; case 1: ex("update `character` set str = {$licz}, ap={$AP} where userid='{$loginId}'"); break;
echo "<tr><td>nazwa</td><td>bonus</td><td>minus</tr><tr>"; for ($i = 0; $i < count($tab); $i++) { echo ' <tr>'; foreach ($tab[$keys[$i]] as $key => $value) { $itemId = GetPacket("select it.id from items it join inventory inv on it.id = inv.itemId where inv.charId='{$login}' and it.itemType=0 and inv.use=0"); echo "<td>" . $value . " </td> "; } echo "<td> <a href = inventory.php?item=" . $itemId[$i][0] . ">Załóż</a></td></tr>"; } $pytanie = "select nazwa, bonus, minus from items it join inventory inv on it.id = inv.itemId where inv.charId='{$login}' and it.itemType=1 and inv.use=0"; $tab = GetPacket($pytanie); $keys = array_keys($tab); echo "</tr></table><p>Pancerze:</p><table>"; echo "<tr><td>nazwa</td><td>bonus</td><td>minus</tr><tr>"; for ($i = 0; $i < count($tab); $i++) { echo ' <tr>'; foreach ($tab[$keys[$i]] as $key => $value) { $itemId = GetPacket("select it.id from items it join inventory inv on it.id = inv.itemId where inv.charId='{$login}' and it.itemType=1 and inv.use=0"); echo "<td>" . $value . " </td> "; } echo "<td> <a href = inventory.php?item=" . $itemId[$i][0] . ">Załóż</a></td></tr>"; } echo "</table>"; $item = $_GET['item']; if (isset($item)) { ex("update inventory set `use` = TRUE where charid = '{$login}' and id = '{$item}'"); } ?> <a href="Main.php">Wroc</a>
<?php session_start(); $login = $_SESSION['zalogowany']; require_once 'sql.php'; $pytanie = "select nazwa, bonus, minus, cena from items"; $tab = GetPacket($pytanie); $keys = array_keys($tab); echo "<table>"; for ($i = 0; $i < count($tab); $i++) { echo "<tr>"; foreach ($tab[$keys[$i]] as $key => $value) { echo "<td>" . $value . " </td>"; } echo "<td>" . "<a href='bazar.php?item={$i}'>kup</a>" . " </td>"; echo "</tr>"; } echo "</table>"; $item = $_GET['item']; if (isset($item)) { $money = GetValue("select gold from `character` cha join user us on cha.userid=us.id where us.login = '******'"); $koszt = GetValue("select cena from items where id = '{$item}' "); if ($koszt > $money) { echo "<p>Nie stac Cie !</p>"; } else { $id = GetValue("select ID from user where login = '******'"); $pytanie = "insert into inventory set charid = '{$id}',\n itemid = '{$item}',\n `use` = 'FALSE'"; echo "<p> {$pytanie} </p>"; ex($pytanie); $gold = $money - $koszt; ex("update `character` set gold='{$gold}' where userid = '{$id}'");
//echo "<td> <a href = inventory.php?item=". $itemId[$i][0] .">Załóż</a></td></tr>"; } echo "</table>"; $bonusSTR = GetValue("SELECT bonus from items it join inventory inv on it.id=inv.itemId where inv.use=1 and inv.charId='{$loginId}' and it.itemType=0"); $minusAgi = GetValue("SELECT minus from items it join inventory inv on it.id=inv.itemId where inv.use=1 and inv.charId='{$loginId}' and it.itemType=0"); $armor = GetValue("SELECT bonus from items it join inventory inv on it.id=inv.itemId where inv.use=1 and inv.charId='{$loginId}' and it.itemType=1"); $minusSpeed = GetValue("SELECT minus from items it join inventory inv on it.id=inv.itemId where inv.use=1 and inv.charId='{$loginId}' and it.itemType=1"); $witch[1] = $witch[1] - $minusSpeed; if ($witch[1] <= 0) { $witch[1] = 1; } $witch[2] = $witch[2] + $bonusSTR; $witch[3] = $witch[3] - $minusAgi; $potworek = mt_rand(1, 4); $pytanie = "select * from monster where id = '{$potworek}'"; $monster = GetPacket($pytanie); foreach ($monster[0] as $row) { $zgredek[] = $row; } $witcher = new witcher($witch[1], $witch[2], $witch[3], $witch[4], $witch[5], $witch[0]); $witcher->getExp($witch[8]); $witcher->setArmor($armor); $monster = new creature($zgredek[1], $zgredek[2], $zgredek[3], $zgredek[4], $zgredek[4], $zgredek[5]); $_SESSION['witcher'] = serialize($witcher); $_SESSION['monster'] = serialize($monster); static $count = 0; $_SESSION['count'] = serialize($count); $_SESSION['eliksir'] = serialize(new eliksir(null, null)); echo "<a href='game.php'>Graj</a>"; echo "<p><a href='bazar.php'>Bazar</a></p>"; echo "<p><a href='inventory.php'>Plecak</a></p>";