Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. while ($db->fetch(PDO::FETCH_ASSOC)($result)) // check manual - I'm guessing at your class method here This syntax is wrong. Like it says in the manual, you want: while ( $row = $result->fetch(PDO::FETCH_ASSOC) ) -Dan
  2. That's usually not how cloud storage works. There's still no security on these files, even if index.php asks for a password. Still though, your script is fine.
  3. For the third time now: in_array won't work here. These are arrays of objects. Your var-dump output keeps changing, so I'm going to leave you to figure this out on your own. You have a problem: You have two arrays of objects. You wish for the objects in array1 to do something special when their attribute matches the attribute of any object in array2. Break down that problem. Write a function which accepts 2 inputs (a news_article_post_tag object, and the news article index post tags data array) and returns TRUE if the news_article_post_tag object matches any of the items in the index post tags array. Then, use it when you print these items to check them when appropriate.
  4. Ok, for the last time, this can't possibly be the code. Look, I'll prove it. The very first line: echo 'check'; exit; That would exit the script with the word check. Every time. This is clearly not the code you're running in production.
  5. This script is very insecure, and doesn't actually do validation on the password or check for things like duplicate usernames in the database. That being said, what's the problem when you tried to write the change password page? Enter your username, old password, and new password. Validate the data, and update the row. You're going to have to explain why you're even using all these flat files, and what's inside them. You should also probably not use md5, especially if you're logging passwords in plaintext to the filesystem. Use a real hashing function like phppass.
  6. in_array doesn't work with arrays of objects. You have arrays of objects. You need to know if one incomplete object is inside a list of other more-complete objects. You need to write a function to check that. You may hit a snag when you realize that one array's objects have category_id and the other array's objects have category_name.
  7. Well it's an array of objects. You need to roll your own solution to in_array which will actually check the object member variables.
  8. And now we come back to my first sentence: What's the problem here? What's your question? Are you asking me to write something for you?
  9. What's the problem here? Your script uses half a dozen variables that don't exist, and selects randomly from files to get variables it never uses. We need a lot more information than a random snippet from the middle of your code.
  10. With IF and in_array
  11. You are most likely not in the file you think you're in. Does your host cache and/or accelerate your files?
  12. Are you in the right file?
  13. Better yet, put your <span> tags right in the notice() function: printf($this->lang['notice'],Tools_get::convert_time($this->ttl*60),$this->limitPERIP,Tools_get::convert_time($this->ttl_ip*60)); Becomes: printf('<span>' . $this->lang['notice'] . '</span>',Tools_get::convert_time($this->ttl*60),$this->limitPERIP,Tools_get::convert_time($this->ttl_ip*60));
  14. Probably because the developer didn't put in error handling. Echo these queries and look at them to see if they're well-formed and contain thee appropriate data. The second query isn't working. Find out why, do some debugging.
  15. Fair enough! I do a lot of text parsing in PHP (web spiders, mostly), but for some reason I would never use it for something like a chat bot. I always fall back to perl, even though I write my spiders in PHP.
  16. Yes, you're out of your mind, this is common knowledge. Why did you choose PHP instead of Perl? Most IRC bots I've used are Perl based. Chat parsing is kind of why Perl exists.
  17. There is no syntax error in this code. The error you got will include a line number and a file name. Find that line in that file. Show us that line and the 10 lines above it. Also, "oops" is spelled like that.
  18. You also probably shouldn't be making a chat bot in PHP unless the rest of the system is also PHP.
  19. Location is a property of the window object. JS Debuggers are available for every major browser.
  20. If you were developing with all your warnings and errors turned on, many of these things would have been pointed out to you automatically by PHP.
  21. You've echoed $country inside these IF blocks and it echoes "USCelcius"?
  22. Integers are not floats internally. Declaring $a = 12 makes $a an int, not a float.
  23. Check the third line. Try to understand what it's doing. Combine that with a similar check for intval. Also note that your code shouldn't contain var_dump, var_dump is an output function that I used to show you results.
  24. We know. We know very very well. That's why my code example was more than one line. It was, in fact, three lines. One of those lines was how you can check to see if a string is a valid floatvalue. also note the existence of is_numeric(), which works on strings. Also also note that latitude and longitude are correctly expressed in minutes and seconds, as in -64'38"
  25. What makes you think this? That's exactly the purpose of those functions: php > $a = "12.34"; php > var_dump(is_float($a)); bool(false) php > var_dump(floatval($a)); float(12.34) php > var_dump(floatval($a) == $a); bool(true) php >
×
×
  • 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.