Jump to content
MakeWebGames

Script47

Members
  • Posts

    1,150
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Script47

  1. Either ditch it, or if it's needed code it. If it's in an external file then include it in to this file.
  2. Script47

    Securing $_POST

    I know that?   I've been told to use htmlentities then when removing the data from database use html_entity_decode(), just saying.   Ah sorry mate, as I said I ain't no pro, just trying to help out. One question, if I have ctype_digit() then I don't need the other stuff I added?
  3. Script47

    Securing $_POST

    Ah right, then that's why just in case you put the second alternative, but right I did not know that, will keep in mind. Thanks :)
  4. Script47

    Securing $_POST

    Use the HTML number form for numbers: <input type='number' name=''>   Validate form check if numbers are only inserted:   if (!ctype_digit($_POST['number'])) { // Some error code } else { $number = $_POST['number']+0; // Credit to berty for telling me this. :) }   $someTextVar = $db->escape(htmlentities($_POST['someTextVarForm'])); // escaping data, and htmlentities to change what HTML output would be - http://www.w3schools.com/php/func_string_htmlentities.asp   $someTextVar = mysqli_real_escape_string($link, (htmlentities($_POST['someTextVarForm']))); // MySQLi version of the above Check to see if var isset/empty, I don't think this is security (please tell me if I'm wrong):   if (!isset($_POST['someVar1']) || !isset($_POST['someVar2']) || (empty($_POST['someVar1']) || empty($_POST['someVar2']))) { echo '<br/>One or more of the required fields are empty please go back and try again.'; $h->endpage(); exit(); }   This is merely some of the stuff possible, by no means am I a pro, just thought I would write some stuff I do. Hope it helps and good luck with your mod mate. :)
  5. Happy hunting, hope you find them all. :)
  6. Thanks, and okay will remember for next time mate. :)
  7. So this is a small mod I have made which randomly chooses a user from the user list and gives then X amount of money and crystals. Money: $100-$2500 Crystals: 1-50 SQL's: CREATE TABLE IF NOT EXISTS `playerspotlight` ( `wID` int(11) NOT NULL AUTO_INCREMENT, `days` int(11) NOT NULL DEFAULT '7', `cPlayerName` varchar(100) NOT NULL, `cPlayerID` varchar(100) NOT NULL, PRIMARY KEY (`wID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 Crons Daily: $db->query("UPDATE `playerspotlight` SET days=days-1 WHERE days > 0"); playerSpotlight.php: <html> <head> <title>Player Spotlight</title> </head> <style> .win { color:green; font-weight:bold; } </style> </html> <?php include 'globals.php'; /* * Designed and developed by Script47 * The code here (named "playerSpotlight" or "pS") is provided "as is" with no warranty or gurantee of safety to existing code. * pS has been fully tested and is found to work as intended. * pS is released freely under the GNU License. Feel free to modify as you wish, as long as this comment block remains untouched. * This module is free, if you have purchased it from anyone, demand a full refund. */ global $db; echo '<br/>'; echo '<h3>Player Spotlight</h3>'; $selectSpotLight = $db->query("SELECT * FROM `playerspotlight`"); while ($getRow = $db->fetch_row($selectSpotLight)) { $days = $getRow['days']; $cID = $getRow['cPlayerID']; $cUsername = $getRow['cPlayerName']; } $selectUsers = $db->query("SELECT * FROM `users` ORDER BY RAND() LIMIT 1"); while ($getRow2 = $db->fetch_row($selectUsers)) { $username = $getRow2['username']; $userID = $getRow2['userid']; } $zero = 0; if ($days == $zero) { $db->query("INSERT INTO `playerspotlight` (cPlayerName, cPlayerID) VALUES ('$username', $userID)"); $money = rand(100, 2500); $crystals = rand(1, 50); $db->query("UPDATE `users` SET money=money+$money, crystals=crystals+$crystals WHERE userid=$userID "); event_add($userID, "You were chosen for the player spotlight and recieved $" .$money. " and " .$crystals. " crystals."); } if (isset($cID) && isset($cUsername)) { echo "<strong><p class='win'>This Weeks Player: </strong>[$cID] $cUsername</a></p>"; } else { echo "<strong><p class='win'>This Weeks Player: </strong>None</a></p>"; } ?> If you want the player to show up on index page like this: [ATTACH=CONFIG]1081[/ATTACH] Open Index.php, right at the top add <html> <style> .win { color:green; font-weight:bold; } </style> </html> Then find include "globals.php" Underneath that add, $selectSpotLight = $db->query("SELECT * FROM `playerspotlight`"); while ($getRow = $db->fetch_row($selectSpotLight)) { $days = $getRow['days']; $cID = $getRow['cPlayerID']; $cUsername = $getRow['cPlayerName']; } if (isset($cID) && isset($cUsername)) { echo "<strong><p class='win'>This Weeks Player: </strong>[$cID] $cUsername</a></p>"; } else { echo "<strong><p class='win'>This Weeks Player: </strong>None</a></p>"; } Same thing can be done with explore.php, find if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital.") Underneath that add the above PHP code and don't forget to add the HTML code at the top.
  8. Please could you warp your code around tags, so it's easier to read. Other than that, well done mate. :)
  9. If it was for V2 I would have given it shot, as I have never tried V1 I would probably mess it up even more. :P
  10. So, say out of 100 active members eight are nominated, are them eight randomly nominated then the voting starts or should there be a stage where the nominees are picked?
  11. So I'm thinking about making a small mod/addon which selects a random player every week/month, and the chosen player is awarded with X amount of cash/crystals. Tell me what you guys think about this idea, also if you would like a mod please ask and I will see what I can do.
  12. Nice, I need to learn to do this for future references, as it would be very handy.
  13. Script47

    Mafia Creed

    Same here, looks decent.
  14. Credit where credit is due, BEAST song mate!
  15. It looks top quality mate. On a side note so did the demo login thing, that was smart nifty little idea. Good job! :)
  16. They're all too similar, using concepts which have already been used in working games. Like !Angel said, they need something different about them, something which hasn't been seen yet.
  17. Just a suggestion, maybe an array which has all the item id's then just add them to the query or something.
  18. Thanks for this, I'm sure it will be very helpful mate. :)
  19. I use <b> mainly because I learn't that first, but if people want me to use <strong> I haven't got a problem with that. :)
  20. Oh, I thought I may need it so I added it. Thanks for telling me.
  21. So I was just looking through some stuff and found this site, which cleans up your URL's and gives you mod_rewrite codes. Hope it helps you all. :) http://www.generateit.net/mod-rewrite/
  22. Sorted, sorry about that.
  23. Quick new addition to all your hospitals in your games, this allows players to pay $10000 to be released immediately from hospital. Empty echo tags, contains <br/> Open "hospital.php" Underneath include "globals.php"; add global $ir; Then find this print "<h3>Hospital</h3> <table width='75%' class=\"table\" border=\"0\" cellspacing=\"1\"><tr bgcolor=gray><th>Name</th> <th>Level</th> <th>Time</th><th>Reason</th></tr>"; and add under that if ($ir['hospital']) { echo '<a href="hospitalPayOut.php">Pay $10000 to leave hospital</a>'; } Then add a complete new page called hospitalPayOut.php and add the following code to it. <html> <head> <title>Hospital Pay Out</title> <style> .win { color:green; font-weight:bold; } .lose { color:red; font-weight:bold; } </style> </head> </html> <?php include 'globals.php'; global $db, $ir, $h; $payOut = 10000; $zeroHospital = 0; if ($ir['money'] < $payOut) { echo '<br/>'; echo "<p class='lose'>You don't have enough money to use this feature.</p>"; $h->endpage(); exit(); } if ($ir['hospital'] == $zeroHospital) { echo '<br/>'; echo "<p class='lose'>You are not in hospital!</p>"; $h->endpage(); exit(); } $db->query("UPDATE `users` SET money=money-$payOut, hospital=0, hospreason='' WHERE userid={$_SESSION['userid']}"); if ($db) { echo '<br/>'; echo '<p class="win">You pay $10000, to leave hospital.'; } ?>
  24. Take a look at some existing mods, some basic ones, like I made a pretty simple one yesterday upon request, then if you get stuck, feel free to pop me a PM or something, will be willing to help. Oh and a little hint, if you are going to be making or trying to create a full game engine, then you will need to know PHP quite well and not be just new to it. http://pastebin.com/a7Na1Nwt
  25. Added link, code is now through Pastebin as well. :)
×
×
  • Create New...