Jump to content
MakeWebGames

Veramys

Members
  • Posts

    365
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Veramys

  1. Dark, it's easier on the eyes.
  2. Now now SRB, no need to be mean ?
  3. I vote make SRB write all the code. Especially more than he needs ?
  4. I always have some sort of background noise, whether it be the tv or music doesn't matter. I don't have to have it playing but I like the background noise.
  5. Ok so back before MWG closed I had looked around for a trade system and couldn't find one, so I built one to suit my needs. So here it is SQL For Trades CREATE TABLE IF NOT EXISTS `trades` ( `trID` int(11) NOT NULL AUTO_INCREMENT, `trFROM` int(11) unsigned NOT NULL DEFAULT '0', `trUSER` int(11) NOT NULL DEFAULT '0', `trMONEY` bigint(22) NOT NULL DEFAULT '0', `trITEM` varchar(70) NOT NULL DEFAULT '', `trQTY` varchar(70) NOT NULL DEFAULT '', `trTAK` tinyint(1) NOT NULL, `trACC` tinyint(1) DEFAULT '0', `trRMONEY` bigint(22) NOT NULL DEFAULT '0', `trRITEM` varchar(70) NOT NULL DEFAULT '', `trRQTY` varchar(70) NOT NULL DEFAULT '', `trRTAK` tinyint(1) NOT NULL, `trRACC` tinyint(1) DEFAULT '0', PRIMARY KEY (`trID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; Sql for Logs CREATE TABLE IF NOT EXISTS `trades_logs` ( `trID` int(11) NOT NULL AUTO_INCREMENT, `trFROM` int(11) UNSIGNED NOT NULL DEFAULT 0, `trUSER` int(11) NOT NULL DEFAULT 0, `trMONEY` bigint(22) NOT NULL DEFAULT 0, `trITEM` varchar(70) NOT NULL DEFAULT '', `trQTY` varchar(70) NOT NULL DEFAULT '', `trTAK` varchar(15) NOT NULL, `trACC` tinyint(1) DEFAULT 0, `trRMONEY` bigint(22) NOT NULL DEFAULT 0, `trRITEM` varchar(70) NOT NULL DEFAULT '', `trRQTY` varchar(70) NOT NULL DEFAULT '', `trRTAK` varchar(15) NOT NULL, `trRACC` tinyint(1) DEFAULT 0, `time_added` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`trID`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; Create a file called trade.php if you are using Cronus's mod for the armory uncomment the part about check_loaned. Also if your global_func doesn't have an inv_dropdown I created one <?php require_once __DIR__.'/globals.php'; /* * DON'T BE A DICK PUBLIC LICENSE * Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. * * DON'T BE A DICK PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION * * Do whatever you like with the original work, just don't be a dick. * * Being a dick includes - but is not limited to - the following instances: * * 1a. Outright copyright infringement - Don't just copy this and change the name. * 1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick. * 1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick. * * If you become rich through modifications, related works/services, or supporting the original work, share the love. Only a dick would make loads off this work and not buy the original works creator(s) a pint. * * Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back. */?> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#btnAdd').click(function() { var num = $('.clonedInputOne').length; var numTwo = $('.clonedInputTwo').length; var newNum = new Number(num + 1); var newElem = $('#input' + num).clone().attr('id', 'input' + newNum); var newElemTwo = $('#inputTwo' + numTwo).clone().attr('id', 'inputTwo' + newNum); newElem.children(':first').attr('id', 'item' + newNum).attr('name', 'item' + newNum); newElemTwo.children(':first').attr('id', 'qty' + newNum).attr('name', 'qty' + newNum); $('#input' + num).after(newElem); $('#inputTwo' + numTwo).after(newElemTwo); $('#btnDel').attr('disabled',''); if (newNum == 10) $('#btnAdd').attr('disabled','disabled'); }); $('#btnDel').click(function() { var num = $('.clonedInputTwo').length; $('#input' + num).remove(); $('#inputTwo' + num).remove(); $('#btnAdd').attr('disabled',''); if (num-1 == 1) $('#btnDel').attr('disabled','disabled'); }); $('#btnDel').attr('disabled','disabled'); }); </script> <?php echo " <h2>Trading Center</h2> "; $_GET['action'] = array_key_exists('action', $_GET) ? $_GET['action'] : null; switch ($_GET['action']) { default: def(); break; case 'accept': accept(); break; case 'add': add(); break; case 'view': view_trade(); break; case 'create': begin_trade(); break; case 'decline': decline_trade(); break; } function def() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : 0; $r = $db->query("SELECT * FROM trades WHERE trFROM = $userid OR trUSER = $userid ORDER by trID ASC"); if (0 == $db->num_rows($r)) { echo " No trade boxes opened.<br /><br /><a href='trade.php?action=create'><button>Create Trade</button></a>"; } else { echo " <table> <tr> <th>Trade ID</th> <th>Trading With</th> <th>See Trade</th> </tr>"; while ($d = $db->fetch_row($r)) { if ($d['trUSER'] == $userid) { $s = $d['trFROM']; } else { $s = $d['trUSER']; } $s = $db->query("SELECT username,userid FROM users WHERE userid = $s"); $f = $db->fetch_row($s); echo " <tr> <td>{$d['trID']}</td> <td><a href='viewuser.php?u={$f['userid']}'>{$f['username']}[{$f['userid']}]</a></td> <td><a href='trade.php?action=view&ID={$d['trID']}'>View</a></td> </tr>"; } echo "</table><br /><a href='trade.php?action=create'><button>Create New Trade</button></a>"; } } function begin_trade() { global $db, $ir, $c, $userid, $h; if ($_POST) { $_POST['user'] = isset($_POST['user']) && ctype_digit($_POST['user']) ? $_POST['user'] : null; $_POST['money'] = isset($_POST['money']) && ctype_digit($_POST['money']) ? $_POST['money'] : 0; $_POST['item'] = isset($_POST['item']) && preg_match('/^[0-9,]+$/', $_POST['item']) ? $_POST['item'] : null; $_POST['qty'] = isset($_POST['qty']) && ctype_digit($_POST['qty']) ? $_POST['qty'] : null; if (empty($_POST['user'])) { echo"You didn\'t enter a valid player ID."; die($h->endpage()); } if ($_POST['user'] == $userid) { echo"Really? You can\'t trade with yourself."; die($h->endpage()); } $items = $_POST['item']; $qty = $_POST['qty']; $itemCnt = 0; $qtyCnt = 0; for ($i = 1; $i <= 10; ++$i) { if ($_POST['item'.$i] > 0) { ++$itemCnt; $items .= ','.$_POST['item'.$i]; } } for ($i = 1; $i <= 10; ++$i) { $_POST['qty'.$i] = isset($_POST['qty'.$i]) && ctype_digit($_POST['qty'.$i]) ? $_POST['qty'.$i] : null; if ($_POST['qty'.$i] > 0) { ++$qtyCnt; $qty .= ','.$_POST['qty'.$i]; } } if ($itemCnt != $qtyCnt) { echo"Something doesn\'t add up. Please check your inputs"; die($h->endpage()); } $ex = explode(',', $_POST['item']); $qtys = explode(',', $_POST['qty']); $n = 0; if ($itemCnt) { foreach ($ex as $i) { $do_they_have = $db->query("SELECT * FROM `inventory` WHERE `inv_userid`={$userid} AND `inv_itemid`={$i} AND inv_qty>={$qtys[$n]}"); /*check_loaned($i, $qtys[$n]);*/ if (0 == $db->num_rows($do_they_have)) { echo"You do not have the item(s) you are trying to trade."; die($h->endpage()); } ++$n; } } unset($n); $us = $db->query("SELECT userid,username,money FROM users WHERE userid = {$_POST['user']}"); if (0 == $db->num_rows($us)) { echo"You are trying to trade with an invalid user!"; die($h->endpage()); } if ($_POST['money'] > $ir['money']) { echo"You don\'t have enough money to trade!"; die($h->endpage()); } if ($qty <= 0 && $items > 0) { echo"You can\'t trade a zero or a negative amount."; die($h->endpage()); } $ri = $db->fetch_row($us); $db->query("INSERT INTO `trades` (`trID`, `trFROM`, `trUSER`, `trMONEY`, `trITEM`, `trQTY`, `trTAK`, `trACC`, `trRMONEY`, `trRITEM`, `trRQTY`, `trRTAK`, `trRACC`) VALUES (NULL,{$userid},{$_POST['user']},{$_POST['money']},'{$items}','{$qty}',0,0,0,0,0,0,0)"); $db->query("INSERT INTO `trades_logs` (`trID`, `trFROM`, `trUSER`, `trMONEY`, `trITEM`, `trQTY`, `trTAK`, `trACC`, `trRMONEY`, `trRITEM`, `trRQTY`, `trRTAK`, `trRACC`) VALUES (NULL,{$userid},{$_POST['user']},{$_POST['money']},'{$items}','{$qty}','{$ir['lastip']}',0,0,0,0,'{$ri['lastip']}',0)"); $db->query("UPDATE users SET money=money-{$_POST['money']} WHERE userid=$userid"); echo"The trade has been entered! <br> <a href='trade.php'><button>Go Back</button></a>"; exit($h->endpage()); } ?> <form id='trade' method='post'> <fieldset style='width:75%;'><legend>Trading</legend> Userid: <input type='text' name='user' length='7' maxlength='7' value='0' /> <br /> Money: <input type='text' name='money' value='0' /> <br /> <table> <tr> <td><div id='input1' class='clonedInputOne'>Item: <?php echo inv_dropdown($c, 'item'); ?>x</div></td> <td><div id='inputTwo1' class='clonedInputTwo'><input type='text' name='qty' size='2' value='0' /></div></td> </tr> </table> <div> <input type='button' id='btnAdd' value='&plus;' /> <input type='button' id='btnDel' value='&minus;' /> </div> </fieldset> <input type='submit' value='Trade' /> </form><?php } function view_trade() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : 0; //fetch trade $q = $db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r = $db->fetch_row($q); if (!$r['trID']) { echo"Invalid trade ID!"; die($h->endpage()); } $us = $db->query("SELECT userid,username,money FROM users WHERE userid = {$r['trFROM']}"); $user = $db->fetch_row($us); $us1 = $db->query("SELECT userid,username,money FROM users WHERE userid = {$r['trUSER']}"); $user1 = $db->fetch_row($us1); echo " <table> <tr> <th>User</th> <th>Money</th> <th>Item</th> <th>Quantity</th> </tr>"; echo " <tr> <td><a href='viewuser.php?u={$user['userid']}'>".$user['username'].'</a></td> <td>'.$r['trMONEY'].'</td>'; $ex = explode(',', $r['trITEM']); $qty = explode(',', $r['trQTY']); $n = 0; $items_needed=''; $qty_needed=''; foreach ($ex as $i) { $item = $db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$i}"); $t = $db->fetch_row($item); $do_they_have = $db->query("SELECT `inv_itemid` FROM `inventory` WHERE `inv_userid`={$user['userid']} AND `inv_itemid`={$i} AND `inv_qty`>={$qty[$n]}"); if (0 == $qty[$n]) { $items_needed = 'None'; } $items_needed .= $t['itmname'].'<br />'; $qty_needed .= $qty[$n].'<br/>'; ++$n; } unset($n); echo '<td>'.$items_needed.'</td> <td>'.$qty_needed."</td> </tr> <tr> <td><a href='viewuser.php?u={$user1['userid']}'>".$user1['username'].'</a></td> <td>'.$r['trRMONEY'].'</td>'; $ex = explode(',', $r['trRITEM']); $qty = explode(',', $r['trRQTY']); $n = 0; $qty_needed1=''; foreach ($ex as $i) { $item = $db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$i}"); $t = $db->fetch_row($item); $do_they_have = $db->query("SELECT `inv_itemid` FROM `inventory` WHERE `inv_userid`={$user1['userid']} AND `inv_itemid`={$i} AND `inv_qty`>={$qty[$n]}"); if (0 == $qty[$n]) { $items_needed1 = 'None'; } $items_needed1 .= $t['itmname'].'<br />'; $qty_needed1 .= $qty[$n].'<br/>'; ++$n; } unset($n); echo '<td>'.$items_needed1.'</td> <td>'.$qty_needed1.'</td> </tr></table>'; if ($r['trFROM'] == $userid) { if (1 == $r['trACC']) { echo 'You have<font color=green> accepted</font> the trade.<br />'; } elseif (0 == $r['trACC']) { echo 'You have not<font color=red> accepted</font> the trade.<br />'; } if (0 == $r['trRACC']) { echo 'They have not<font color=red> accepted</font> the trade.'; } elseif (1 == $r['trRACC']) { echo 'They have<font color=green> accepted</font> the trade.'; } } elseif ($r['trUSER'] == $userid) { if (1 == $r['trRACC']) { echo 'You have<font color=green> accepted</font> the trade<br />'; } elseif (0 == $s['trRACC']) { echo 'You have not<font color=red> accepted</font> the trade.<br />'; } if (0 == $r['trACC']) { echo 'They have not<font color=red> accepted</font> the trade.'; } elseif (1 == $r['trACC']) { echo 'They have<font color=green> accepted </font>the trade.'; } } echo '</div>'; echo "<br /><center><a href='trade.php?action=accept&ID={$r['trID']}'><button>Accept</button></a> <a href='trade.php?action=decline&ID={$r['trID']}'><button>Decline</button></a> <a href='trade.php?action=add&ID={$r['trID']}'><button>Update</button></a> <a href='trade.php'><button>Back</button></a><br /><br /> Warning: Updating a trade resets all items and amounts</center>"; } function add() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : 0; $q = $db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r = $db->fetch_row($q); if (!$r['trID']) { echo"Invalid trade ID!"; die($h->endpage()); } if ($_POST) { $_POST['money'] = filter_var($_POST['money'], FILTER_VALIDATE_INT) ? abs((int) $_POST['money']) : 0; $_POST['item'] = filter_var($_POST['item'], FILTER_VALIDATE_INT) ? abs((int) $_POST['item']) : 0; $_POST['qty'] = filter_var($_POST['qty'], FILTER_VALIDATE_INT) ? abs((int) $_POST['qty']) : 0; $items = $_POST['item']; $qty = $_POST['qty']; $itemCnt = 0; $qtyCnt = 0; for ($i = 1; $i <= 10; ++$i) { $_POST['item'.$i] = isset($_POST['item'.$i]) && ctype_digit($_POST['item'.$i]) ? $_POST['item'.$i] : null; if ($_POST['item'.$i] > 0) { ++$itemCnt; $items .= ','.$_POST['item'.$i]; } } for ($i = 1; $i <= 10; ++$i) { $_POST['qty'.$i] = isset($_POST['qty'.$i]) && ctype_digit($_POST['qty'.$i]) ? $_POST['qty'.$i] : null; if ($_POST['qty'.$i] > 0) { ++$qtyCnt; $qty .= ','.$_POST['qty'.$i]; } } if ($itemCnt != $qtyCnt) { echo"Something doesn\'t add up. Please check your inputs"; die($h->endpage()); } $ex = explode(',', $_POST['item']); $qtys = explode(',', $_POST['qty']); $n = 0; if ($itemCnt) { foreach ($ex as $i) { $item = $db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$i}"); $t = $db->fetch_row($item); if ($i > 0 && 0 == $qtys[$n]) { echo"All Items must have a qty."; die($h->endpage()); } /*check_loaned($i, $qtys[$n]);*/ $do_they_have = $db->query("SELECT * FROM `inventory` WHERE `inv_userid`={$userid} AND `inv_itemid`={$i} AND `inv_qty`>={$qtys[$n]}"); if (0 == $db->num_rows($do_they_have)) { echo"You do not have the item(s) you are trying to trade."; die($h->endpage()); } unset($n); } } trade_add(); if ($qty <= 0 && $items > 0) { echo"You can\'t trade zero or a negative amount."; die($h->endpage()); } if ($_POST['money'] > $ir['money']) { echo"You don\'t have enough money to trade!"; die($h->endpage()); } if ($r['trFROM'] == $userid) { $db->query("UPDATE users SET money=money+{$r['trMONEY']}, money=money-{$_POST['money']} WHERE userid=$userid"); $db->query("UPDATE trades SET trMONEY={$_POST['money']}, trITEM = '{$items}', trQTY = '{$qty}', trACC=0,trRACC=0 WHERE trID={$r['trID']}"); $db->query("UPDATE trades_logs SET trMONEY={$_POST['money']}, trITEM = '{$items}', trQTY = '{$qty}', trACC=0,trRACC=0 WHERE trID={$r['trID']}"); } if ($r['trUSER'] == $userid) { $db->query("UPDATE users SET money=money+{$r['trRMONEY']},money=money-{$_POST['money']} WHERE userid=$userid"); $db->query("UPDATE trades SET trRMONEY={$_POST['money']}, trRITEM = '{$items}', trRQTY = '{$qty}', trACC=0, trRACC=0 WHERE trID={$r['trID']}"); $db->query("UPDATE trades_logs SET trRMONEY={$_POST['money']}, trRITEM = '{$items}', trRQTY = '{$qty}', trACC=0, trRACC=0 WHERE trID={$r['trID']}"); } echo "Trade box has been updated. <br /><a href='trade.php?action=view&ID={$r['trID']}'><button>Back</button></a>"; exit($h->endpage()); } ?> <form id='#' method='post'> <fieldset style='width:75%;'><legend>Trade</legend> <sub><font color=red>Warning: Updating a trade resets all items and amounts!</font></sub><br /><br /> Money: <input type='text' name='money' value='0' /> <br /> <table> <tr> <td><div id='input1' class='clonedInputOne'>Item: <?php echo inv_dropdown($c, 'item'); ?>x</div></td> <td><div id='inputTwo1' class='clonedInputTwo'><input type='text' name='qty' size='2' value='0' /></div></td> </tr> </table> <div> <input type='button' id='btnAdd' value='&plus;' /> <input type='button' id='btnDel' value='&minus;' /> </div> </fieldset> <input type='submit' value='Update' /> </form><?php } function accept() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : 0; $q = $db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r = $db->fetch_row($q); if (!$r['trID']) { echo"Invalid trade ID!"; die($h->endpage()); } if (0 == $r['trACC'] && 0 == $r['trRACC'] && $r['trFROM'] == $userid) { $db->query("UPDATE trades SET trACC=1 WHERE trID={$r['trID']}"); $db->query("UPDATE trades_logs SET trACC=1 WHERE trID={$r['trID']}"); echo " Trade<font color=green> accepted</font>, please wait for the other person.<br /> <a href='trade.php?action=view&ID={$r['trID']}'><button>Back</button></a>"; } elseif (0 == $r['trRACC'] && 0 == $r['trACC'] && $r['trUSER'] == $userid) { $db->query("UPDATE trades SET trRACC=1 WHERE trID={$r['trID']}"); $db->query("UPDATE trades_logs SET trRACC=1 WHERE trID={$r['trID']}"); echo " Trade <font color=green>accepted</font>, please wait for the other person.<br /> <a href='trade.php?action=view&ID={$r['trID']}'><button>Back</button></a>"; } if ($r['trFROM'] == $userid && 0 == $r['trACC'] && 1 == $r['trRACC']) { $db->query("UPDATE trades SET trACC=1 WHERE trID = {$r['trID']}"); $db->query("UPDATE trades_logs SET trACC=1 WHERE trID = {$r['trID']}"); if ($r['trITEM'] > 0) { $ex = explode(',', $r['trITEM']); $qty = explode(',', $r['trQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trUSER'], $i, $qty[$n]); ++$n; } unset($n); } if ($r['trRITEM'] > 0) { $ex = explode(',', $r['trRITEM']); $qty = explode(',', $r['trRQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trFROM'], $i, $qty[$n]); ++$n; } unset($n); } $db->query("UPDATE users SET money=money+{$r['trMONEY']} WHERE userid={$r['trUSER']}"); $db->query("UPDATE users SET money=money+{$r['trRMONEY']} WHERE userid={$r['trFROM']}"); $db->query("DELETE FROM trades WHERE trID={$r['trID']}"); echo "Trade Accepted. <br /><a href='trade.php'><button>Back</button></a>"; } elseif ($r['trUSER'] == $userid && 0 == $r['trRACC'] && 1 == $r['trACC']) { $db->query("UPDATE trades SET trRACC=1 WHERE trID = {$r['trID']}"); $db->query("UPDATE trades_logs SET trRACC=1 WHERE trID = {$r['trID']}"); if ($r['trITEM'] > 0) { $ex = explode(',', $r['trITEM']); $qty = explode(',', $r['trQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trUSER'], $i, $qty[$n]); ++$n; } unset($n); } if ($r['trRITEM'] > 0) { $ex = explode(',', $r['trRITEM']); $qty = explode(',', $r['trRQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trFROM'], $i, $qty[$n]); ++$n; } unset($n); } $db->query("UPDATE users SET money=money+{$r['trMONEY']} WHERE userid={$r['trUSER']}"); $db->query("UPDATE users SET money=money+{$r['trRMONEY']} WHERE userid={$r['trFROM']}"); $db->query("DELETE FROM trades WHERE trID={$r['trID']}"); echo "Trade accepted and finished. <br /><a href='trade.php'><button>Back</button></a>"; } } function decline_trade() { global $db, $ir, $c, $userid, $h; $_GET['ID'] = array_key_exists('ID', $_GET) && ctype_digit($_GET['ID']) ? $_GET['ID'] : 0; $q = $db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r = $db->fetch_row($q); if (!$r['trID']) { echo"Invalid trade ID!"; die($h->endpage()); } if ($r['trFROM'] == $userid) { event_add($r['trUSER'], "{$ir['username']} has declined a trade you were in."); } elseif ($r['trUSER'] == $userid) { event_add($r['trFROM'], "{$ir['username']} has declined a trade you were in."); } if ($r['trFROM'] == $userid) { $db->query("UPDATE trades_logs SET trACC=2 WHERE trID = {$r['trID']}"); if ($r['trITEM'] > 0) { $ex = explode(',', $r['trITEM']); $qty = explode(',', $r['trQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trFROM'], $i, $qty[$n]); ++$n; } unset($n); } if ($r['trRITEM'] > 0) { $ex = explode(',', $r['trRITEM']); $qty = explode(',', $r['trRQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trUSER'], $i, $qty[$n]); ++$n; } unset($n); } } if ($r['trUSER'] == $userid) { $db->query("UPDATE trades_logs SET trRACC=2 WHERE trID = {$r['trID']}"); if ($r['trITEM'] > 0) { $ex = explode(',', $r['trITEM']); $qty = explode(',', $r['trQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trFROM'], $i, $qty[$n]); ++$n; } unset($n); } if ($r['trRITEM'] > 0) { $ex = explode(',', $r['trRITEM']); $qty = explode(',', $r['trRQTY']); $n = 0; foreach ($ex as $i) { item_add($r['trUSER'], $i, $qty[$n]); ++$n; } unset($n); } } $db->query("UPDATE users SET money=money+{$r['trRMONEY']} WHERE userid={$r['trUSER']}"); $db->query("UPDATE users SET money=money+{$r['trMONEY']} WHERE userid={$r['trFROM']}"); $db->query("DELETE FROM trades WHERE trID={$_GET['ID']}"); echo " Trade <font color=red>declined!<font><br /> <a href='trade.php'><button>Back</button></a>"; } $h->endpage(); ?> Inv_dropdown for your global_func.php <?php function inv_dropdown($connection, $ddname = 'inv', $selected = -1) { global $db, $userid; $ret = "<select name='$ddname' type='dropdown'>"; $q = $db->query("SELECT * FROM inventory LEFT JOIN items ON inv_itemid=itmid WHERE inv_userid={$userid} ORDER BY itmname ASC"); if ($selected < 1) { $ret .= "<option value='0' selected='selected'> None </option>"; } else { $ret .= "<option value='0'> None </option>"; } while ($r = $db->fetch_row($q)) { $ret .= "\n<option value='{$r['itmid']}'"; if ($selected == $r['itmid']) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['itmname']}</option>"; } $ret .= "\n</select>"; return $ret; } ?> And for your staff_logs.php file <?php //The case to add at the top case 'tradelogs': view_trade_logs(); break; //And the function to add. Then of course you'll want to add the link to your smenu function view_trade_logs() { global $db, $ir, $c, $h, $userid; echo '<h3>Trade Logs</h3><hr />'; if (!$_GET['st']) { $_GET['st'] = 0; } $st = abs((int) $_GET['st']); $app = 50; $q = $db->query('SELECT * FROM trades_logs'); $trades = $db->num_rows($q); $pages = ceil($trades / $app); echo 'Pages:&nbsp;'; for ($i = 1; $i <= $pages; ++$i) { $s = ($i - 1) * $app; if ($s == $st) { echo "<b>$i</b>&nbsp;"; } else { echo "<a href='staff_logs.php?action=tradelogs&st=$s'>$i</a>&nbsp;"; } if (0 == $i % 25) { echo '<br />'; } } echo "<br /> <table width='100%' cellspacing=1 class='table'><th>ID</th><th>User</th><th>Money</th><th>Items</th><th>Qty</th><th>ACP</th><th>IP</th></tr>"; $q = $db->query("SELECT t.*,u1.username as trader, u2.username as tradee FROM trades_logs t LEFT JOIN users u1 ON t.trFROM=u1.userid LEFT JOIN users u2 ON t.trUSER=u2.userid ORDER BY t.trID DESC LIMIT $st,$app"); while ($r = $db->fetch_row($q)) { echo "<tr><td width=5%>{$r['trID']}</td><td width=15%>[<a href='viewuser.php?u={$r['trFROM']}'>{$r['trader']}</a>]</td><td>$".$db->escape($r['trMONEY']).'</td>'; $ex = explode(',', $r['trITEM']); $qty = explode(',', $r['trQTY']); $n = 0; $items_needed=''; $qty_needed=''; foreach ($ex as $i) { $item = $db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$i}"); $t = $db->fetch_row($item); if (0 == $qty[$n]) { $items_needed = 'None'; } $items_needed .= $t['itmname'].'<br />'; $qty_needed .= $qty[$n].'<br/>'; ++$n; } unset($n); echo '<td>'.$items_needed.'</td> <td>'.$qty_needed.'</td>'; if (0 == $r['trACC']) { $ac = 'No'; } elseif (1 == $r['trRCC']) { $ac = 'Yes'; } elseif (2 == $r['trACC']) { $ac = 'Canc'; } echo '<td>'.$ac."</td> <td>{$r['trTAK']}</td></tr> <tr><td width=5%>{$r['trID']}</td><td width=15%>[<a href='viewuser.php?u={$r['trUSER']}'>{$r['tradee']}</a>]</td><td>$".$db->escape($r['trRMONEY']).'</td>'; $ex = explode(',', $r['trRITEM']); $qty = explode(',', $r['trRQTY']); $n = 0; $qty_needed1=''; $items_needed1=''; foreach ($ex as $i) { $item = $db->query("SELECT `itmname` FROM `items` WHERE `itmid`={$i}"); $t = $db->fetch_row($item); if (0 == $qty[$n]) { $items_needed1 = 'None'; } $items_needed1 .= $t['itmname'].'<br />'; $qty_needed1 .= $qty[$n].'<br/>'; ++$n; } unset($n); echo '<td>'.$items_needed1.'</td> <td>'.$qty_needed1.'</td>'; if (0 == $r['trRACC']) { $acc = 'No'; } elseif (1 == $r['trRACC']) { $acc = 'Yes'; } elseif (2 == $r['trRACC']) { $acc = 'Canc'; } echo '<td>'.$acc."</td> <td>{$r['trRTAK']}</td> </tr>"; } echo '</table><br />'; $mypage = floor($_GET['st'] / $app) + 1; echo 'Pages:&nbsp;'; for ($i = 1; $i <= $pages; ++$i) { $s = ($i - 1) * $app; if ($s == $st) { echo "<b>$i</b>&nbsp;"; } else { echo "<a href='staff_logs.php?action=tradelogs&st=$s'>$i</a>&nbsp;"; } if (0 == $i % 25) { echo '<br />'; } } stafflog_add("Looked at the Trade Logs(Page $mypage)"); } ?> You'll want to add the link to your smenu staff_logs.php?action=tradelogs and of course the trade.php link to explore. Edit* This was tested on base mccodes and it worked for me, I also stripped all the game specific css coding so it is barebones.
  6. Well as soon as I can get a gaming PC I'll join you ?
  7. Play on ps4 or xbox, ya scrub ?
  8. That is very understandable, I don’t have nearly as much time as I used to and it sucks
  9. Happy to see you back even if you’re not actively coding!
  10. Welcome back Kyle! Good to see you
  11. I mean it’s not super embarrassing, I was just apparently too lazy to figure it out on my own, so I asked @Daveand got ignored ? (Note I find my younger self annoying when I read his messages ?)
  12. Welcome back!
  13. Welcome @Aveneia we are lovers of “most” things code (I hated C# back in the day) glad to have you here!
  14. Too much on my plate really, between work and other aspects of my life along with trying to learn to be a better developer.
  15. Pie? I like pie. Welcome!
  16. Welcome, it’s nice to see fresh faces in old places! lol
  17. As of yet no one has offered to buy it, and made a serious offer. I wouldn’t care to sell to someone that would take care of it
  18. I co-owned a site called Flight of Dragons. We recently made the decision to shut it down. The other co-owners ended up becoming too busy on the RL side of things and with how much I've been working and trying to deal with RL stuff it just wasn't working out. On that note though I haven't given up developing and @Magictallguyhas been a good source of learning and continues to be so. As of right now I'm starting to learn about MVC style coding. Maybe eventually I can put out another game. I love creating and running them.
  19. Nice to see you back Dayo!
  20. Veramys

    G7470

    Nice to see you back buddy!
  21. Veramys

    Veramis

    Hello, I’m Veramis. I’ve been a part of the community for awhile now. Super stoked that it’s back up too! I have run a few games that were moderately successful. At the moment I work in a hospital so finding time to do what I love has been a challenge. But I’m not going to give it up! I’m learning MVC and hope to be able to use it to create a new project eventually. i really hope this community gets back and active like it used to be!
  22. I’m sooo happy!
  23. It is the full source code. And you can modify it however you please.
×
×
  • Create New...