Jump to content
MakeWebGames

Magictallguy

Administrators
  • Posts

    2,142
  • Joined

  • Last visited

  • Days Won

    148

Everything posted by Magictallguy

  1. SELECT `itmid`, `itmname` FROM `items` WHERE `itmtype` IN(1, 2, 3) Alter the IN clause to whitelist the item type IDs you want to use there
  2. Why aren't you going via itemtype? Isn't that generally what it's for; easier differentiation?
  3. $fp = @fopen($url, 'rb', false, $ctx) or exit('Couldn\'t load URL'); ?
  4. I suppose you could do this: $fp = @fopen($url, 'rb', false, $ctx);
  5. Set DEBUG to false in the error handler
  6. Exactly what Hax-guy said; that URL isn't an image Edit: Just tested with a direct URL given by PhotoBucket itself (http://i871.photobucket.com/albums/ab277/ANNNNNNNNA_bucket/Animated%20Gif/Psychedelic%20Animated%20Gifs/AnimatedAura.gif), seems to work fine for me
  7. Suggestion: Make MySQL do the majority of the work here.. $odata_sql = 'SELECT `userid`, `hp`, `infirmary`, `jail` `username`, `gang`, `location`, `maxhp`, `gender` `guard`, `agility`, `strength` FROM `users` NATURAL JOIN `userstats` WHERE `userid` = '.$_GET['ID']; $q = $db->query($odata_sql); //[...]
  8. Also, MC Craps can feck off - ain't our fault they created a script so buggy that an entire community has to repair it
  9. Look at the main select query for grabbing the user's data (should be within the top 30 lines by default)
  10. You appear to have a conflicting js imported in. Suggestion: Strip out *all* from the header. Add them back 1-by-1, starting with the JS required for the getList() (sent via PM). Once it stops working, you know which one is conflicting
  11. If you don't have to use RegEx, don't. You can simply explode() it out using the comma separators..
  12. He also hasn't defined $page as an argument in the function.. function page($page = 0) { if(!$page || !ctype_digit($page)) return false; if($ir['page'] != $page) { $db->query('UPDATE `users` SET `page` = '.$page.' WHERE `userid` = '.$ir['userid']); $db->query('INSERT INTO `logs` VALUES (NULL, '.$ir['userid'].', '.$page.', '.time().')'); } return true; } //Usage: page($whatever_variable_holds_the_page_number);
  13. ...My intentions were to poke a little fun, then backup your statement in agreement with you >.>
  14. For the record, it'd be page($page); And time() is a PHP funtion, not MySQL. You'll need to change it to either ".time()." or simply unix_timestamp() Oh, also [uSER=71663]IllegalPigeon[/uSER], lick my nipple! Backticks are useful! Then again, so are standardized naming conventions (not using things like `count`, `time`, `user`, `badly,named,table,with,commas`, etc. as table/column names) http://stackoverflow.com/a/11321508
  15. A darker theme would be much appreciated
  16. This can also be done as just the query $db->query('DELETE FROM `table` WHERE `timestamp` <= (unix_timestamp() - 86400)');
  17. I've tested this myself, it does work. I'd have to see your setup before I can diagnose further - feel free to shoot me a PM
  18. When coding late at night with all the lights off around you for 13 years almost non-stop, your eyes tend to hurt (or, at least, mine do!) So I've wrote up a dark CSS theme for MakeWebGames using the browser addon Stylish (Chrome/Firefox). It's easier on the eyes, I'll give it that much, but it's fugly as hell - still, it's a darker theme that makes my time on MWG easier for me. If anyone would like to chuck over updates/suggestions, please feel free! I can add them as options for customisation before installing the theme MakeWebGames Dark
  19. Indeed. We can therefore assume that the stock jQuery packaged with MC Craps is no good. Try using the latest jQuery found here
  20. Here's an example of it in a form designed to send an event to a user. <?php require_once __DIR__ . '/globals.php'; // If the form has been submitted if(array_key_exists('submit', $_POST)) { // Basic sanitation $_POST['user'] = array_key_exists('user', $_POST) && is_string($_POST['user']) ? $db->escape(trim($_POST['user'])) : null; $_POST['event'] = array_key_exists('event', $_POST) && is_string($_POST['event']) ? trim($_POST['event']) : null; // Basic validation if(empty($_POST['user'])) { echo 'You didn\'t select a valid user'; exit($h->endpage()); } if(empty($_POST['event'])) { echo 'You didn\'t enter a valid event text'; exit($h->endpage()); } // Get the user $select = $db->query('SELECT `userid` FROM `users` WHERE `username` = "'.$_POST['user'].'"'); // Does the user exist? if(!$db->num_rows($select)) { echo 'The user you selected doesn\'t exist'; exit($h->endpage()); } // Return the userid $user = $db->fetch_single($select); // Send the event event_add($user, $_POST['event']); echo 'The event has been sent<br />'; } // Display the form ?><form action="send_event.php" method="post"> <table class="table" width="100%"> <tr> <th width="25%">User</th> <td width="75%"><?php echo getList('user');?></td> </tr> <tr> <th>Event</th> <td><input type="text" name="event" /></td> </tr> <tr> <td colspan="2" class="center"><input type="submit" name="submit" value="Send Event" /></td> </tr> </table> </form><?php // Page footer $h->endpage();   If you were to stick that in a file called send_event.php, you'd be able to simply start typing a name to select a user. With the way the getList() function works, it'll return a username as the value so, we select the user based on the username entered. If the user doesn't exist, end the page. If the user does exist, return their respective userid and continue. Long story short; getList() returns a username as a value. Do with it as you wish ;)
  21. and http://makewebgames.io/forum/game-engines/mccode-development-support/engine-support/377702-sql-errors I'm gonna say no. Thanks though
  22. Do the same - restructure the query to have column name declarations $db->query('INSERT INTO `mail` (`mail_from`, `mail_to`, `mail_time`, `mail_subject`, `mail_text`) VALUES ('.$userid.', '.$to.', '.time().', "'.$subj.'", "'.$msg.'")');
  23. The MC Craps version of jQuery *should* suffice. As for the UI, https://code.jquery.com/ui/1.11.4/jquery-ui.min.js is what you're after
  24. Change if($ir['timecard'] = 1) to if($ir['timecard'] == 1)
×
×
  • Create New...