Jump to content

Search the Community

Showing results for tags 'mccode-v2'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Community
    • News and Announcements
    • Introductions
    • Feedback and Site Support
    • Collaboration Experiences
  • General Development Central
    • General
    • Game Support
    • Game Projects
    • Services
    • Web Developement
    • Art and Content
  • Game Engines
    • MCCodes
    • Generic RPG
    • Gangster Legends
    • Other Game Engines
  • Technics
    • PHP
    • MySQL, Oracle, Postgress or other DB
    • Web Design
    • Programming Tools, Software and much more
    • Other Programming
    • Linux and Webservers
    • JavaScript
  • Misc
    • General Gaming Discussion
    • Chit Chat
    • Fun & Games
    • Tech News
    • Question of the day
    • Media Entertainment (FKA Tv Shows)

Categories

  • MCCodes v2
    • Free
    • Paid
  • GRPG
  • Gangster Legends V2
    • Modules
    • Themes
  • Graphics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Location


Interests


Occupation


Website

Found 225 results

  1. Uridium

    mods

    do people still need mods and is V2 still alive for the use of mods ?
  2. An add-on for that mining mod I put together. They both can be used together, and I would highly recommend that they are. CREATE A FILE CALLED refine.php: <?php /** Mod Title: Refinery Info: Refine Gold/Silver/Copper flakes into their respected currency. By: TheMasterGeneral Code Tweaks: KyleMassacre (Thanks Kyle!) Cost: Free File: /refine.php */ require('refine_globals.php'); if (!isset($_GET['action'])) { $_GET['action'] = ''; } switch ($_GET['action']) { case 'refinegold': refine_gold(); break; case 'refinesilver': refine_silver(); break; case 'refinecopper': refine_copper(); break; default: refine_home(); break; } function refine_home() { global $h; echo "<h3>Refinery</h3> Welcome to the refinery. Here you may refine your flakes into coins! How awesome is that?! You've got to have the flakes, and the skill. If you have neither, you will more than likely fail at refining flakes. Now, what would you like to refine? [<a href='refine.php?action=refinecopper'>Copper Coins</a>] [<a href='refine.php?action=refinesilver'>Silver Coins</a>] [<a href='refine.php?action=refinegold'>Gold Coins</a>]"; //Gold coins is my third currency. If you //Do not have, then you can remove the link. $h->endpage(); } function refine_copper() { global $db,$userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidcopperflake']} AND `inv_userid` = $userid"); $totalcflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Copper</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinecopper' method='post'> How many flakes do you wish to refine into copper coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. (If you have 11 flakes, and enter 11 flakes, you will receive 1 coin, and lose all flakes) <input type='text' name='amount' /> <input type='submit' value='Refine Copper Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requirecflakes']) { echo "You need to refine at least {$refine['requirecflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalcflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedcflakes = ($_POST['amount']/$refine['requirecflakes']); $flakesgonec = ($receivedcflakes*$refine['requirecflakes']); echo "You have refined {$_POST['amount']} Copper Flakes and gained {$receivedcflakes} Copper Coins!"; item_remove($userid, $refine['itemidcopperflake'], $flakesgonec); $db->query( "UPDATE `users` SET `money` = `money` + {$receivedcflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } function refine_silver() { global $db, $userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidsilverflake']} AND `inv_userid` = $userid"); $totalsflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Silver</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinesilver' method='post'> How many flakes do you wish to refine into Silver Coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. (If you have 26 flakes, and enter 26 flakes, you will receive 1 coin, and lose all flakes) <input type='text' name='amount' /> <input type='submit' value='Refine Silver Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requiresflakes']) { echo "You need to refine at least {$refine['requiresflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalsflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedsflakes = ($_POST['amount']/$refine['requiresflakes']); $flakesgones = ($receivedsflakes*$refine['requiresflakes']); echo "You have refined {$_POST['amount']} Silver Flakes and gained {$receivedsflakes} Silver Coins!"; item_remove($userid, $refine['itemidsilverflake'], $flakesgones); $db->query( "UPDATE `users` SET `crystals` = `crystals` + {$receivedsflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } function refine_gold() { global $db, $userid, $h, $refine; $q = $db->query("SELECT (`inv_qty`) FROM `inventory` WHERE `inv_itemid` = {$refine['itemidgoldflake']} AND `inv_userid` = $userid"); $totalgflakes = $db->fetch_single($q); $db->free_result($q); echo "<h3>Refine Gold</h3>"; if(!isset($_POST['amount'])) { print "<form action='refine.php?action=refinegold' method='post'> How many flakes do you wish to refine into gold coins? If you enter a value higher than the amount of flakes needed, you will lose those flakes. (If you have 51 flakes, and enter 51 flakes, you will receive 1 coin, and lose all flakes) <input type='text' name='amount' /> <input type='submit' value='Refine Gold Flakes' /> </form>"; } else { //Sanitize input $_POST['amount'] = abs((int) $_POST['amount']); if (!$_POST['amount']) { echo "Invalid use of file"; exit; } //Zero input? if ($_POST['amount'] < $refine['requiregflakes']) { echo "You need to refine at least {$refine['requiregflakes']} flakes to get a coin."; $h->endpage(); exit; } //Input larger than inventory amount? if ($_POST['amount'] > $totalgflakes) { echo "You do not have that many flakes to refine."; $h->endpage(); exit; } //Refine complete. $receivedgflakes = ($_POST['amount']/$refine['requiregflakes']); $flakesgoneg = ($receivedgflakes*$refine['requiregflakes']); echo "You have refined {$_POST['amount']} Gold Flakes and gained {$receivedgflakes} Gold Coins!"; item_remove($userid, $refine['itemidgoldflake'], $flakesgoneg); $db->query( "UPDATE `users` SET `goldcoin` = `goldcoin` + {$receivedgflakes} WHERE `userid` = {$userid}"); $h->endpage(); exit; } } Save, upload. CREATE ANOTHER FILE CALLED refine_globals.php: [There's an underscore (_) between refine and globals] <?php //Thanks Kyle require_once('globals.php'); //Config start. (Edit as you see fit) $refine = array( "requiregflakes" => 50, "requiresflakes" => 25, "requirecflakes" => 10, "itemidgoldflake" => 94, "itemidsilverflake" => 68, "itemidcopperflake" => 95 ); //Config end Replace the information I have set to yours. You may have to consult your mine_globals.php file for your items (if you are currently using the mining mod I made) Save, upload. ADD TO explore.php (or anywhere): <a href='refine.php'>Refinery</a> Screenies: Home Refine? Refined! Current Version: 1.0 Changelog Version 1.0 [1-15-2015]: Public release "Friendly to lazies" download link coming in a few!! Comments, questions or concerns. please let me know by replying here or by PM.
  3. Version 1

    20 downloads

    this back ground i made last year for a game with a bunch of stuff, but thay never paid for my work so here its Need Help?: contact me here or in discord (PHPkiller#5602). Donations?: BTC: 1BxYTrbnunSBG5AmBMyobPkCByWLhAPck4 ETH: 0xD26EE454C3068132dB5ef2E27b86d0C6c138cEc9 DASH: XvUa3A52DywoLgYnTXHTw1goRWyw5T6sRn

    Free

  4. This mod was created a while back, but I wasn't able to upload it as I lost all my coding things when my laptop got messed up. However I did find a backup, so here it is. It is a back for Crystals or whatever you're game has named them, hence the name secondary bank. All feedback welcome. :) seBank.php <?php include 'globals.php'; /* Designed and developed by Script47. Edited by Peterisgb & Re-recoded by Magictallguy. The code here (named "seBank") is provided "as is" with no warranty or gurantee of safety to existing code. seBank has been fully tested and is found to work as intended. seBank is released freely under the GNU License. Feel free to modify as you wish, as long as this comment block remains untouched. */ $bankprice = 10000; $currencyname = $set['crystalname']; // Change to set your crystal's name. echo "<h3>",$currencyname," Bank</h3>"; if($ir['bankcrystals'] > -1) { switch($_GET['action']) { case "deposit": deposit(); break; case "withdraw": withdraw(); break; default: index(); break; } } else { if(isset($_GET['buy'])) { if($ir['money'] > 9999) { $db->query("UPDATE `users` SET `money` = `money` - ".$bankprice.", `bankcrystals` = 0 WHERE `userid` = ".$userid); ?>Congratulations, you bought a <? echo $currencyname; ?> bank for <? echo money_formatter($bankprice); ?>!<br /><a href="sebank.php">Start using your account</a><br /><? } else { ?>Sorry, you don't have enough <? echo $set['moneyname']; ?> to open a account.<br /><a href='explore.php'>Back to town?</a><br /><? } } else { ?>Open a bank account today, just <? echo money_formatter($bankprice); ?>!<br /><a href='sebank.php?buy'>> Yes, sign me up!</a><? } } function index() { global $ir, $currencyname; ?><strong>You currently have <? echo number_format($ir['bankcrystals']).' '.$currencyname; ?> in the bank.</strong><br /> <table width='75%' cellspacing='1' class='table'> <tr> <td width='50%'><strong>Deposit <? echo $currencyname; ?></strong><br /> <form action='sebank.php?action=deposit' method='post'> Amount: <input type='text' name='deposit' value='<? echo number_format($ir['crystals']); ?>' /><br /> <input type='submit' value='Deposit' /> </form></td> <td><strong>Withdraw <? echo $currencyname; ?></strong><br /> <form action='sebank.php?action=withdraw' method='post'> Amount: <input type='text' name='withdraw' value='<? echo number_format($ir['bankcrystals']); ?>' /><br /> <input type='submit' value='Withdraw' /> </form></td> </tr> </table><? } function deposit() { global $db, $ir, $h, $currencyname; $_POST['deposit'] = isset($_POST['deposit']) && is_string($_POST['deposit']) ? abs(@intval(str_replace(',', '', $_POST['deposit']))) : null; if(empty($_POST['deposit'])) { echo "You didn't enter a valid amount to deposit"; $h->endpage(); exit; } if($_POST['deposit'] > $ir['crystals']) { echo "You do not have enough ",$currencyname," to deposit this amount."; $h->endpage(); exit; } $db->query("UPDATE `users` SET `bankcrystals` = `bankcrystals` + ".$_POST['deposit'].", `crystals` = `crystals` - ".$_POST['deposit']." WHERE `userid` = ".$ir['userid']); echo "You hand over ",number_format($_POST['deposit'])," ",$currencyname," to be deposited. <br /><a href='sebank.php'>> Back</a>"; } function withdraw() { global $db, $ir, $h, $currencyname; $_POST['withdraw'] = isset($_POST['withdraw']) && is_string($_POST['withdraw']) ? abs(@intval(str_replace(',', '', $_POST['withdraw']))) : null; if(empty($_POST['withdraw'])) { echo "You didn't enter a valid amount to withdraw"; $h->endpage(); exit; } if($_POST['withdraw'] > $ir['bankcrystals']) { echo "You do not have enough ",$currencyname," in the bank to withdraw this amount."; $h->endpage(); exit; } $db->query("UPDATE `users` SET `bankcrystals` = `bankcrystals` - ".$_POST['withdraw'].", `crystals` = `crystals` + ".$_POST['withdraw']." WHERE `userid` = ".$ir['userid']); echo "You ask to withdraw ",number_format($_POST['withdraw']),", <br />the banker hands it over. <br /><strong>You now have ",number_format($ir['bankcrystals'] - $_POST['withdraw'])," ",$currencyname," in the bank.</strong><br /><a href='sebank.php'>> Back</a>"; } $h->endpage(); ?> SQL: ALTER TABLE users ADD COLUMN bankcrystals INT NOT NULL DEFAULT '-1';
  5. I pretty sure the mccodes engine is dead now but would there be any updates on the ip system for support with ipv6 connections. I dont have ipv4 which some sites (mccodes included) require to run perfectly.
  6. I have decided to release my voting mod for free. Updates will continue to roll out for this mod if and when needed.
  7. My mailbox mod is now free. Updates and fixes will continue.
  8. Dave

    Ajax Donation System

    Version 1.0.0

    Our Ajax donation system is a must have for any new or old MCCodes v2 game! With it's vast amount of features which have never been seen before in a donation system this could potentially increase your sales making your site more profitable! Easy Installation! We tried to make it as easy as possible to install this mod! So we did! You simply upload all the files and make one small change to your inventory. Then when you run the staff panel file all the database side of things is created for you. Feature List: Ajax Cart Feature - Giving the ability to purchase more than one pack at any given time. Ajax UI - Making the users and staff experience allot better. Discounting System - Allowing you to throw a special summer 50% of discount without having to edit any code! Payment Gateways - Given the mod the ability to install a new payment gateway by simply uploading the files and hitting install in the staff panel. AnyGive - This allows your donator packs to modify any row of the users and user stats table meaning you can make more advanced packs. Unlimited Items and AnyGive - Giving you the freedom to give your users everything they could want from a pack Min/Max Purchase - Giving you control on how much you want your users to spend. Credit Type - You can set your system on Instant Credit so the user instantly receive the pack or set it to Item Credit so the user receives the donator pack as an item in their inventory. Currency Code/Sign - Allowing you to have your donation system in any currency. This mod also comes with the PayPal Gateway for free! The gateway itself contains a number of great features listed below. PayPal Gateway Features: IPN - Means your site can run without needing someone to credit the packets every time the user purchases something. It's all automatic. Sandbox mode/Debugging - Making it easy for our support team or other programmers to locate and fix issues. Subscriptions - Allowing you to setup subscription packs making you a set amount each month! Requires Premier or Business PayPal Account. Requirements: MCCodes v2 (currently no support for Redux) PHP 5.2.* (May work on other versions but not tested) PayPal Account for PayPal Module PayPal Premier or Business account for subscriptions. Non-conflicting jQuery versions. Support: This module comes with no support, due to it being legacy code.

    $15.00

  9. Version 1.0.0

    Our Ajax Gang/Channel chat system comes with so many features we can't even count! It has easy customization and allows the administrators of the site to add channels to the chat to allow a more diverse conversation experience for your players! This mod will bring alive your McCodes v2 game! Easy Installation! We tried to make it as easy as possible to install this mod! So we did! You simply upload all the files and make a single edit to your globals.php to install the mod! (You may want to add a link in your staff panel for ease of access) Feature List: Fully Ajax! - The user will never need to refresh to see any new messages are send any messages. Channel System - This allows the administrators to create multiple channels with requirements. So for instance you could have a global channel, a trade channel and then a staff channel. Easy Customization - We've added loads of control features to the staff panel so you can control the way the system functions and looks without having to edit any code! Gang Chat - Each user who is in a gang is automatically presented with the gang chat so they can speak to their fellow gang members. Requirements: MCCodes V2. PHP 5.2.* (May work on other versions but not tested). PHP Short Tags Enabled. Javascript enabled in browser. No conflicting jQuery versions. Support: This modification comes with unlimited bug support. Meaning if you find a bug or glitch in the original code we will release a patch and send it to everyone who purchased it, free of charge

    $15.00

  10. This isn't a big mod if a mod at all. This mod/snippit allows you to replace your in game profile_pic with your Gravatar image. It will display a gravatar image if user doesn't have a profile pic. Place this Snippit into where you wish to display. Change $r to $ir where necessary. if ('Male' == $r['gender']) { $gender = 'images/male.png'; } else { $gender = 'images/female.png'; } $email = $r['email']; $default = $gender; $size = 40; $grav_url = "https://www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?d=" . urlencode( $default ) . "&s=" . $size; if ($r['display_pic']) { echo '<img src="'.$r['display_pic'].'" width="40" height="40" class="avatar">'; } else { echo '<img src="'.$grav_url.'" class="avatar">'; } Upload images to images/ directory. The comments gave me the idea to make avataaars mod. Which is on the market place. Thanks.
  11. I decided to make a Daily Rewards System. It has a built in staff panel. Sql's for the Rewards CREATE TABLE `dailyrewards` ( `id` int(11) NOT NULL, `day` int(11) DEFAULT NULL, `week` int(11) DEFAULT NULL, `image` varchar(255) DEFAULT NULL, `prize` varchar(255) DEFAULT NULL, `textcolour` varchar(255) DEFAULT NULL, `prizedisplay` varchar(255) DEFAULT NULL, `amount` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Sql's for the User ALTER TABLE users ADD dailytoken INT NOT NULL DEFAULT 1, ADD daily INT NOT NULL DEFAULT 0; And finally the Page dailyrewards.php <?php include_once('globals.php'); ?> <style type="text/css" media="screen"> table.greenTable { font-family: Georgia, serif; border: 6px solid #9ACD32; background-color: #709624; width: 100%; text-align: center; } table.greenTable td, table.greenTable th { border: 1px solid #9ACD32; padding: 3px 2px; } table.greenTable tbody td { font-size: 13px; } table.greenTable tr:nth-child(even) { background: #9ACD32; } table.greenTable thead { background: #9ACD32; background: -moz-linear-gradient(top, #b3d965 0%, #a4d246 66%, #9ACD32 100%); background: -webkit-linear-gradient(top, #b3d965 0%, #a4d246 66%, #9ACD32 100%); background: linear-gradient(to bottom, #b3d965 0%, #a4d246 66%, #9ACD32 100%); border-bottom: 0px solid #444444; } table.greenTable thead th { font-size: 19px; font-weight: bold; color: #F0F0F0; text-align: left; border-left: 2px solid #9ACD32; } table.greenTable thead th:first-child { border-left: none; } table.greenTable tfoot { font-size: 13px; font-weight: bold; color: #F0F0F0; background: #24943A; background: -moz-linear-gradient(top, #5baf6b 0%, #3a9e4d 66%, #24943A 100%); background: -webkit-linear-gradient(top, #5baf6b 0%, #3a9e4d 66%, #24943A 100%); background: linear-gradient(to bottom, #5baf6b 0%, #3a9e4d 66%, #24943A 100%); border-top: 1px solid #24943A; } table.greenTable tfoot td { font-size: 13px; } table.greenTable tfoot .links { text-align: right; } table.greenTable tfoot .links a{ display: inline-block; background: #FFFFFF; color: #24943A; padding: 2px 8px; border-radius: 5px; } .button { background-color: #787878; border-radius: 10px; border: none; color: white; padding: 8px 25px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 2px 1px; cursor: pointer; } input[type='text'] { width: 221px; background: transparent url('images/bg.jpg') no-repeat; color : #423232; height:20px; border:1; padding:4px 8px; margin-bottom:0px; border-radius: 10px; } .dropdown { width: 200px; background: transparent url('images/bg.jpg') no-repeat; color : #423232; height:30px; border:1; padding:4px 8px; margin-bottom:0px; border-radius: 10px; } </style> <?php echo '<h2>Daily Rewards</h2><hr />'; $_GET['staff'] = !empty($_GET['staff']) ? $_GET['staff'] : ''; switch($_GET['staff']) { case 'staff': staff_panel(); break; case 'add': add(); break; case 'addreward': add_go(); break; case 'edit': edit(); break; case 'delete': delete(); break; } function staff_panel() { global $db,$ir,$userid,$h; $version='1.4.8'; echo '<h2 class="fontface">Staff Panel</h2> <br /><br /> <a href="?staff=add" class="button">Add Reward</a><br /> <a href="?staff=edit" class="button">Edit Reward</a><br /> <a href="?staff=delete" class="button">Delete Reward</a><br /> <br /><a href="dailyrewards.php" class="button">Back</a><br /> <iframe src="https://www.arcadiagames.tk/update/update_check.php?v='.$version.'&mod=daily-rewards" width="250" height="60" scrolling="no" frameborder="1"></iframe> '; $h->endpage(); exit; } function add() { global $db, $h, $userid; echo '<h2 class="fontface">Add Daily Reward</h2><hr /> <form action="?staff=addreward" method="POST"> Day: <input type="text" name="dayz" placeholder="Day of the Week"><br /> Week: <input type="text" name="week" placeholder="Which Week?"><br /> Icon <input type="text" name="image" placeholder="icons/"><br /> DB reward: <input type="text" name="prize" placeholder="Reward Type (money, donatordays etc)"><br /> Prize Text Colour: <input type="text" name="textcolour" placeholder="red"><br /> Prize Text Disply: <input type="text" name="prizedisplay" placeholder="Money, Days etc"><br /> Reward: <input type="text" name="amount" placeholder="1000"><br /> <input type="submit" class="button" value="Add Reward"></form> <br /><a href="?staff=staff" class="button">Back</a>'; $h->endpage(); exit; } function add_go() { global $db, $h, $userid; $day = array_key_exists('day', $_POST) && ctype_digit($_POST['day']) && $_POST['day'] > 0 ? $_POST['day'] : null; $week = array_key_exists('week', $_POST) && ctype_digit($_POST['week']) && $_POST['week'] > 0 ? $_POST['week'] : null; $image = array_key_exists('image', $_POST) && is_string($_POST['image']) ? stripslashes(htmlspecialchars($_POST['image'])) : null; $prize = array_key_exists('prize', $_POST) && ctype_digit($_POST['prize']) && $_POST['prize'] > 0 ? $_POST['prize'] : null; $textc = array_key_exists('textcolour', $_POST) && is_string($_POST['textcolour']) && ctype_alnum($_POST['textcolour']) ? strip_tags($_POST['textcolour']) : null; $prized = array_key_exists('prizedisplay', $_POST) && is_string($_POST['prizedisplay']) && ctype_alnum($_POST['prizedisplay']) ? strip_tags($_POST['prizedisplay']) : null; $amount = array_key_exists('amount', $_POST) && ctype_digit($_POST['amount']) && $_POST['amount'] > 0 ? $_POST['amount'] : null; $db->query("INSERT INTO dailyrewards VALUES(NULL, '$day', '$week', '$image', '$prize', '$textc', '$prized','$amount')"); echo 'Reward Day '.$day.', Week '.$week.' added to the game. <br /><a href="dailyrewards.php" class="button">Back</a>'; stafflog_add("Made Daily Reward for $day day and $week week."); $h->endpage(); exit; } function edit() { global $db, $ir, $c, $h, $userid; $_POST['step'] = !empty($_POST['step']) ? $_POST['step'] : ''; switch($_POST['step']) { case "2": $day = array_key_exists('day', $_POST) && ctype_digit($_POST['day']) && $_POST['day'] > 0 ? $_POST['day'] : null; $week = array_key_exists('week', $_POST) && ctype_digit($_POST['week']) && $_POST['week'] > 0 ? $_POST['week'] : null; $image = array_key_exists('image', $_POST) && is_string($_POST['image']) ? stripslashes(htmlspecialchars($_POST['image'])) : null; $prize = array_key_exists('prize', $_POST) && ctype_digit($_POST['prize']) && $_POST['prize'] > 0 ? $_POST['prize'] : null; $textc = array_key_exists('textcolour', $_POST) && is_string($_POST['textcolour']) && ctype_alnum($_POST['textcolour']) ? strip_tags($_POST['textcolour']) : null; $prized = array_key_exists('prizedisplay', $_POST) && is_string($_POST['prizedisplay']) && ctype_alnum($_POST['prizedisplay']) ? strip_tags($_POST['prizedisplay']) : null; $amount = array_key_exists('amount', $_POST) && ctype_digit($_POST['amount']) && $_POST['amount'] > 0 ? $_POST['amount'] : null; $dail=$db->query("SELECT * FROM dailyrewards WHERE day='{$day}'"); $day=$_POST['day']; $dail=$db->query("SELECT * FROM dailyrewards WHERE day={$_POST['day']}"); $old=$db->fetch_row($dail); $db->query("UPDATE dailyrewards SET day=$day, week='$week', image='$image', prize='$prize', textcolour='$textc', prizedisplay='$prized', amount='$amount' WHERE day={$_POST['day']}"); echo 'Daily Reward day '.$day.' was edited successfully.'; stafflog_add("Edited reward day $day"); $h->endpage(); exit; break; case "1": $dr=$db->query("SELECT * FROM dailyrewards WHERE day={$_POST['day']}"); $old=$db->fetch_row($dr); echo '<h2 class="fontface">Editing a reward</h2><hr /> <form action="?staff=edit" method="POST"> <input type="hidden" name="step" value="2"> <input type="hidden" name="day" value="'.$_POST['day'].'"> Day: <input type="text" name="day" value="'.$old['day'].'"><br /> Week: <input type="text" name="week" value="'.$old['week'].'"><br /> Icon <input type="text" name="image" value="'.$old['image'].'"><br /> DB reward: <input type="text" name="prize" value="'.$old['prize'].'"><br /> Prize Text Colour: <input type="text" name="textcolour" value="'.$old['textcolour'].'"><br /> Prize Text Disply: <input type="text" name="prizedisplay" value="'.$old['prizedisplay'].'"><br /> Reward: <input type="text" name="amount" value="'.$old['amount'].'"><br /> <input type="submit" value="Edit Reward" class="button"></form>'; $h->endpage(); exit; break; default: echo '<h2 class="fontface">Editing a Reward</h2><hr /> <form action="?staff=edit" method="POST"> <input type="hidden" name="step" value="1"> Select voting site: '; function day_dropdown($connection, $ddname = "day", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown' class='dropdown'>"; $q = $db->query("SELECT `day`, `week` FROM `dailyrewards` ORDER BY `day` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = $db->fetch_row($q)) { $ret .= "\n<option value='{$r['day']}'"; if ($selected == $r['day'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['day']}</option>"; } $db->free_result($q); $ret .= "\n</select>"; return $ret; } echo ''.day_dropdown(NULL, 'day').'<br /> <input type="submit" value="Edit Reward" class="button"></form>'; $h->endpage(); exit; break; } } function delete() { global $db,$c,$h,$userid; $_POST['day'] = !empty($_POST['day']) ? $_POST['day'] : ''; if($_POST['day']) { $day = $_POST['day']; $dr=$db->query("SELECT * FROM dailyrewards WHERE day=$day"); $old=$db->fetch_row($dr); $db->query("DELETE FROM dailyrewards WHERE day=$day"); echo 'Day '.$day.' deleted.'; stafflog_add("Deleted Reward Day $day"); $h->endpage(); exit; } else { echo '<h2 class="fontface">Delete Day</h2><hr /> Deleting a Reward. <form action="?staff=delete" method="POST"> Select Day: '; function day_dropdown($connection, $ddname = "day", $selected = -1) { global $db; $ret = "<select name='$ddname' type='dropdown' class='dropdown'>"; $q = $db->query("SELECT `day`, `week` FROM `dailyrewards` ORDER BY `day` ASC"); if ($selected == -1) { $first = 0; } else { $first = 1; } while ($r = $db->fetch_row($q)) { $ret .= "\n<option value='{$r['day']}'"; if ($selected == $r['day'] || $first == 0) { $ret .= " selected='selected'"; $first = 1; } $ret .= ">{$r['day']}</option>"; } $db->free_result($q); $ret .= "\n</select>"; return $ret; } echo ''.day_dropdown(NULL, 'day').'<br /> <input type="submit" value="Delete Reward" class="button"></form>'; $h->endpage(); exit; } } $_GET['claim'] = array_key_exists('claim', $_GET) && is_numeric($_GET['claim']) ? (int)$_GET['claim'] : null; switch($_GET['claim']) { case '1': day1(); break; case '2': day2(); break; case '3': day3(); break; case '4': day4(); break; case '5': day5(); break; case '6': day6(); break; case '7': day7(); break; case '8': day8(); break; case '9': day9(); break; case '10': day10(); break; case '11': day11(); break; case '12': day12(); break; case '13': day13(); break; case '14': day14(); break; case '15': day15(); break; case '16': day16(); break; case '17': day17(); break; case '18': day18(); break; case '19': day19(); break; case '20': day20(); break; case '21': day21(); break; case '22': day22(); break; case '23': day23(); break; case '24': day24(); break; case '25': day25(); break; case '26': day26(); break; case '27': day27(); break; case '28': day28(); break; default: index(); break; } function index() { global $db,$ir,$c,$userid,$h; $daily = $ir['daily']; $token = $ir['dailytoken']; echo ' You are on day <span class="brightred">'.$daily.'</span>.<br /> '; if ($token >= 1) { echo 'You have a Token for today.'; } else { echo 'You Don\'t have a token for today.'; } echo '<hr /><br />'; if ($ir['user_level'] == 2) { echo '<a href="?staff=staff" class="button">Staff Panel</a>'; } echo ' <table class="greenTable" style="height: 396px;" width="615"><tbody> <tr><td>WEEK 1</td>'; $reward = $db->query("SELECT * FROM dailyrewards WHERE week=1 ORDER BY day"); while ($dr = $db->fetch_row($reward)) { echo '<td>DAY: '.$dr['day'].'<br /><img src="'.$dr['image'].'" alt="'.$dr['prizedisplay'].'" width="30px" height="30px"><br /><span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).' '.$dr['prizedisplay'].'</b></span></td>'; } echo '</tr> <tr> <td></td> <td>'; if ($daily <= '1') { echo '<a href="?claim=1"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '2') { echo '<a href="?claim=2"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '3') { echo '<a href="?claim=3"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '4') { echo '<a href="?claim=4"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '5') { echo '<a href="?claim=5"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '6') { echo '<a href="?claim=6"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '7') { echo '<a href="?claim=7"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> </tr> <tr><td>WEEK 2</td>'; $reward = $db->query("SELECT * FROM dailyrewards WHERE week=2 ORDER BY day"); while ($dr = $db->fetch_row($reward)) { echo '<td>DAY: '.$dr['day'].'<br /><img src="'.$dr['image'].'" alt="'.$dr['prizedisplay'].'" width="30px" height="30px"><br /><span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).' '.$dr['prizedisplay'].'</b></span></td>'; } echo '</tr> <tr> <td></td> <td>'; if ($daily == '8') { echo '<a href="?claim=8"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '9') { echo '<a href="?claim=9"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '10') { echo '<a href="?claim=10"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '11') { echo '<a href="?claim=11"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '12') { echo '<a href="?claim=12"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '13') { echo '<a href="?claim=13"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '14') { echo '<a href="?claim=14"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> </tr> <tr><td>WEEK 3</td>'; $reward = $db->query("SELECT * FROM dailyrewards WHERE week=3 ORDER BY day"); while ($dr = $db->fetch_row($reward)) { echo '<td>DAY: '.$dr['day'].'<br /><img src="'.$dr['image'].'" alt="'.$dr['prizedisplay'].'" width="30px" height="30px"><br /><span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).' '.$dr['prizedisplay'].'</b></span></td>'; } echo '</tr> <tr> <td></td> <td>'; if ($daily == '15') { echo '<a href="?claim=15"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '16') { echo '<a href="?claim=16"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '17') { echo '<a href="?claim=17"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '18') { echo '<a href="?claim=18"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '19') { echo '<a href="?claim=19"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '20') { echo '<a href="?claim=20"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '21') { echo '<a href="?claim=21"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> </tr> <tr><td>WEEK 4</td>'; $reward = $db->query("SELECT * FROM dailyrewards WHERE week=4 ORDER BY day"); while ($dr = $db->fetch_row($reward)) { echo '<td>DAY: '.$dr['day'].'<br /><img src="'.$dr['image'].'" alt="'.$dr['prizedisplay'].'" width="30px" height="30px"><br /><span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).' '.$dr['prizedisplay'].'</b></span></td>'; } echo '</tr> <tr> <td></td> <td>'; if ($daily == '22') { echo '<a href="?claim=22"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '23') { echo '<a href="?claim=23"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '24') { echo '<a href="?claim=24"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '25') { echo '<a href="?claim=25"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '26') { echo '<a href="?claim=26"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '27') { echo '<a href="?claim=27"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> <td>'; if ($daily == '28') { echo '<a href="?claim=28"><span class="brightred"><b>Claim</b></span></a>'; } echo '</td> </tr> </tbody> </table>'; } function day1() { global $db,$ir,$c,$userid,$h; $day = 1; $daily = 2; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day2() { global $db,$ir,$c,$userid,$h; $day = 2; $daily = 3; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day3() { global $db,$ir,$c,$userid,$h; $day = 3; $daily = 4; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day4() { global $db,$ir,$c,$userid,$h; $day = 4; $daily = 5; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day5() { global $db,$ir,$c,$userid,$h; $day = 5; $daily = 6; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day6() { global $db,$ir,$c,$userid,$h; $day = 6; $daily = 7; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day7() { global $db,$ir,$c,$userid,$h; $day = 7; $daily = 8; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day8() { global $db,$ir,$c,$userid,$h; $day = 8; $daily = 9; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day9() { global $db,$ir,$c,$userid,$h; $day = 9; $daily = 10; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day10() { global $db,$ir,$c,$userid,$h; $day = 10; $daily = 11; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day11() { global $db,$ir,$c,$userid,$h; $day = 11; $daily = 12; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day12() { global $db,$ir,$c,$userid,$h; $day = 12; $daily = 13; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day13() { global $db,$ir,$c,$userid,$h; $day = 13; $daily = 14; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day14() { global $db,$ir,$c,$userid,$h; $day = 14; $daily = 15; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day15() { global $db,$ir,$c,$userid,$h; $day = 15; $daily = 16; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day16() { global $db,$ir,$c,$userid,$h; $day = 16; $daily = 17; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day17() { global $db,$ir,$c,$userid,$h; $day = 17; $daily = 18; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day18() { global $db,$ir,$c,$userid,$h; $day = 18; $daily = 19; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day19() { global $db,$ir,$c,$userid,$h; $day = 19; $daily = 20; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day20() { global $db,$ir,$c,$userid,$h; $day = 20; $daily = 21; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day21() { global $db,$ir,$c,$userid,$h; $day = 21; $daily = 22; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day22() { global $db,$ir,$c,$userid,$h; $day = 22; $daily = 23; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day23() { global $db,$ir,$c,$userid,$h; $day = 23; $daily = 24; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day24() { global $db,$ir,$c,$userid,$h; $day = 24; $daily = 25; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day25() { global $db,$ir,$c,$userid,$h; $day = 25; $daily = 26; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day26() { global $db,$ir,$c,$userid,$h; $day = 26; $daily = 27; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day27() { global $db,$ir,$c,$userid,$h; $day = 27; $daily = 28; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } function day28() { global $db,$ir,$c,$userid,$h; $day = 28; $daily = 1; $token = $ir['dailytoken']; $reward = $db->query("SELECT * FROM dailyrewards WHERE day=$day ORDER BY day"); $dr = $db->fetch_row($reward); $prize = $dr['prize']; $amount = $dr['amount']; if($token <= 0) { die('You have no tokens to Trade.<br /> Come back Tomorrow.<br /><a href="dailyrewards.php">Back</a>'); $h->endpage(); } if($token >= 0) { echo '<br />Welcome to Day <span class="brightred">'.$dr['day'].'</span><br /> You have been rewared with <span class="'.$dr['textcolour'].'"><b>'.number_format($dr['amount']).'</b></span> '.$dr['prizedisplay'].'.<br /> <a href="dailyrewards.php">Back</a>'; $db->query("UPDATE users SET $prize=$prize+$amount, daily=$daily, dailytoken=dailytoken-1 WHERE userid=$userid"); } else { echo 'You cannot Claim this.<br /><a href="dailyrewards.php">Back</a>'; } $h->endpage(); } echo '<br /><hr /></center> <h5>Info</h5><small> 1. You can Claim 1 Reward a day.<br /> 2. You will only get 1 token at a time.<br /> 3. You will get your token at 5pm Each day and you have to be active in the last 24 hours to Get one.<br /> 4. Reward Payouts May change without notice. </small><center> '; $h->endpage(); ?> Add this to your Daily Cron. $db->query('UPDATE users SET dailytoken=1 WHERE dailytoken=0 AND laston>unix_timestamp()-1440*60'); I'm not the best or tidiest, but it works. Feedback welcome, NOT DIGS tho. A postback of this code if you make it better below would be great. Enjoy.
  12. 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, `trGOLD` 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, `trRGOLD` 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.
  13. Run SQL: ALTER TABLE users ADD trade INT(11) NOT NULL DEFAULT 0; CREATE TABLE `trades` ( `trID` int(11) NOT NULL auto_increment, `trFROM` int(11) NOT NULL default '0', `trUSER` int(11) NOT NULL default '0', `trCRYS` int(11) NOT NULL default '0', `trCASH` int(11) NOT NULL default '0', `trITEM` int(11) NOT NULL default '0', `trRCRYS` int(11) NOT NULL default '0', `trRCASH` int(11) NOT NULL default '0', `trRITEM` int(11) NOT NULL default '0', PRIMARY KEY (`trID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE `usertrades` ( `trID` int(11) NOT NULL auto_increment, `trFROM` int(11) NOT NULL default '0', `trUSER` int(11) NOT NULL default '0', PRIMARY KEY (`trID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Fixed by jay-dogg2006 Thanks :) Create trade.php <?php include "globals.php"; print "<center><font size='4' face='Arial, Helvetica, sans-serif'>Trading</font><hr width=75%>"; switch($_GET['action']) { default: start_trade(); break; case 'accept': accept_request(); break; case 'decline': decline_request(); break; case 'acctrade': accept_trade(); break; case 'dectrade': decline_trade(); break; case 'view': view_trade(); break; case 'begin': begin_trade(); break; case 'cancel': cancel_trade(); break; } function start_trade() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); if(!$_POST['user']) { print " <form action='trade.php' method='post'> Please type the ID# of the user you wish to trade with below. ID: <input type='text' name='user' value='{$_GET['ID']}' maxlength='10' length='10' size='10' width='10' /> <input type='submit' value='Send Request' /> </form> <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($ir['trade']) { print " You already have a trade pending completion. Please wait until it is over. <hr width=75%>> [url='trade.php']Back[/url]<hr width=75%>"; } else if($_POST['user'] == $userid) { print " You cannot trade with yourself! <hr width=75%>> [url='trade.php']Back[/url]<hr width=75%>"; } else { mysql_query("INSERT INTO usertrades VALUES ('', '$userid', '{$_POST['user']}')", $c); $q=$db->query("SELECT * FROM usertrades WHERE trFROM=$userid"); $r=$db->fetch_row($q); event_add($_POST['user'], "{$ir['username']} would like to trade with you: • [url='trade.php?action=accept&ID={$r[']Accept Offer[/url] • [url='trade.php?action=decline&ID={$r[']Decline Offer[/url]", $c,'general'); print " Trade request sent! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function accept_request() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM usertrades WHERE trID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid trade ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['trUSER'] != $userid) { print " You cannot accept this trade! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM usertrades WHERE trUSER=$userid"); $r=$db->fetch_row($q); event_add($r['trFROM'], "{$ir['username']} has accepted your trade offer: • [url='trade.php?action=cancel&ID={$r[']Cancel Trade[/url] • [url='trade.php?action=begin']Begin Trade[/url] ", $c); mysql_query("UPDATE users SET trade={$r['trFROM']} WHERE userid=$userid"); mysql_query("UPDATE users SET trade=$userid WHERE userid={$r['trFROM']}"); mysql_query("DELETE FROM usertrades WHERE trID={$_GET['ID']}"); print " Trade request accepted! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function decline_request() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM usertrades WHERE trID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid trade ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['trUSER'] != $userid) { print " You cannot decline this trade! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM usertrades WHERE trID={$_GET['ID']}"); $r=$db->fetch_row($q); event_add($r['trFROM'], "{$ir['username']} has declined your trade offer.", $c); mysql_query("DELETE FROM usertrades WHERE trID={$_GET['ID']}"); print " Trade request declined! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function cancel_trade() { global $db,$ir,$c,$userid,$h; $q=$db->query("SELECT * FROM users WHERE trade=$userid"); $r=$db->fetch_row($q); if(!$ir['trade']) { print " You are not in a trade! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['trade'] != $userid) { print " This user is not in a trade with you! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM users WHERE trade=$userid"); $r=$db->fetch_row($q); event_add($r['userid'], "{$ir['username']} has cancelled the trade.", $c); mysql_query("UPDATE users SET trade=0 WHERE userid=$userid"); mysql_query("UPDATE users SET trade=0 WHERE userid={$r['userid']}"); print " Trade cancelled! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function view_trade() { global $db,$ir,$c,$userid,$h; $q=$db->query("SELECT * FROM trades WHERE trUSER=$userid"); $r=$db->fetch_row($q); $rs=$db->num_rows($q); if($r['trUSER'] != $userid) { print " This is not your trade! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if(!$rs) { print " This trade has not yet been started! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM trades WHERE trUSER=$userid"); $r=$db->fetch_row($q); print " [b]<u>Trade Details[/b]</u> [b]Offer[/b] Money: \${$r['trCASH']} Crystals: {$r['trCRYS']} "; $x=$db->query("SELECT * FROM items WHERE itmid={$r['trITEM']}"); $i=$db->fetch_row($x); if ($r['trITEM']) { print "Item: {$i['itmname']} "; } else { print "Item: <font color=red>None</font> "; } print " [b]Request[/b] Money: \${$r['trRCASH']} Crystals: {$r['trRCRYS']} "; $x2=$db->query("SELECT * FROM items WHERE itmid={$r['trRITEM']}"); $i2=$db->fetch_row($x2); if ($r['trRITEM']) { print "Item: {$i2['itmname']} "; } else { print "Item: <font color=red>None</font> "; } if ($userid == $r['trUSER']) { print " [b]Options[/b] • [url='trade.php?action=acctrade&ID={$r[']Accept Trade[/url] • [url='trade.php?action=dectrade&ID={$r[']Decline Trade[/url] "; } print " <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function begin_trade() { global $db,$ir,$c,$userid,$h; if($_POST['crys'] || $_POST['cash'] || $_POST['item'] || $_POST['rcrys'] || $_POST['rcash'] || $_POST['ritem']) { $q=$db->query("SELECT * FROM users WHERE userid=$userid"); $r=mysql_fetch_array($q); if (!$ir['trade']) { print " You are not in a trade. <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; $h->endpage(); exit; } $db->query("INSERT INTO trades VALUES(NULL, '{$ir['userid']}', '{$ir['trade']}', '{$_POST['crys']}', '{$_POST['cash']}', '{$_POST['item']}', '{$_POST['rcrys']}', '{$_POST['rcash']}', '{$_POST['ritem']}')"); event_add($ir['trade'], "Your trade offer has been sent: • [url='trade.php?action=view']View Trade[/url] • [url='trade.php?action=cancel&ID={$r[']Cancel Trade[/url] ", $c); print " Your trade was submitted. <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { print "<form action='trade.php?action=begin' method='post'> [b]Offer[/b] Crystals: <input type='text' name='crys' /> Cash: <input type='text' name='cash' /> Item: <select name='item' type=dropdown> <option value=0 selected>None</option>"; $q=$db->query("SELECT inv.*,i.* FROM inventory inv LEFT JOIN items i ON inv.inv_itemid=i.itmid WHERE inv.inv_userid={$userid} ORDER BY i.itmname ASC",$c); while($r=mysql_fetch_array($q)) { print "\n<option value='{$r['itmid']}'>{$r['itmname']}</option>"; } print "</select> "; print " [b]Request[/b] Crystals: <input type='text' name='rcrys' /> Cash: <input type='text' name='rcash' /> Item: <select name='ritem' type=dropdown> <option value=0 selected>None</option>"; $q=$db->query("SELECT inv.*,i.* FROM inventory inv LEFT JOIN items i ON inv.inv_itemid=i.itmid WHERE inv.inv_userid={$ir['trade']} ORDER BY i.itmname ASC",$c); while($r=mysql_fetch_array($q)) { print "\n<option value='{$r['itmid']}'>{$r['itmname']}</option>"; } print "</select> "; print "<input type='submit' value='Submit' /></form> <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function accept_trade() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r=$db->fetch_row($q); $x=$db->query("SELECT * FROM users WHERE userid={$ir['trade']}"); $y=$db->fetch_row($x); $m=$db->query("SELECT * FROM inventory WHERE inv_itemid={$r['trITEM']} AND inv_userid={$r['trFROM']}"); $n=$db->num_rows($m); $o=$db->query("SELECT * FROM inventory WHERE inv_itemid={$r['trRITEM']} AND inv_userid={$r['trUSER']}"); $p=$db->num_rows($o); if(!$_GET['ID']) { print " Invalid trade ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['trUSER'] != $userid) { print " You cannot accept this trade! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['trRCASH'] > $ir['money'] || $r['trRCRYS'] > $ir['crystals']) { print " You do not meet one or more of the requirements! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($y['money'] < $r['trCASH'] || $y['crystals'] < $r['trCRYS'] ) { print " Your friend does not meet one or more of the requirements! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if(!$n < 0) { print " Your friend does not meet one or more of the requirements! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if(!$p < 0) { print " You do not meet one or more of the requirements! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM trades WHERE trUSER=$userid"); $r=$db->fetch_row($q); event_add($r['trFROM'], "{$ir['username']} has accepted your trade.", $c); if ($r['trITEM'] > 0) { mysql_query("UPDATE inventory SET inv_qty=inv_qty-1 WHERE inv_itemid={$r['trITEM']} AND inv_userid={$r['trFROM']}",$c); mysql_query("DELETE FROM inventory WHERE inv_qty=0",$c); mysql_query("INSERT INTO inventory VALUES('',{$r['trITEM']},$userid,'1');",$c); } if ($r['trRITEM'] > 0) { mysql_query("UPDATE inventory SET inv_qty=inv_qty-1 WHERE inv_itemid={$r['trRITEM']} AND inv_userid=$userid",$c); mysql_query("DELETE FROM inventory WHERE inv_qty=0",$c); mysql_query("INSERT INTO inventory VALUES('',{$r['trRITEM']},{$r['trFROM']},'1');",$c); } mysql_query("UPDATE users SET trade=0, money=money+{$r['trCASH']}, crystals=crystals+{$r['trCRYS']}, money=money-{$r['trRCASH']}, crystals=crystals-{$r['trRCRYS']} WHERE userid=$userid"); mysql_query("UPDATE users SET trade=0, money=money+{$r['trRCASH']}, crystals=crystals+{$r['trRCRYS']}, money=money-{$r['trCASH']}, crystals=crystals-{$r['trCRYS']} WHERE userid={$r['trFROM']}"); mysql_query("DELETE FROM trades WHERE trUSER=$userid"); print " Trade request accepted! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } function decline_trade() { global $db,$ir,$c,$userid,$h; $_GET['ID'] = abs((int) $_GET['ID']); $q=$db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r=$db->fetch_row($q); if(!$_GET['ID']) { print " Invalid trade ID! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else if($r['trUSER'] != $userid) { print " You cannot decline this trade! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } else { $q=$db->query("SELECT * FROM trades WHERE trID={$_GET['ID']}"); $r=$db->fetch_row($q); event_add($r['trFROM'], "{$ir['username']} has declined your trade offer.", $c); mysql_query("DELETE FROM trades WHERE trID={$_GET['ID']}"); mysql_query("UPDATE users SET trade=0 WHERE userid={$ir['trade']}"); mysql_query("UPDATE users SET trade=0 WHERE userid=$userid"); print " Trade declined! <hr width=75%>> [url='explore.php']Back[/url]<hr width=75%>"; } } $h->endpage(); ?> Enjoy :)
  14. This Mod was Created by Illusions and HAUNTED DAWG in 2009. I have since updated it and made it look nicer and made sure it works with the latest version of mccodes. Place this into your phomyadmin INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES ('18', 'editpage', 'explore.php'); Add these links to smenu.php <a href='fileeditor.php?action=startfile'>Create PHP Page</a> <a href='fileeditor.php?action=edit'>Edit PHP Page</a> Create php file and name it fileeditor.php and dump this into it. <style type="text/css" media="screen"> .button { background-color: #4CAF50; border-radius: 10px; border: none; color: white; padding: 8px 25px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 2px 1px; cursor: pointer; } input[type='text'] { width: 221px; color : #423232; height:25px; border:1; padding:4px 8px; margin-bottom:0px; border-radius: 10px; } textarea[name='filetext'] { width: 500px; color : #423232; height: 250px; border:1; padding:4px 8px; margin-bottom:0px; border-radius: 10px; } body { background-color: #cdcdcd; } </style> <?php // CREATED FOR MCCODES V2 BY ILLUSIONS AND HAUNTED DAWG 2009 // // AS I USUALLY DONT CARE ABOUT NOTICES STAYING INTACT I WOULD LIKE THIS ONE TO STAY IS ITS A JOINT EFFORT THANKS ALL // // Updated by PeterisGB 2020 // require "sglobals.php"; switch($_GET['action']) { case "startfile": startfile(); break; case "startprocess": startprocess(); break; case 'edit': editpage(); break; default: echo 'Error: This script requires an action.'; break; } function startfile() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { echo 'ACCESS DENIED'; $h->endpage(); exit; } echo '<br /><br /><h2>Create File</h2> Always make a backup of any copy before using this system.<br /> <hr /> The file name and Data you create on here will also be Created on your FTP.<br /> You can use any file Format for EXAMPLE test.php, test.html, test.css.<br /> You can overwrite a file simply by giving it the same file name.[i] <hr/ > <form action="fileeditor.php?action=startprocess" method="_POST"> Create File Name: <input type="text" name="name" placeholder="example: explore.php"> <hr>Copy and Paste Data Below or Create New Data<hr> <textarea name="filetext" placeholder="Place PHP script HERE"></textarea><br /> <input type="submit" value="Create New File" class="button"></form> <hr> '; } { $h->endpage(); exit; } // We use isset so we dont get the undefined index blah blah errors // We check if they have hit the submit button function startprocess() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] != 2) { die('ACCESS DENIED'); $h->endpage(); exit; } $name = $_POST['name']; if( isset($_POST['name']) ) { //We open the name as w since w stands as wright. <a href="http://www.php.net/fopen" target="_blank">http://www.php.net/fopen</a> is a good tutorial chmod($name, 0755); $fo = fopen($filetext."$name", "w"); fwrite($fo, $pick); //Since we stripped the </textarea> to <+textarea+> we need to convert back to </textarea> //Since this is editing a name, we can not really put in any security only that ID 1 can edit it // GET FILE VIEW FOR FTP TRANSFER $conv = stripslashes(($_POST['filetext'])); if(fwrite($fo, $conv)) { echo '<h2>If you see an error message above regards CHMOD just ignore it.<br /> It just means that the file never exsisted in the first place once its on your FTP the error message will not be displayed.</h2> <font color="green"> <h1>File Name</h1></font> <font color="red"><h1>'.$name.'</font></h1> <font color="green"><h1> Created and Saved to FTP</h1></font> <font color="green"><h1> File is now Available for Use in Game</h1></font>'; } else { echo '<font color="red"><h1>File '.$name.' Could not be Written Please Try Again</h1></font>'; } fclose($fo); } else { //Bellow we fetch name contents using name_get_contents. <a href='www.php.net/name_get_contents'>http://www.php.net/name_get_contents</a> is a good tutorial $tup = file_get_contents($name); //Since if the name has </textarea> in it, it will screw up this code. Convert it out to <+textarea+> $tup = stripslashes(($_POST['filetext'])); //Bellow you should understand what it does. echo '<form action="'.$_SERVER['PHP_SELF'].'?action=startfile" method="post"> <iframe width=100% height=500 frameborder=0 scrolling="yes" src="'.$name.'"></iframe> <input type="submit" value="Create Another File"> </form>'; } } function editpage() { global $db,$ir,$c,$h,$userid,$set; if($ir['user_level'] != 2) { die("403"); $h->endpage(); exit; } if($_POST['submit']) { unset($_POST['submit']); foreach($_POST as $k => $v) { $db->query("UPDATE `settings` SET conf_value='$v' WHERE conf_name='$k'"); } echo '<br /><br /><br /><br />Page Loaded.<br /><br /> <a href="filedata.php"><h2>Continue</h2></a>'; stafflog_add("Editing Page {$_POST['editpage']}"); } else { $page = $set['editpage']; echo " <h3>Edit Page</h3><hr /> <form action='filedata.php?action=edit' method='POST'> <input type='hidden' name='submit' value='1'> Edit Page Url: <input type='text' name='editpage' value='$page'><br /> E.g = explore.php<br /> <input type='submit' value='Edit' class='button'></form>"; } } ?> and create a php file called filedata.php and dump this. <style type="text/css" media="screen"> .button { background-color: #4CAF50; border-radius: 10px; border: none; color: white; padding: 8px 25px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 2px 1px; cursor: pointer; } input[type='text'] { width: 221px; color : #423232; height:25px; border:1; padding:4px 8px; margin-bottom:0px; border-radius: 10px; } textarea[name='filetext'] { width: 500px; color : #423232; height: 250px; border:1; padding:4px 8px; margin-bottom:0px; border-radius: 10px; } body { background-color: #cdcdcd; } </style> <?php // CREATED FOR MCCODES V2 BY ILLUSIONS AND HAUNTED DAWG 2009 // // AS I USUALLY DONT CARE ABOUT NOTICES STAYING INTACT I WOULD LIKE THIS ONE TO STAY IS ITS A JOINT EFFORT THANKS ALL // // Updated by PeterisGB 2020 // require "sglobals.php"; global $db,$ir,$r,$set; if($ir['user_level'] != 2) { die('ACCESS DENIED'); $h->endpage(); exit; } $file = ''.$set['editpage'].''; //changing this name will also change the REAL VIEW MODE to the correct file // THE CONTENTS OF $file CAN BE OF ANY METHOD EXAMPLE HTML, CSS, PHP, ASX /////////////////////////////////////////////////////////////////////////////////////////////////////// // REMEMBER YOU CAN ALSO AMEND THIS FILE TO ALTER THE NAME OF THE $FILE NAME YOUR EDITING /// ////////////////////////////////////////////////////////////////////////////////////////////////////// //We use isset so we dont get the undefined index blah blah errors //We check if they have hit the submit button if( isset($_POST['file']) ) { //We open the file as w since w stands as write. <a href='www.php.net/fopen'>http://www.php.net/fopen</a> is a good tutorial chmod($file, 0755); $fo = fopen($file, 'w'); //Since we stripped the <+textarea+> to <+textarea+> we need to convert back to <+textarea+> //Since this is editing a file, we can not really put in any security only that ID 1 can edit it // I USED STRIPSLASHES INSTEAD OF PREG_REPLACE COS IT ****ED THINGS UP $conv = stripslashes($_POST['file']); if(fwrite($fo, $conv)) { echo '<font color="green"><h1>File Ammended And Saved</h1></font> <h1>New file view Below Check for errors if any</h1> <table width="100%" border="10" cellpadding="4" cellspacing="0"><td> <textarea name="file" cols="150" rows="15">'.$conv.'<+textarea+></td></table> <body bgcolor="#000000"> <a href="fileeditor.php?action=startfile" class="button">[>>> Create New File <<<]</a> <a href="filedata.php" class"button">[>>> RETURN TO EDIT '.$file.' <<<]</a> <hr><h1>REAL VIEW OF AMMENDED FILE BELOW</h1> <iframe width=100% height=500 frameborder=0 scrolling="yes" src="'.$file.'"></iframe> </body> </html>'; } else { echo '<font color="red">Could not save file.</font>'; } fclose($fo); } else { //Below we fetch file contents using name_get_contents. <a href='www.php.net/name_get_contents'>http://www.php.net/name_get_contents</a> is a good tutorial //FOOTNOTE i changed name_get to file_get as the textarea wasnt working right and kept adding back slashes to the script. //so i suppose php.net dont know everything he he he he $tup = file_get_contents($file); //Since if the file has <+textarea+> in it, it will screw up this code. Convert it out to <+textarea+> $tup = preg_replace('~<+textarea+>~is','<textarea>',$tup); //Bellow you should understand what it does. echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post"> <h1>Editing File '.$file.'</h1> <table width="100%" border="10" cellpadding="4" cellspacing="0"><td> <textarea name="file" cols="150" rows="15">'.$tup.'</textarea></td></table> <input type="submit" value="Save And Ammend File" class="button"><br /> <a href="filededitor.php?action=startfile" class="button">[>>> GOTO FILE CREATOR <<<]</a><br /> <a href="filedata.php" class="button">[>>> REFRESH CURRENT PAGE DATA <<<]</a><br /> <hr><h1>UNEDITED FILE BELOW REAL VIEW</h1> <iframe width=100% height=500 frameborder=0 scrolling="yes" src="'.$file.'"></iframe> <input type="submit" value="Save And Ammend File" class="button"> </form>'; } $h->endpage(); ?> Screenshots below.
  15. WIN! - 150$ Pusher credit: http://makewebgames.io/showthre...l=1#post311226 The FREE real-time chat module for your game is finally here! See the original thread. Read the docs: http://harrydenley.com/integrate-pusher-with-mccodes/ Official wiki: http://magictallguy.tk/wiki/pmwiki.p...n.MWGSnikoChat Code Drop In See post attachments Donate to the project Special thanks to the sponsors and @Phantomist for the graphics. See him for custom emote packs! Code released under the DBAD license.     Add-ons Staff panel by Magictallguy: http://makewebgames.io/showthre...l=1#post311092 Alternative chat solutions BlueImp integration by Magictallguy & Zettieee - http://makewebgames.io/showthre...l=1#post311180 chat.zip
  16. Myself and a few other members (of a different forum) debated whether I should post this. In the end, I decided to post it as a paid mod. This function allows staff to create, edit and delete CSS files from the staff panel. It also allows users to pick and choose from the CSS files that were created. Screenshots Asking price: $10 Support: Free Installation: Free, your choice whether you want me to install or not. 1 PHP file 1 addition to the Preferences 1 SQL table, 1 users table addition 1 edit to your game's header
  17. Last updated: 30/06/20 Note: This is untested and was (re)written on no sleep. Please post any bugs below and I will repair. I'm sure this has been made before, and may have even been posted (unsure as to where) but I thought I'd post my version For this, you will need to overwrite your newspaper.php, edit staff_special.php, and run an SQL command. SQL Command Use the same naming scheme to add more pages: page#_content (where # is a unique page number) ALTER TABLE papercontent CHANGE content page1_content LONGTEXT NULL, ADD page2_content LONGTEXT NULL, ADD page3_content LONGTEXT NULL; INSERT INTO settings (conf_name, conf_value) VALUES ("newspaper_page_count", 3); newspaper.php <?php /* MC Codes v2 newspaper.php Multi-page newspaper with administrative extension Original code under MCC license Edits under DBAD: https://dbad-license.org/ ~ Magictallguy */ require_once __DIR__ . '/globals.php'; $_GET['page'] = array_key_exists('page', $_GET) && is_numeric($_GET['page']) ? (int)$_GET['page'] : 1; /** * @param database $db - the database wrapper object * @param int $page - the active page number * * @returns string|null - the relevant content, or null */ function getPage($db, $set, $page) { if ($page > $set['newspaper_page_count']) { return null; } $col = 'page'.$page.'_content'; $result = $db->query('SELECT ' . $col . ' FROM papercontent LIMIT 1'); if (!$db->num_rows($result)) { return null; } $content = $db->fetch_single($result); if (!$content) { return null; } return stripslashes(htmlspecialchars($content)); } ?> <h3 id="newspaper-title">The Newspaper - Page <?php echo $_GET['page']; ?></h3> <table class="table" style="width:75%;border-spacing:1px;" aria-describedby="newspaper-title"> <tr> <td><a href="job.php">Your Job</a></td> <td><a href="gym.php">Local Gym</a></td> <td><a href="halloffame.php">Hall of Fame</a></td> </tr> <tr> <th scope="col"><a href="newspaper.php?page=1">Page 1</a></th> <th scope="col"><a href="newspaper.php?page=2">Page 2</a></th> <th scope="col"><a href="newspaper.php?page=3">Page 3</a></th> </tr> <tr> <td colspan="3"><?php echo getPage($db, $set, $_GET['page']); ?></td> </tr> </table> <?php $h->endpage(); Administrative update Open: staff_special.php Find this function newspaper_form() { global $db,$ir,$c,$h,$userid; $q=$db->query("SELECT * FROM papercontent LIMIT 1"); $news=$db->fetch_single($q); print "<h3>Editing Newspaper</h3><form action='staff_special.php?action=subnews' method='post'> <textarea rows='7' cols='35' name='newspaper'>$news</textarea> <input type='submit' value='Change' /></form>"; } function newspaper_submit() { global $db,$ir,$c,$h,$userid; $news=$_POST['newspaper']; $db->query("UPDATE papercontent SET content='$news'"); print "Newspaper updated!"; stafflog_add("Updated game newspaper"); } And replace with /** * @return array|null */ function getPages() { global $db; $cols = []; $getCols = $db->query('SHOW COLUMNS FROM papercontent'); while ($row = $db->fetch_row($getCols)) { $cols[] = $row['Field']; } $data = []; $result = $db->query('SELECT * FROM papercontent'); $row = $db->fetch_row($result); $i = 0; foreach ($row as $key => $value) { ++$i; $smolKey = str_replace('_content', '', $key); $data[$smolKey] = $value; } return !empty($data) ? $data : null; } function newspaper_form() { global $db, $set; $pages = getPages(); if (array_key_exists('submit', $_POST)) { $query = ''; $updated = []; for ($i = 1; $i <= $set['newspaper_page_count']; ++$i) { $page = 'page_' . $i; $_POST[$page] = array_key_exists($page, $_POST) && is_string($_POST[$page]) ? $_POST[$page] : ''; if ($_POST[$page] !== $pages[$page]) { $query .= ', ' . $page . '_content = \'' . $db->escape($_POST[$page]) . '\''; $updated[] = $i; } } if ($query !== '') { $count = count($updated); $query = substr($query, 2); $db->query('UPDATE papercontent SET ' . $query); stafflog_add('Updated game newspaper; ' . ($count === 1 ? 'page ' . $updated[0] : 'pages ' . implode(', ', $updated))); $pages = getPages(); } } ?> <h3 id="newspaper-title-edit">Editing Newspaper</h3> <form action="staff_special.php?action=editnews" method="post"> <?php for ($i = 1; $i <= $set['newspaper_page_count']; ++$i) { $content = stripslashes($pages['page' . $i]); $key = 'page' . $i; ?> <div> <label for="<?php echo $key; ?>">Page <?php echo $i; ?></label> <textarea name="<?php echo $key; ?>" id="<?php echo $key; ?>" rows="5" style="width:100%;"><?php echo $content; ?></textarea> </div> <?php } ?> <button type="submit" name="submit"> Update </button> </form> <?php }
  18. I have decided to release this module for free can leaders can purchase a city and set a tax value 0-15% of there crime earnings Gang leader will see who is owe them money from a log in the gang options and be able to claim it aswell once that's done it adds it to the gangs vault SQL ALTER TABLE `cities` ADD `gowner` int(11) NOT NULL DEFAULT '0', ADD `gtax` int(2) NOT NULL DEFAULT '0'; INSERT INTO `settings` (`conf_id`, `conf_name`, `conf_value`) VALUES (NULL, 'citycost', '1000000');   Open explore.php and find   if ($ir['jail'] > 0 || $ir['hospital'] > 0) { die("This page cannot be accessed while in jail or hospital."); }   below this line add   $gowner = $db->query("SELECT `gowner`,`gtax` FROM `cities` WHERE `cityid` = {$ir['location']} AND `gowner` = 0"); if($db->num_rows($gowner)) { if($ir['gang'] > 0) $gl = $db->query("SELECT `gangID`,`gangPRESIDENT`,`gangRESPECT` FROM `gangs` WHERE `gangPRESIDENT` = {$ir['userid']}"); if($db->num_rows($gl)) { $gang = $db->fetch_row($gl); $cost = (($set['citycost'] / 1.5) + (($set['citycost'] / 4.8) * $gang['gangRESPECT']) * 0.20); echo " <span style='color:red;font-weight:bold;'> This city has not been taken over.<br /><a href='explore.php?buy'>[buy City for <span style=color:green;'> ".money_formatter($cost)."</span>]</a> </span><br /><br />"; if(isset($_GET['buy'])) { if($ir['money'] < $cost) echo "You don't have enough money you need ".money_formatter($cost - $ir['money'])." more.<br /><br />"; else if($ir['userid'] != $gang['gangPRESIDENT']) echo "Sorry but only gang presidents can do this.<br /><br />"; else { $db->query("UPDATE `cities` SET `gowner` = {$gang['gangID']} WHERE `cityid` = {$ir['location']} AND `gowner` = 0"); $db->query("UPDATE `users` SET `money` = `money` - {$cost} WHERE `userid` = {$gang['gangPRESIDENT']}"); echo "You have purchased this city since there is no owner you can now set tax in the staff side of your gang.<br /><br />"; } } } } else { $gowner = $db->query("SELECT `gowner`,`gtax` FROM `cities` WHERE `cityid` = {$ir['location']}"); $gang = $db->fetch_row($gowner); $gangname = $db->fetch_single($db->query("SELECT `gangNAME` FROM `gangs` WHERE `gangID` = {$gang['gowner']}")); echo "{$gangname} Owns this city and has a tax value of {$gang['gtax']}% of your earnings..<br /><br />"; }   open up yourgang.php and find   function gang_staff() { global $db, $ir, $c, $userid, $gangdata, $h; if ($gangdata['gangPRESIDENT'] == $userid || $gangdata['gangVICEPRES'] == $userid) { if (!isset($_GET['act2'])) { $_GET['act2'] = 'idx'; } switch ($_GET['act2']) {   in the switch statements add 2 new cases   case "tax": gang_staff_settax(); break; case "payments": gang_staff_payments(); break;   now find function gang_staff_idx() and replace it with this function or edit in if you need to   function gang_staff_idx() { global $db, $ir, $c, $userid, $gangdata; echo " <b>General</b> <br /> <a href='yourgang.php?action=staff&act2=vault'>Vault Management</a> <br /> <a href='yourgang.php?action=staff&act2=apps'>Application Management</a> <br /> <a href='yourgang.php?action=staff&act2=vicepres'>Change Vice-President</a> <br /> <a href='yourgang.php?action=staff&act2=upgrade'>Upgrade Gang</a> <br /> <a href='yourgang.php?action=staff&act2=crimes'>Organised Crimes</a> <br /> <a href='yourgang.php?action=staff&act2=masspayment'>Mass Payment</a> <br /> <a href='yourgang.php?action=staff&act2=ament'>Change Gang Announcement</a> <br /> "; if($gangdata['gangPRESIDENT'] == $userid) { echo " <hr /> <a href='yourgang.php?action=staff&act2=pres'>Change President</a><br /> <a href='yourgang.php?action=staff&act2=declare'>Declare War</a><br /> <a href='yourgang.php?action=staff&act2=surrender'>Surrender</a><br /> <a href='yourgang.php?action=staff&act2=viewsurrenders'>View or Accept Surrenders</a><br /> <a href='yourgang.php?action=staff&act2=massmailer'>Mass Mail Gang</a><br /> <a href='yourgang.php?action=staff&act2=name'>Change Gang Name</a><br /> <a href='yourgang.php?action=staff&act2=desc'>Change Gang Desc.</a><br /> <a href='yourgang.php?action=staff&act2=tag'>Change Gang Tag</a><br />"; $check_city = $db->query("SELECT `gowner` FROM `cities` WHERE `gowner` = {$gangdata['gangID']} AND `cityid` = {$ir['location']}"); if($db->num_rows($check_city)) { echo " <a href='yourgang.php?action=staff&act2=tax'>Change City Tax</a><br /> <a href='yourgang.php?action=staff&act2=payments'>Check Tax Payment</a>"; } }   below that function add these two functions   function gang_staff_settax() { global $db,$ir,$gangdata,$h,$set; if($ir['userid'] != $gangdata['gangPRESIDENT']) { echo "You are not permitted to be here.."; $h->endpage(); exit; } $check_city = $db->query("SELECT `gtax` FROM `cities` WHERE `gowner` = {$gangdata['gangID']} AND `cityid` = {$ir['location']}"); if(!$db->num_rows($check_city)) { echo "You don't own this city.."; $h->endpage(); exit; } $tax = array( '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15' ); if(isset($_POST['set_tax'])) { $_POST['gID'] = isset($_POST['gID']) && ctype_digit($_POST['gID']) ? abs(intval($_POST['gID'])) : 0; $_POST['tax'] = isset($_POST['tax']) && ctype_digit($_POST['tax']) && in_array($_POST['tax'], $tax) ? $_POST['tax'] : ''; if(empty($_POST['gID']) || empty($_POST['tax'])) echo "You have missed a required field.."; else { $check = $db->query("SELECT `gtax` FROM `cities` WHERE `gowner` = {$_POST['gID']} AND `cityid` = {$ir['location']}"); if($db->fetch_single($check) == $_POST['tax']) echo "You'r tax is already set to this so nothing changed.."; else { $cityname = $db->fetch_single($db->query("SELECT `cityname` FROM `cities` WHERE `cityid` = {$ir['location']}")); $db->query("UPDATE `cities` SET `gtax` = '{$_POST['tax']}' WHERE `gowner` = {$_POST['gID']} AND `cityid` = {$ir['location']}"); echo "You have updated the tax to ".$_POST['tax']."% for {$cityname}"; } } } else { echo "<h3>City Tax Amount</h3> <form method='post'> <input type='hidden' name='gID' value='{$gangdata['gangID']}' /> <select name='tax' type='dropdown'>"; foreach($tax as $t) printf("<option value='%1\$s'>%1\$s</option>", $t); echo " </select>%<br /><br /> <input type='submit' name='set_tax' value='Set Tax' /> </form><hr width='75%'> <h3>Get Your Taxes</h3> <a href='yourgang.php?action=staff&act2=payments'>[Check Profit]</a>"; } } function gang_staff_payments() { global $db,$ir,$gangdata,$h,$set; if($ir['userid'] != $gangdata['gangPRESIDENT']) { echo "You are not permitted to be here.."; $h->endpage(); exit; } if(isset($_GET['collect'])) { $_GET['collect'] = isset($_GET['collect']) && ctype_digit($_GET['collect']) ? abs(intval($_GET['collect'])) : 0; if(empty($_GET['collect'])) { echo "You have missed a required field."; $h->endpage(); exit; } $select = $db->query("SELECT * FROM `citypayments` WHERE `id` = {$_GET['collect']}"); if(!$db->num_rows($select)) { echo "not real."; $h->endpage(); exit; } $s = $db->fetch_row($select); if($gangdata['gangPRESIDENT'] != $ir['userid']) { echo "You can't claim this money.."; $h->endpage(); exit; } if(!$ir['gang']) { echo "Are you lost?.."; $h->endpage(); exit; } $db->query("UPDATE `gangs` SET `gangMONEY` = `gangMONEY` + {$s['earnings']} WHERE `gangPRESIDENT` = {$ir['userid']}"); echo "You have collected ".money_formatter($s['earnings']); $db->query("DELETE FROM `citypayments` WHERE `cowner` = {$gangdata['gangPRESIDENT']}"); } else { echo "<h3>Your Profits</h3>"; $profits = $db->query("SELECT * FROM `citypayments` WHERE `cowner` = {$gangdata['gangID']}"); if(!$db->num_rows($profits)) echo "You have no Profits.."; else { echo " <table width='75%' class='table' style='text-align:center;'> <tr> <th>User</th> <th>City</th> <th>Earnings</th> <th>Gang</th> <th>Action</th> </tr>"; while($tax = $db->fetch_row($profits)) { $un = $db->fetch_single($db->query("SELECT `username` FROM `users` WHERE `userid` = {$tax['userid']}")); $cn = $db->fetch_single($db->query("SELECT `cityname` FROM `cities` WHERE `cityid` = {$tax['cityid']}")); if($tax['gang'] > 0) $gname = $db->fetch_single($db->query("SELECT `gangNAME` FROM `gangs` WHERE `gangID` = {$tax['gang']}")); else $gname = "No Gang"; echo " <tr> <td>{$un}</td> <td>{$cn}</td> <td>".money_formatter($tax['earnings'])."</td> <td>{$gname}</td> <td><a href='yourgang.php?action=staff&act2=payments&collect={$tax['id']}'>Collect Profits</td> </tr>"; } echo "</table>"; $total = $db->query("SELECT SUM(IF(`earnings` > 0, `earnings`,0)) AS `total` FROM `citypayments` WHERE `cowner` = {$gangdata['gangID']}"); $t = $db->fetch_row($total); echo "<br /><br />You have made ".money_formatter($t['total']); } } }   Replace docrime.php with this if its not been edited   <?php /** * MCCodes Version 2.0.5b * Copyright (C) 2005-2012 Dabomstew * All rights reserved. * * Redistribution of this code in any form is prohibited, except in * the specific cases set out in the MCCodes Customer License. * * This code license may be used to run one (1) game. * A game is defined as the set of users and other game database data, * so you are permitted to create alternative clients for your game. * * If you did not obtain this code from MCCodes.com, you are in all likelihood * using it illegally. Please contact MCCodes to discuss licensing options * in this case. * * File: docrime.php * Signature: 427d116f8a7253197c4364dd543771e6 * Date: Fri, 20 Apr 12 08:50:30 +0000 */ $_GET['c'] = isset($_GET['c']) && ctype_digit($_GET['c']) ? abs(intval($_GET['c'])) : 0; $macropage = "docrime.php?c={$_GET['c']}"; require_once('globals.php'); if($ir['jail'] > 0 || $ir['hospital'] > 0) die($h->endpage("This page cannot be accessed while in jail or hospital.")); if($_GET['c'] <= 0) echo "Invalid crime"; else { $q = $db->query("SELECT * FROM `crimes` WHERE `crimeID` = {$_GET['c']} LIMIT 1"); if($db->num_rows($q) == 0) { echo 'Invalid crime.'; $h->endpage(); exit; } $r = $db->fetch_row($q); $db->free_result($q); if($ir['brave'] < $r['crimeBRAVE']) echo "You do not have enough Brave to perform this crime."; else { $ec ="\$sucrate=". str_replace( array("LEVEL", "CRIMEXP", "EXP", "WILL", "IQ"), array($ir['level'], $ir['crimexp'],$ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']) . ";"; eval($ec); print $r['crimeITEXT']; $ir['brave'] -= $r['crimeBRAVE']; $db->query("UPDATE `users` SET `brave` = {$ir['brave']} WHERE `userid` = $userid"); if(rand(1, 100) <= $sucrate) { $taxes = $db->query("SELECT `gtax`,`gowner` FROM `cities` WHERE `cityid` = {$ir['location']} AND `gowner` > 0"); if($db->num_rows($taxes)) { $tax = $db->fetch_row($taxes); if($ir['gang'] != $tax['gowner']) { $citycheck = $db->query("SELECT * FROM `citypayments` WHERE `userid` = {$ir['userid']} AND `cowner` = {$tax['gowner']}"); if(!$db->num_rows($citycheck)) { $earn = $r['crimeSUCCESSMUNY'] / 100 * $tax['gtax']; print str_replace("{money}", $r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); echo "<br /><strong>You have been charged a {$tax['gtax']}% of your income from crime.<br /> If you have a item as a reward the tax will be taken from the item sell price.<br /> You made ".money_formatter($r['crimeSUCCESSMUNY'] - $earn); $ir['money'] += $r['crimeSUCCESSMUNY']; $ir['money'] -= $earn; $ir['crystals'] += $r['crimeSUCCESSCRYS']; $ir['exp'] += (int) ($r['crimeSUCCESSMUNY'] / 8); $db->query("INSERT INTO `citypayments` VALUES(NULL,{$ir['location']},{$ir['userid']},{$earn},{$ir['gang']},{$tax['gowner']})"); $db->query("UPDATE `users` SET `money` = {$ir['money']}, `crystals` = {$ir['crystals']}, `exp` = {$ir['exp']}, `crimexp` = `crimexp` + {$r['crimeXP']} WHERE `userid` = $userid", $c); if($r['crimeSUCCESSITEM']) { $itmcost = $db->query("SELECT `itmsellprice` FROM `items` WHERE `itmid` = {$r['crimeSUCCESSITEM']}"); $itm = $db->fetch_row($itmcost); $ip = $r['crimeSUCCESSITEM'] / 100 * $tax['gtax']; $db->query("INSERT INTO `citypayments` VALUES(NULL,{$ir['location']},{$ir['userid']},{$ip},{$ir['gang']},{$tax['gowner']})"); item_add($userid, $r['crimeSUCCESSITEM'], 1); } } else { $earn = $r['crimeSUCCESSMUNY'] / 100 * $tax['gtax']; print str_replace("{money}", $r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); echo "<br /><strong>You have been charged a {$tax['gtax']}% of your income from crime.<br /> If you have a item as a reward the tax will be taken from the item sell price.<br /> You made ".money_formatter($r['crimeSUCCESSMUNY'] - $earn); $ir['money'] += $r['crimeSUCCESSMUNY']; $ir['money'] -= $earn; $ir['crystals'] += $r['crimeSUCCESSCRYS']; $ir['exp'] += (int) ($r['crimeSUCCESSMUNY'] / 8); $db->query("UPDATE `citypayments` SET `earnings` = `earnings` + {$earn} WHERE `userid` = {$ir['userid']} AND `cowner` = {$tax['gowner']}"); $db->query("UPDATE `users` SET `money` = {$ir['money']}, `crystals` = {$ir['crystals']}, `exp` = {$ir['exp']}, `crimexp` = `crimexp` + {$r['crimeXP']} WHERE `userid` = $userid", $c); if($r['crimeSUCCESSITEM']) { $itmcost = $db->query("SELECT `itmsellprice` FROM `items` WHERE `itmid` = {$r['crimeSUCCESSITEM']}"); $itm = $db->fetch_row($itmcost); $ip = $r['crimeSUCCESSITEM'] / 100 * $tax['gtax']; $db->query("INSERT INTO `citypayments` VALUES(NULL,{$ir['location']},{$ir['userid']},{$ip},{$ir['gang']},{$tax['gowner']})"); item_add($userid, $r['crimeSUCCESSITEM'], 1); } } } else { $earn = $r['crimeSUCCESSMUNY'] / 100 * $tax['gtax']; print str_replace("{money}", $r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money'] += $r['crimeSUCCESSMUNY']; $ir['crystals'] += $r['crimeSUCCESSCRYS']; $ir['exp'] += (int) ($r['crimeSUCCESSMUNY'] / 8); $db->query("UPDATE `users` SET `money` = {$ir['money']}, `crystals` = {$ir['crystals']}, `exp` = {$ir['exp']}, `crimexp` = `crimexp` + {$r['crimeXP']} WHERE `userid` = $userid", $c); if($r['crimeSUCCESSITEM']) { $itmcost = $db->query("SELECT `itmsellprice` FROM `items` WHERE `itmid` = {$r['crimeSUCCESSITEM']}"); $itm = $db->fetch_row($itmcost); $ip = $itm['itmsellprice'] / 100 * $tax['gtax']; $db->query("UPDATE `citypayments` SET `earnings` = `earnings` + {$ip} WHERE `userid` = {$ir['userid']} AND `cityid` = {$ir['location']} AND `cowner` = {$tax['gowner']}"); item_add($userid, $r['crimeSUCCESSITEM'], 1); } } } } else { if (rand(1, 2) == 1) { print $r['crimeFTEXT']; } else { print $r['crimeJTEXT']; $db->query( "UPDATE `users` SET `jail` = '{$r['crimeJAILTIME']}', `jail_reason` = '{$r['crimeJREASON']}' WHERE `userid` = $userid"); } } echo "<br /><a href='docrime.php?c={$_GET['c']}'>Try Again</a><br /> <a href='criminal.php'>Crimes</a>"; } } $h->endpage();
  19. ags_cs4

    Set of Cards

    Version 1.0

    8 downloads

    this set of cards for use either blackjack or high/low ... the set contain 3 PSD (front, back, icons type), the set of cards, the fonts used ps: you can add a logo to all cards just scroll down inside the front_card.psd file and make the 2 text layers visible and edit them to your game name abrv (2 letters max), do the same in the back_card.psd file + you can add a sub text for black jack or high/low ... Need Help?: contact me here or in discord (PHPkiller#5602). Donations?: BTC: 1BxYTrbnunSBG5AmBMyobPkCByWLhAPck4 ETH: 0xD26EE454C3068132dB5ef2E27b86d0C6c138cEc9 DASH: XvUa3A52DywoLgYnTXHTw1goRWyw5T6sRn

    Free

  20. I've worked with @ColdBlooded and @Dabomstew to enable our community to still purchase and use MCCodes v2 by listing it as a product on MWG. The funds from sales of MCCodes will help keep MWG alive. We also reduced the price to $50.00. 50% cheaper than ever before, we also have a new support area on MWG to support with these purchases.
  21. today i wanted to change the stupid html mainmenu to somthing good and easy to edit any time so the idea i got was to use multidimensional arrays for fast edit and flexibility. want to learn more? read this topic screenshot: Lets get started in my code i wanted to get flexible links so i can show them when you are in jail or hospital or donators or no mater what condition is with small edits , so in my array i added 2 key one for hospital and one for jail, and the array looks like this array( "icon" => "fas fa-home", "link" => "index.php", "title" => "Home", "class" => "", "jail" => true, "hospital" => true, ), so as you can see we have 6 keys 4 of them are for the link html code and the last 2 are our conditions true mean that the link show, and false mean the link is hidden on that condition so lest keep going the idea was so i can show 3 sections 2 are always shown and 1 for only doantors only so i made an array like this: array( "title" => "Navigation", "donator" => false, "links" => array() ), array( "title" => "Donators Only", "donator" => true, "links" => array() ), array( "title" => "Other", "donator" => false, "links" => array() ) we can see we have 3 keys , one for the name of the section, one for our condition which is donator, the last is the array of our links that we worked on them before now lets go to the loop to show our sections foreach ($navigations as $navigation){ if ($ir['donatordays']<1 and $navigation['donator'] == true){ }else{ echo '<br><h3>'.$navigation['title'].'</h3><ul>'; foreach ($navigation['links'] as $link){ if ($ir['jail'] > time() and $link['jail'] == false){} elseif ($ir['hospital'] > time() and $link['hospital'] == false){} else{ echo '<li><a class="'.$link['class'].'" href="'.$link['link'].'"><i class="'.$link['icon'].'"></i>'.$link['title'].'</a></li>'; } } echo '</ul>'; } } so we stored our multidimensional array in a variable named $navigations and we lopped it using foreach we added a condition for 'donatordays' if its true it wont show that section. inside the first foreach we added another foreach to loop our list of links using our 'links' key $navigation['links'] from the first foreach. as you can see we have 2 condition 1 for jail which is big than the current timestamp(my game use timestamp not minutes crons) while the value from the array key "jail" = false, the same thing for hospital. while we have nothing printed inside that if/else of both condition of jail/hospital so that it wont show any link when the condition is true. a full code if you get lost in the way ? $navigations = array( array( "title" => "Navigation", "donator" => false, "links" => array( array( "icon" => "fas fa-home", "link" => "index.php", "title" => "Home", "class" => "", "jail" => true, "hospital" => true, ), array( "icon" => "fas fa-home", "link" => "index.php", "title" => "hidden when in jail", "class" => "", "jail" => false, "hospital" => true, ), array( "icon" => "fas fa-home", "link" => "index.php", "title" => "hidden when in hospital", "class" => "", "jail" => true, "hospital" => false, ), array( "icon" => "fas fa-home", "link" => "index.php", "title" => "hidden for both", "class" => "", "jail" => false, "hospital" => false, ), ) ), array( "title" => "Donators Only", "donator" => true, "links" => array( array( "icon" => "fas fa-user-friends", "link" => "index.php", "title" => "Friends List", "class" => "", "jail" => true, "hospital" => true, ), ) ), array( "title" => "Other", "donator" => false, "links" => array( array( "icon" => "fas fa-power-off", "link" => "logout.php", "title" => "Logout", "class" => "logout", "jail" => true, "hospital" => true, ), ) ) ); foreach ($navigations as $navigation){ if ($ir['donatordays']<1 and $navigation['donator'] == true){ }else{ echo '<br><h3>'.$navigation['title'].'</h3><ul>'; foreach ($navigation['links'] as $link){ if ($ir['jail'] > time() and $link['jail'] == false){} elseif ($ir['hospital'] > time() and $link['hospital'] == false){} else{ echo '<li><a class="'.$link['class'].'" href="'.$link['link'].'"><i class="'.$link['icon'].'"></i>'.$link['title'].'</a></li>'; } } echo '</ul>'; } } in the end this way will make it east to add condition to each link or section with out having to make the html code more confusing by adding more if/else statments PS: this my first time writing an article in english so bear with me
  22. Whaddup Doe MWG peoples So I had a account before and I lost all my login info and I made a new account. I am looking to buy the McCodes V2 script but I know 1 issue I will have is the Crons if I buy the McCodes V2 script does anyone know if I can be helped with setting up crons ? I used to fool around years ago with the free version of McCodes V1 but it seems to me as the crons are now a different way through using my hosting. So is there someone willing to help setup crons or can walk me through
  23. Having limited time now, and not being able to support or upgrade the following modules any further, I've decided to re-release them as free.   Crafting system was $25.00 Download Farming system was $15.00 Download IP was $5.00 Download Timestamp crons was $5.00 Download Adv. property system was $25.00 Download Username images was $15.00 Download   These systems come as-is, and no support will be given - unless you're really stuck or they don't work. The architecture is pretty non-existent, so please don't judge my current abilities on these ancient systems. Have fun.
  24. Yes, you may say 'ugh just another one', but the fact is I was looking here and couldn't find a decent free one, well I only found part of it. This is simple, users can post on each others profiles, and the account owner can delete the comment if deemed necessary. If anyone wants anything added to it just let me know, I'm more than happy to add anything to it... SQL: CREATE TABLE IF NOT EXISTS `gComments` ( `ID` int(11) NOT NULL auto_increment, `SenderID` int(11) NOT NULL, `RecieverID` int(11) NOT NULL, `Comment` text NOT NULL, PRIMARY KEY (`ID`), KEY `ID` (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; Comments.php <?php //Made by Zed -- Do NOT re-distribute as your own! //ONLY TO BE POSTED ON MAKEWEBGAMES.COM include(DIRNAME(__FILE__).'/globals.php'); if((!$_GET['ID']) || (!ctype_digit($_GET['ID']))) { echo ('You\'ve clicked an invalid link, please report to an administrator.'); exit($h->endpage()); } if(isset($_GET['Delete'])) { $Data = mysql_query("SELECT `RecieverID` FROM `gComments` WHERE (`ID` = ".abs(intval($_GET['ID'])).") AND (`RecieverID` = ".$_SESSION['userid'].")",$c); if($ir['user_level'] == 2 || mysql_num_rows($Data)) { mysql_query("DELETE FROM `gComments` WHERE (`ID` = ".abs(intval($_GET['ID'])).")"); echo ('The comment chose has been deleted. <a href = "/viewuser.php?u='.$_GET['ID'].'"><span style = "color:#8B0000">Go Back</span></a> '); exit($h->endpage()); }else{ echo ('This comment doesn\'t belong to you.'); exit($h->endpage()); } } if((isset($_POST['comment']))) { if(empty($_POST['comment'])) { echo ('You\'ve failed to fill the form in correctly.'); exit($h->endpage()); } mysql_query("INSERT INTO `gComments` VALUES ('', ".$_SESSION['userid'].", ".abs(intval($_GET['ID'])).", '".mysql_real_escape_string(strip_tags($_POST['comment']))."')",$c); event_add(abs(intval($_GET['ID'])), ''.mysql_real_escape_string($ir['username']).' has just left a comment on your profile!'); echo ('Your comment has successfully been posted. <a href = "/viewuser.php?u='.$_GET['ID'].'"><span style = "color:#8B0000">Go Back</span></a>'); }else{ echo ('<span style = "font-size:2em; font-family:Arial,Helvetica,sans-serif; text-align:center; color:#8B0000">Posting Comment</span> <hr width = "90%"> <form action = "Comments.php?ID='.$_GET['ID'].'" method = "post"> <input type = "text" name = "comment" value = "" /> <input type = "submit" value = "Post Comment" /> </form> <a href = "/viewuser.php?u='.$_GET['ID'].'"><span style = "color:#8B0000">Go Back</span></a> '); } ?> Open viewuser.php Find: print "</tr></table>"; -- Near end of file. Replace with: echo ('<tr> <td align = "center" colspan = "3"><a href = "/Comments.php?ID='.$_GET['u'].'"><span style = "color:#8B0000">Add Comment</span></a></td> </tr> </table>'); Then add underneath: echo (' <table width = "100%" cellspacing = "1" class = "table"> <tr> <th colspan = "3">User Comments</th> </tr>'); $Data = mysql_query("SELECT g.`ID`,g.`SenderID`,g.`RecieverID`,g.`Comment`,u.`userid`,u.`username` FROM `gComments` g LEFT JOIN `users` u "."ON g.`SenderID` = u.`userid` WHERE (`RecieverID` = ".abs(intval($_GET['u'])).") LIMIT 20"); if(!mysql_num_rows($Data)) { echo ('<tr> <td colspan = "1">This user has no comments.</td> </tr> </table>'); exit($h->endpage()); }else{ while($cData = mysql_fetch_array($Data)) { echo (' <tr> <td width = "15%">'.htmlentities($cData['username']).'</td> <td>'.stripslashes(htmlentities($cData['Comment'], ENT_QUOTES)).'</td>'); if(($_SESSION['userid'] === $cData['RecieverID'])) || ($ir['user_level'] == 2)) { echo (' <td width = "10%" align = "center"><a href = "/Comments.php?Delete&ID='.$cData['ID'].'"><span style = "color:#8B0000">Delete</span></a></td>'); } } echo ('</tr></table>'); It's not had alot of testing, but should all work well, it's just something simple so I can keep the boredom away. ^^
  25. Hello, I'm new to mccodes. I tried to clear existing player reports but keep getting this error message: Error: This script requires an action. This is the code function report_clear() { global $db, $ir, $c, $h, $userid; if (!in_array($ir['user_level'], array(2, 3))) { echo 'You cannot access this area.<br /> &gt; <a href="staff.php">Go Back</a>'; die($h->endpage()); } staff_csrf_stdverify('staff_clear_preport', 'staff_users.php?action=reportsview'); $_POST['ID'] = (isset($_POST['ID']) && is_numeric($_POST['ID'])) ? abs(intval($_POST['ID'])) : 0; if (empty($_POST['ID'])) { echo ' Invalid ID, please go back and try again. <br /> &gt; <a href="staff_users.php?action=reportsview">Go Back</a> '; die($h->endpage()); } $d = $db->query( 'SELECT COUNT(`prID`) FROM `preports` WHERE `prID` = ' . $_POST['ID']); if ($db->fetch_single($d) == 0) { $db->free_result($d); echo ' Report doesn\'t seem to exist, Please go back and try again. <br /> &gt; <a href="staff_users.php?action=reportsview">Go Back</a> '; die($h->endpage()); } $db->free_result($d); $db->query( 'DELETE FROM `preports` WHERE `prID` = ' . $_POST['ID']); stafflog_add('Cleared player report ID ' . $_POST['ID']); echo ' Report deleted. <br /> &gt; <a href="staff_users.php?action=reportsview">Go Back</a> '; die($h->endpage());[/PHP] Im using localhost thanks
×
×
  • Create New...