Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. $data = http_build_query(array('action' => 'vote', 'id' => $id, 'ajax_module' => 'tracking', 'module_type' => 'public', 'dir' => '1')); That's not JSON. Have you first changed it to send JSON data?
  2. I will personally lambaste anyone who mentions the "e" function. Strongly. Create an array of "variables" you want to replace, then replace them. str_replace() is the normal way of doing that but strtr() is actually more convenient. $vars = array( '$secret_code' => $secret_code ); $string = strtr($string, $vars);
  3. http://www.downforeveryoneorjustme.com/api.justmcservers.com
  4. A description of what it does. We don't know what "works" and "doesn't work" mean.
  5. You can't put it inside the tag, silly. You want after? Then put it after. Srsly.
  6. Also, Board's constructor needs to call the parent constructor too - that doesn't happen automatically. Also, please call it "__construct". public function __construct($id) { // in Board parent::__construct(); // in Site
  7. Use DATE_FORMAT(). Which you said you tried but apparently there was something wrong. 1. What did you try? 2. Are you storing the dates as actual DATETIME columns? Or some other type?
  8. It's called "URL rewriting" and there is a lot written about it on the Interwebs. The key concept is that you aren't actually creating pages or any real files or directories but telling the web server that URLs following a pattern should be treated like something else. For instance, you could tell Apache that anything /whatever (that doesn't correspond to an actual file) should actually go to /article.php?id=whatever instead. But keep in mind that you can't just automagically add something to the new URL: all you have to work with is what the original one provided. That means you can't go from /max-baldwin to /article.php?id=5 because there's no "5" in the first URL (just the "max-baldwin").
  9. I, for one, would really appreciate getting an answer over here, where you asked the same question yesterday and got two separate answers.
  10. Because you have multiple forms with the same ID. Which isn't valid because IDs are supposed to be unique. Also, FORMs are not valid directly inside TABLE tags.
  11. Unless you use HTML 5 features, all form elements must be contained in the they go with. And unless you're doing something weird, both of those snippets will look the same.
  12. Whatever is on line 25 is outputting something. Maybe an error message, maybe whitespace, maybe something intentional. For header() to work there must not be any output beforehand.
  13. Eh, so maybe I don't pay much attention to thread titles... It is kinda like modulus but only for powers of 2 (which includes 2^0=1). For any other number it works differently. Check the link I gave.
  14. Where? Is it like $num & 1? That's a bitwise AND (which is sometimes misused in PHP to be a boolean AND, but probably not in this case).
  15. It'd be a lot easier if you used SoapClient instead of cURL.
  16. UPDATE users SET gold = gold * 5
  17. $rows is just one row from the result, not all of them. All you're looping over is the columns in that row. And actually your $sql variable is named a bit off too: it's the results of the query, not the SQL itself. Try this structure: while($row = mysql_fetch_array($sql)) { echo $row["id"], " "; }
  18. "$_SESSION['user']" If you don't use {}s with the variable then you do not include quotes in the array key. "$_SESSION[user]" Include the quotes only with {}s. "{$_SESSION['user']}" "${_SESSION['user']}"
  19. Why? Because you don't know how to use a SimpleXMLElement object?
  20. 1. Put a LIMIT 20 on that query. No sense pulling more results than you could possibly use. 2. If the user doesn't have 5 rounds yet, stop. 3. Load up all the scores into an array and sort it. 4a. Use the control structure of your choice to get a subset of the array. 4b. Protip: for 5-16 rounds you can floor(($rounds - 3) / 2), with 17-19 $rounds - 10, otherwise 20. Try the math yourself if you're not sure of it. 5. Since PHP doesn't have a built-in "average" function, figure it out yourself. That will result in a fairly short chunk of code, and the confusing logic doesn't even play a part in most of it.
  21. Why are you mixing colons and commas? If there's no difference then pick one and stick with it. list($one, $two, $three, $four) = explode("whichever", file_get_contents("map.map")); Otherwise there's some underlying structure you aren't telling us. Your code should mirror it.
  22. So I'm guessing this is more a demo/proof of concept than an actual website you want people to visit? Lots of JavaScript. Plus an API (probably REST) to get the information. Also, XKCD's done it.
  23. Looks like they have a free API. I strongly recommend using that instead, even if only because it'll be a lot easier.
  24. Nope. Pipes only matter when they're in the regex itself - pipes in the source text are fine. Are you sure the name isn't a random string?
  25. Depends on the data, depends where it's going. Sometimes you just escape it, sometimes you have to actually encrypt or encode it. There is no blanket answer. The problem you face is that the app has to communicate with your server, and (theoretically) someone could watch the data being sent and then fake their own version. Here you would probably encrypt it; SSL should be adequate for that. So make sure your server is set up for an SSL site and... that's about it. Disclaimer: I don't develop apps, I've never had to tackle this problem before. So find yourself an experienced app developer (maybe here on phpfreaks) and ask what they would do.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.