Jump to content
MakeWebGames

peterisgb

Members
  • Posts

    698
  • Joined

  • Last visited

  • Days Won

    31

peterisgb last won the day on April 10

peterisgb had the most liked content!

7 Followers

Personal Information

  • Location
    Penzance, Cornwall, UK
  • Website
    https://infamous-wars.com/mod/index.php

Recent Profile Visitors

11,482 profile views

peterisgb's Achievements

Community Regular

Community Regular (8/14)

  • Very Popular Rare
  • Reacting Well Rare
  • Conversation Starter Rare
  • Dedicated Rare
  • First Post Rare

Recent Badges

124

Reputation

  1. R.I.P to the hosting, Its been a great few years with realiable fast simple hosting. With that said. Where have people gone to host? Pref with Cpanel access As to the forum, glad that will remain around as its the only forum i've ever joined and stayed and it'll be a shame if i lost this place.
  2. Well my hands are pretty full lol. 2 boys now the girl. Keeps me very busy these days. But can't get a better reason for no support tho lol
  3. Due to the marketplace shutdown. I have decided to give away my only 2 paid mods away for free. Due to irl commitments aka, having a little girl recently there is no support for any of my mods. Thanks and enjoy. Avatar v2.0.0.zip PEMi v0.0.9.zip
  4. peterisgb

    Games List

    Persistance is rare. Me, since 2009... 😄
  5. Still here going. Many updates and key features going strong. Why not join today? Infamous Wars, Join Today Yes there is Ads on the Login page. But NONE are present ingame.
  6. I plan to do this with my mccodes game, Just gotta wait till i get all the items added and finished first.
  7. Lets hope we get to keep ours as this is the only decent hosting out there. Might end up stepping down and leaving the coding world if i loose my hosting here.
  8. ugh, will existing hosting remain live for how long, do i need to think about alternatives?
  9. Ugh, I got the basics, But i fail at maintaining the base, Doing advanced stuff and surviving hehe, Always get killed.
  10. oh ok, i've been doing the oppsite, my last site the header was massive, I've split it up into sections on different pages. Header.php being only 140ish lines.
  11. As Adam said, Its a odd thing to do. But hey, I'm Down. This is Untested. <?php require_once('globals.php'); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'iteminfo': iteminfo(); break; case 'itemsend': itemsend(); break; case 'itemsell': itemsell(); break; case 'imadd': imadd(); break; case 'itemuse': itemuse(); break; default: index(); break; } function itemuse(){ global $db, $ir, $c, $userid, $h; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; if (!$_GET['ID']) { echo 'Invalid use of file'; } else { $i = $db->query( "SELECT `effect1`, `effect2`, `effect3`, `effect1_on`, `effect2_on`, `effect3_on`, `itmname`, `inv_itemid` FROM `inventory` AS `iv` INNER JOIN `items` AS `i` ON `iv`.`inv_itemid` = `i`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND `iv`.`inv_userid` = $userid"); if ($db->num_rows($i) == 0) { $db->free_result($i); echo 'Invalid item ID'; } else { $r = $db->fetch_row($i); $db->free_result($i); if (!$r['effect1_on'] && !$r['effect2_on'] && !$r['effect3_on']) { echo 'Sorry, this item cannot be used as it has no effect.'; die($h->endpage()); } for ($enum = 1; $enum <= 3; $enum++) { if ($r["effect{$enum}_on"]) { $einfo = unserialize($r["effect{$enum}"]); if ($einfo['inc_type'] == "percent") { if (in_array($einfo['stat'], array('energy', 'will', 'brave', 'hp'))) { $inc = round( $ir['max' . $einfo['stat']] / 100 * $einfo['inc_amount']); } else { $inc = round( $ir[$einfo['stat']] / 100 * $einfo['inc_amount']); } } else { $inc = $einfo['inc_amount']; } if ($einfo['dir'] == "pos") { if (in_array($einfo['stat'], array('energy', 'will', 'brave', 'hp'))) { $ir[$einfo['stat']] = min($ir[$einfo['stat']] + $inc, $ir['max' . $einfo['stat']]); } else { $ir[$einfo['stat']] += $inc; } } else { $ir[$einfo['stat']] = max($ir[$einfo['stat']] - $inc, 0); } $upd = $ir[$einfo['stat']]; if (in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query( "UPDATE `userstats` SET `{$einfo['stat']}` = '{$upd}' WHERE `userid` = {$userid}"); } else { $db->query( "UPDATE `users` SET `{$einfo['stat']}` = '{$upd}' WHERE `userid` = {$userid}"); } } } echo $r['itmname'] . ' used successfully!'; item_remove($userid, $r['inv_itemid'], 1); } } } function imadd() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $_POST['price'] = (isset($_POST['price']) && is_numeric($_POST['price'])) ? abs(intval($_POST['price'])) : ''; $_POST['QTY'] = (isset($_POST['QTY']) && is_numeric($_POST['QTY'])) ? abs(intval($_POST['QTY'])) : ''; $_POST['currency'] = (isset($_POST['currency']) && in_array($_POST['currency'], array('money', 'crystals'))) ? $_POST['currency'] : 'money'; if ($_POST['price'] && $_POST['QTY'] && $_GET['ID']) { if (!isset($_POST['verf']) || !verify_csrf_code("imadd_{$_GET['ID']}", stripslashes($_POST['verf']))) { echo "Your request to add this item to the market has expired. Please try again.<br /> &gt; <a href='?action=imadd&ID={$_GET['ID']}'>Back</a>"; die($h->endpage()); } $q = $db->query( "SELECT `inv_qty`, `inv_itemid`, `inv_id`, `itmname` FROM `inventory` AS `iv` INNER JOIN `items` AS `i` ON `iv`.`inv_itemid` = `i`.`itmid` WHERE `inv_id` = {$_GET['ID']} AND `inv_userid` = $userid"); if ($db->num_rows($q) == 0) { $db->free_result($q); echo "Invalid Item ID"; } else { $r = $db->fetch_row($q); $db->free_result($q); if ($r['inv_qty'] < $_POST['QTY']) { echo 'You do not have enough of this item.'; $h->endpage(); exit; } $checkq = sprintf( 'SELECT `imID` FROM `itemmarket` WHERE `imITEM` = %u AND `imPRICE` = %u AND `imADDER` = %u AND `imCURRENCY` = "%s"', $r['inv_itemid'], $_POST['price'], $userid, $_POST['currency']); $checkq = $db->query($checkq); if ($db->num_rows($checkq) > 0) { $cqty = $db->fetch_row($checkq); $query = sprintf( 'UPDATE `itemmarket` SET imQTY = imQTY + %u WHERE imID = %u', $_POST['QTY'], $cqty['imID']); $db->query($query); } else { $db->query( "INSERT INTO `itemmarket` VALUES (NULL, '{$r['inv_itemid']}', {$userid}, {$_POST['price']}, '{$_POST['currency']}', {$_POST['QTY']})"); } $db->free_result($checkq); item_remove($userid, $r['inv_itemid'], $_POST['QTY']); $imadd_log = $db->escape( "{$ir['username']} added {$r['itmname']} " . "x{$_POST['QTY']} to the item market for " . "{$_POST['price']} {$_POST['currency']}"); $db->query( "INSERT INTO `imarketaddlogs` VALUES (NULL, {$r['inv_itemid']}, {$_POST['price']}, {$r['inv_id']}, $userid, " . time() . ", '{$imadd_log}')"); echo "Item added to market."; } } else { $q = $db->query( "SELECT COUNT(`inv_id`) FROM `inventory` WHERE `inv_id` = {$_GET['ID']} AND `inv_userid` = $userid"); if ($db->fetch_single($q) == 0) { echo 'Invalid Item ID'; } else { $imadd_csrf = request_csrf_code("imadd_{$_GET['ID']}"); echo " Adding an item to the item market...<br /> <form action='?action=imadd&ID={$_GET['ID']}' method='post'> <input type='hidden' name='verf' value='{$imadd_csrf}' /> Quantity: <input type='text' name='QTY' value=''><br /> Price: <input type='text' name='price' value='0' /><br /> <select name='currency' type='dropdown'> <option value='money'>Money</option> <option value='crystals'>Crystals</option> </select><br /> <input type='submit' value='Add' /> </form> "; } $db->free_result($q); } } function itemsell() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $_POST['qty'] = (isset($_POST['qty']) && is_numeric($_POST['qty'])) ? abs(intval($_POST['qty'])) : ''; if (!empty($_POST['qty']) && !empty($_GET['ID'])) { $id = $db->query( "SELECT `inv_qty`, `itmsellprice`, `itmid`, `itmname` FROM `inventory` AS `iv` INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND `iv`.`inv_userid` = {$userid} LIMIT 1"); if ($db->num_rows($id) == 0) { echo 'Invalid item ID'; } else { $r = $db->fetch_row($id); if (!isset($_POST['verf']) || !verify_csrf_code("sellitem_{$_GET['ID']}", stripslashes($_POST['verf']))) { echo '<h3>Error</h3><hr /> This transaction has been blocked for your security.<br /> Please sell items quickly after you open the form - do not leave it open in tabs.<br /> &gt; <a href="itemsell.php?ID=' . $_GET['ID'] . '">Try Again</a>'; die($h->endpage()); } if ($_POST['qty'] > $r['inv_qty']) { echo 'You are trying to sell more than you have!'; } else { $price = $r['itmsellprice'] * $_POST['qty']; item_remove($userid, $r['itmid'], $_POST['qty']); $db->query( "UPDATE `users` SET `money` = `money` + {$price} WHERE `userid` = $userid"); $priceh = money_formatter($price); echo 'You sold ' . $_POST['qty'] . ' ' . $r['itmname'] . '(s) for ' . $priceh; $is_log = $db->escape( "{$ir['username']} sold {$_POST['qty']} {$r['itmname']}(s) for {$priceh}"); $db->query( "INSERT INTO `itemselllogs` VALUES (NULL, $userid, {$r['itmid']}, $price, {$_POST['qty']}, " . time() . ", '{$is_log}')"); } } $db->free_result($id); } else if (!empty($_GET['ID']) && empty($_POST['qty'])) { $id = $db->query( "SELECT `inv_qty`, `itmname` FROM `inventory` AS `iv` INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND `iv`.`inv_userid` = {$userid} LIMIT 1"); if ($db->num_rows($id) == 0) { echo 'Invalid item ID'; } else { $r = $db->fetch_row($id); $code = request_csrf_code("sellitem_{$_GET['ID']}"); echo " <b>Enter how many {$r['itmname']} you want to sell. You have {$r['inv_qty']} to sell.</b> <br /> <form action='?action=itemsell&ID={$_GET['ID']}' method='post'> <input type='hidden' name='verf' value='{$code}' /> Quantity: <input type='text' name='qty' value='' /> <br /> <input type='submit' value='Sell Items (no prompt so be sure!' /> </form> "; } $db->free_result($id); } else { echo 'Invalid use of file.'; } } function itemsend() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $_POST['user'] = (isset($_POST['user']) && is_numeric($_POST['user'])) ? abs(intval($_POST['user'])) : ''; $_POST['qty'] = (isset($_POST['qty']) && is_numeric($_POST['qty'])) ? abs(intval($_POST['qty'])) : ''; if (!empty($_POST['qty']) && !empty($_POST['user'])) { $id = $db->query( "SELECT `inv_qty`, `inv_itemid`, `itmname`, `itmid` FROM `inventory` AS `iv` INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND iv.`inv_userid` = {$userid} LIMIT 1"); if ($db->num_rows($id) == 0) { echo 'Invalid item ID'; } else { $r = $db->fetch_row($id); $m = $db->query( "SELECT `lastip`,`username` FROM `users` WHERE `userid` = {$_POST['user']} LIMIT 1"); if (!isset($_POST['verf']) || !verify_csrf_code("senditem_{$_GET['ID']}", stripslashes($_POST['verf']))) { echo '<h3>Error</h3><hr /> This transaction has been blocked for your security.<br /> Please send items quickly after you open the form - do not leave it open in tabs.<br /> &gt; <a href="?action=itemsend&ID=' . $_GET['ID'] . '">Try Again</a>'; die($h->endpage()); } else if ($_POST['qty'] > $r['inv_qty']) { echo 'You are trying to send more than you have!'; } else if ($db->num_rows($m) == 0) { echo 'You are trying to send to an invalid user!'; } else { $rm = $db->fetch_row($m); item_remove($userid, $r['inv_itemid'], $_POST['qty']); item_add($_POST['user'], $r['inv_itemid'], $_POST['qty']); echo 'You sent ' . $_POST['qty'] . ' ' . $r['itmname'] . '(s) to ' . $rm['username']; event_add($_POST['user'], "You received {$_POST['qty']} {$r['itmname']}(s) from <a href='viewuser.php?u=$userid'>{$ir['username']}</a>", $c); $db->query( "INSERT INTO `itemxferlogs` VALUES(NULL, $userid, {$_POST['user']}, {$r['itmid']}, {$_POST['qty']}, " . time() . ", '{$ir['lastip']}', '{$rm['lastip']}')"); } $db->free_result($m); } $db->free_result($id); } else if (!empty($_GET['ID'])) { $id = $db->query( "SELECT `inv_qty`, `itmname` FROM `inventory` iv INNER JOIN `items` AS `it` ON `iv`.`inv_itemid` = `it`.`itmid` WHERE `iv`.`inv_id` = {$_GET['ID']} AND `iv`.`inv_userid` = $userid LIMIT 1"); if ($db->num_rows($id) == 0) { echo 'Invalid item ID'; } else { $r = $db->fetch_row($id); $code = request_csrf_code("senditem_{$_GET['ID']}"); echo " <b>Enter who you want to send {$r['itmname']} to and how many you want to send. You have {$r['inv_qty']} to send.</b> <br /> <form action='?action=itemsend&ID={$_GET['ID']}' method='post'> User ID: <input type='text' name='user' value='' /> <br /> Quantity: <input type='text' name='qty' value='' /> <br /> <input type='hidden' name='verf' value='{$code}' /> <input type='submit' value='Send Items (no prompt so be sure!' /> </form> "; } $db->free_result($id); } else { echo 'Invalid use of file.'; } } function iteminfo() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = (isset($_GET['ID']) && is_numeric($_GET['ID'])) ? abs(intval($_GET['ID'])) : ''; $itmid = $_GET['ID']; if (!$itmid) { echo 'Invalid item ID'; } else { $q = $db->query( "SELECT `itmname`, `itmdesc`, `itmbuyprice`, `itmsellprice`, `itmtypename` FROM `items` AS `i` INNER JOIN `itemtypes` AS `it` ON `i`.`itmtype` = `it`.`itmtypeid` WHERE `i`.`itmid` = {$itmid} LIMIT 1"); if ($db->num_rows($q) == 0) { echo 'Invalid item ID'; } else { $id = $db->fetch_row($q); echo " <table width=75% class='table' cellspacing='1'> <tr style='background: gray;'> <th colspan=2><b>Looking up info on {$id['itmname']}</b></th> </tr> <tr style='background: #dfdfdf;'> <td colspan=2>The <b>{$id['itmname']}</b> is a/an {$id['itmtypename']} Item - <b>{$id['itmdesc']}</b></th> </tr> <tr style='background: gray;'> <th colspan=2>Item Info</th> </tr> <tr style='background:gray'> <th>Item Buy Price</th> <th>Item Sell Price</th> </tr> <tr> <td> "; if ($id['itmbuyprice']) { echo money_formatter($id['itmbuyprice']); } else { echo 'N/A'; } echo ' </td> <td> '; if ($id['itmsellprice']) { echo money_formatter($id['itmsellprice']) . ' </td> </tr> </table> '; } else { echo ' N/A</td> </tr> </table> '; } } $db->free_result($q); } } function index() { global $db, $ir, $c, $userid, $h; $q = $db->query( "SELECT `itmid`, `itmname` FROM `items` WHERE `itmid` IN({$ir['equip_primary']}, {$ir['equip_secondary']}, {$ir['equip_armor']})"); echo "<h3>Equipped Items</h3><hr />"; $equip = array(); while ($r = $db->fetch_row($q)) { $equip[$r['itmid']] = $r; } $db->free_result($q); echo "<table width='75%' cellspacing='1' class='table'> <tr> <th>Primary Weapon</th> <td>"; if (isset($equip[$ir['equip_primary']])) { print $equip[$ir['equip_primary']]['itmname'] . "</td><td><a href='unequip.php?type=equip_primary'>Unequip Item</a></td>"; } else { echo "None equipped.</td><td>&nbsp;</td>"; } echo "</tr> <tr> <th>Secondary Weapon</th> <td>"; if (isset($equip[$ir['equip_secondary']])) { print $equip[$ir['equip_secondary']]['itmname'] . "</td><td><a href='unequip.php?type=equip_secondary'>Unequip Item</a></td>"; } else { echo "None equipped.</td><td>&nbsp;</td>"; } echo "</tr> <tr> <th>Armor</th> <td>"; if (isset($equip[$ir['equip_armor']])) { print $equip[$ir['equip_armor']]['itmname'] . "</td><td><a href='unequip.php?type=equip_armor'>Unequip Item</a></td>"; } else { echo "None equipped.</td><td>&nbsp;</td>"; } echo "</tr> </table><hr /> <h3>Inventory</h3><hr />"; $inv = $db->query( "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`, `effect1_on`, `effect2_on`, `effect3_on`, `itmname`, `weapon`, `armor`, `itmtypename` FROM `inventory` AS `iv` INNER JOIN `items` AS `i` ON `iv`.`inv_itemid` = `i`.`itmid` INNER JOIN `itemtypes` AS `it` ON `i`.`itmtype` = `it`.`itmtypeid` WHERE `iv`.`inv_userid` = {$userid} ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC"); if ($db->num_rows($inv) == 0) { echo "<b>You have no items!</b>"; } else { echo "<b>Your items are listed below.</b><br /> <table width=100% class=\"table\" border=\"0\" cellspacing=\"1\"> <tr> <td class=\"h\">Item</td> <td class=\"h\">Sell Value</td> <td class=\"h\">Total Sell Value</td> <td class=\"h\">Links</td> </tr>"; $lt = ""; while ($i = $db->fetch_row($inv)) { if ($lt != $i['itmtypename']) { $lt = $i['itmtypename']; echo "\n<tr> <td colspan='4'> <b>{$lt}</b> </td> </tr>"; } if ($i['weapon']) { $i['itmname'] = "<span style='color: red;'>*</span>" . $i['itmname']; } if ($i['armor']) { $i['itmname'] = "<span style='color: green;'>*</span>" . $i['itmname']; } echo "<tr> <td>{$i['itmname']}"; if ($i['inv_qty'] > 1) { echo "&nbsp;x{$i['inv_qty']}"; } echo "</td> <td>" . money_formatter($i['itmsellprice']) . "</td> <td>"; echo money_formatter($i['itmsellprice'] * $i['inv_qty']); echo "</td> <td> [<a href='?action=iteminfo&ID={$i['itmid']}'>Info</a>] [<a href='?action=itemsend&ID={$i['inv_id']}'>Send</a>] [<a href='?action=itemsell&ID={$i['inv_id']}'>Sell</a>] [<a href='?action=imadd.php&ID={$i['inv_id']}'>Add To Market</a>]"; if ($i['effect1_on'] || $i['effect2_on'] || $i['effect3_on']) { echo " [<a href='?action=itemuse&ID={$i['inv_id']}'>Use</a>]"; } if ($i['weapon'] > 0) { echo " [<a href='equip_weapon.php?ID={$i['inv_id']}'>Equip as Weapon</a>]"; } if ($i['armor'] > 0) { echo " [<a href='equip_armor.php?ID={$i['inv_id']}'>Equip as Armor</a>]"; } echo "</td> </tr>"; } echo "</table>"; $db->free_result($inv); echo "<small><b>NB:</b> Items with a small red </small><span style='color: red;'>*</span><small> next to their name can be used as weapons in combat.<br /> Items with a small green </small><span style='color: green;'>*</span><small> next to their name can be used as armor in combat.</small>"; } } $h->endpage(); As Said, Untested, Using Default Mccodes from V2.0.6
  12. Haha, I don't mind the money but isn't my main goal, Player Activeness and people Playing and enjoying it it number 1, money eh, like it helps but keeping people playing means more.
×
×
  • Create New...