Jump to content

requinix

Administrators
  • Posts

    15,286
  • Joined

  • Last visited

  • Days Won

    435

Everything posted by requinix

  1. Are you running this site on your own computer? With IIS? How did you set it up?
  2. I showed you code. You need to make the mental leap to understand what it is and what it does. It's only three lines. More of a step than a leap.
  3. Sounds like POSTing isn't enabled for your script. Talk to your hosting provider to see what's up with that.
  4. "Weeks"? Really? Array (Whatever variable you dumped is an array, [2] => WP_User Object ( [3] => WP_User Object (containing WP_User objects, [data] => stdClass Object (with "data" properties that are plain stdClass objects, [ID] => 3 [user_email] => [email protected] contain "ID" and "user_email" properties. foreach ($variable as $user) { echo "ID: {$user->data->ID}, Email: {$user->data->user_email}"; }
  5. So how familiar are you with PHP? MySQL? What have you learned so far? This forum works a lot more effectively if you can ask specific questions. In general you'll need 1. To know how to get stuff from a database (the list of states) 2. To know how to put stuff into the database (who the user is and which state they chose) 3. A map 4. Information about where each state is on the map - like actual pixel locations (eg, the center of Florida is at X,Y on this image) - which you should store in the database along with the state information itself 5. Some HTML and CSS knowledge; besides obviously making the page, you will need to be able to overlay one HTML element on top of another (that is, a with the username overlaid on the map) On that main page you'll pull information for one user (I guess?), including which state and where that is on the map, then position an and accordingly.
  6. If all you need is those IDs then use a foreach to extract the values into a separate array, then sort the array.
  7. First, you want hashing. Encryption is when you can get the original password back from your database. That sounds good but it isn't. What you need is hashing, which is taking something like a password and turning it into another thing that looks random but will give you the same result for the same password. (Basically.) Then you compare hashes. Use password_hash and password_verify like // when setting or changing a password $hash = password_hash($_POST["password"]); /* put $hash in the database */ // when checking a password if (password_verify($_POST["password"], $hash_from_database)) { // password matches } else { // password does not match }
  8. I assumed the question was about extensions - .html and .php. But any way I interpret the question, the answer is the same.
  9. The question marks are supposed to be there. That's how prepared statements work. Wikipedia
  10. What is the new error message?
  11. Stuff doesn't just stop working without a reason. If your .htaccess is being parsed and you're not getting 500s as it is now then everything there should be working - unless something changed to break it. So. What changed in the last couple days?
  12. You're binding just fine. SQLSTATE[23000]: Integrity constraint violation: 19 users.active may not be NULLSince active isn't in your list of columns to insert, the database will use the default value. But the default is (apparently) null. The result is that you have to specify the active value when adding a new user.
  13. It matches both because you aren't using anchors to enforce a match against the entire string. All you're doing now is checking if the string contains those patterns.
  14. Use usort() with strnatcmp() to implement your own sorting algorithm. usort($FIRST_NAT_SORT, function($a, $b) { $a1 = strtok($a, "-"); $a2 = strtok(""); $b1 = strtok($b, "-"); $b2 = strtok(""); return strnatcmp($a1, $b1) ?: -strnatcmp($a2, $b2); });[edit] It's been asked so I'll explain: The function to usort() has to return 0 depending on how the two arguments ($a and $b) compare to each other - negative if $a $b. Fortunately that's exactly how strnatcmp() behaves too. return strnatcmp($a1, $b1) will handle sorting for just the parts before the hyphens, but if they're equal then you need to compare the parts after the hyphens. $x ?: $y is shorthand for $x ? $x : $y, so return strnatcmp($a1, $b1) ? strnatcmp($a1, $b1) : -strnatcmp($a2, $b2);(except the shorthand will only evaluate the first strnatcmp() once) Since strnatcmp() returns 0 if the two are equal and nonzero if not, the function will return that number if the two are not equal because it won't try to do the second comparison. If they are equal then the second strnatcmp() does get evaluated. It works the exact same way as the first one, except it has a minus sign to negate the return value. Thus the result is backwards: negative if $a2 > $b2 and positive if $a2 $b2. The effect is a descending sort on the values after the hyphens. To be absolutely explicit about everything you could write that line as $compare1 = strnatcmp($a1, $b1); if ($compare1 < 0) { // $a1 < $b1 return -1; } else if ($compare1 > 0) { // $a1 > $b1 return 1; } // $compare1 == 0 and $a1 == $b1 $compare2 = strnatcmp($a2, $b2); if ($compare2 < 0) { // $a2 < $b2 return 1; // opposite result } else if ($compare2 > 0) { // $a2 > $b2 return -1; // opposite result } else { return 0; }
  15. Type something random and invalid into the file and see if your site starts returning 500 errors. If not then it means your .htaccess file isn't being interpreted anymore and you should talk to your host.
  16. Clearly OP doesn't have the understanding or the inclination to let us help him.
  17. To me it depends on what the date represents. If it's an actual piece of relevant data then you should put it in the database, but if it's just an artifact of the file itself then leave it with the file. So probably the former.
  18. If it's your own content then that deals with the more problematic restrictions, but you still can't scrape their site to get what you need. The API does provide a way, but it requires generating access tokens by logging into their site; there's no indication how long those tokens are good for (just an ominous warning that they might expire in the future) so you will probably have to re-login to keep the feed working indefinitely. So here's what I propose: You take the officially-supported API route. Make an application according to their guidelines, and to alleviate most of the burden of the API you can use a third-party library to do the communication parts, then use their /users/self/media/recent endpoint to get the images. Yes, it will take you a little longer, yes, it's not as simple as scraping, but that's the method they require so that's what you'll need to do.
  19. Okay, see, now we've got a bit of a problem: Instagram doesn't like people doing what you're doing. Their Terms of Service specifically disallows crawling media (General Condition #9), their API policy says you can't "simply display User Content" without permission (General Terms #16), and the less precise "Platform Policy" list in their documentation says you can't crawl media without users' consent or automate requests (#4, #5). And on a more technical note, their API doesn't provide a way for you to access user media without them specifically logging into Instagram. As far as I can tell. I'm not sure there are any alternatives open to you...
  20. I haven't seen anything to suggest this sort of behavior is not allowed... What's your code? If it handles those URLs at some point between the RSS and Telegram then you can simply remove the query string before submitting them.
  21. Why remove it? What's the problem?
  22. Okay, great, so now we've established that the code you're posting is not the actual code you have. The first step is to post your actual code. Also, if you need to know three states for the input (default, checked, unchecked) then a mere checkbox is not enough because all it can tell you is whether it was checked. You'll have to combine that with knowledge about whether the form was submitted.
  23. To validate the HTML... well, you know HTML is rather flexible. "string" is valid. " string" is valid". Some stuff you might consider invalid is still acceptable to browsers. I'm thinking (a) just load it with anything in PHP that supports HTML and see if it complains, or (b) try Tidy. Maybe your end result should be less valid/invalid but whether it's supposed to be valid already and you can just fix it if it has minor errors?
  24. I don't get why you expect it to show anything other than 5. It's what you put into the HTML. Directly. No PHP code, no variables, no Javascript to update the value on page load... Why do you think it should be anything other than "5"?
×
×
  • 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.