Jump to content

requinix

Administrators
  • Posts

    15,266
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. I wouldn't use it. Main reason is there's no explanation of the algorithm and, since I'm without a degree or significant expertise in cryptography, there's no way for me to know if it's secure. If you need encryption then go with actual encryption. But are you sure you have to implement the encryption yourself? Where are the endpoints of this socket? Could you use SSL?
  2. I encourage people to add me on Skype or MSN or whatever. I think it's good to have friends and people to talk to in the industry. The ability to talk randomly about anything 1 to 1 is great, and may help spawn ideas or creative discussion. There's a difference between chatting with someone because they helped you before and taking some random guy on the internet as a mentor. [edit] "random guy" isn't meant to be derogatory.
  3. This is an excellent idea. One person everyone can talk to privately to get programming advice without the disadvantages of getting opinions and fact-checking in a public arena.
  4. "Clear it"? htmlentities() is about getting characters represented correctly on the page. As in if the page doesn't have the right text encoding to support something you can use entities to get the character to show up anyways. It'll also escape HTML tags but that's a good side effect.
  5. Can $num ever be negative? That's the only difference I can think of.
  6. A big part of what it does is show types: if you print_r($x) and get "1" you won't know if that's a number or string. For a fun example of why that can be useful, var_dump(array_keys(array("0" => "zero")));
  7. PHP doesn't have a >>> operator. That code should raise a syntax error.
  8. Textareas contain text, not HTML. They also preserve whitespace and newlines. If you use nl2br() then it will turn the perfectly legitimate newlines into HTML tags which will then be displayed literally. So yes, remove it. But HTML entities are fine so keep that one. [edit] SaCH is right for the general case, but textareas are special.
  9. In REST, POST's meaning is a bit more pure than it is for web stuff. POST is for making changes - not retrieving data. Specifically it's supposed to be for creating things. There's also PUT which is like POST but can also be for updating. In reality they're both basically the same thing and I'd treat them the same way. Besides GET the other common operations are DELETE (which does exactly what it sounds like) and HEAD (which gets information about the resource without actually sending the resource). Status codes are important and have basically the same meaning in REST. You actually get to use more than standard webpages and websites would use. Read through this list and try to obey the semantics for everything, but you don't have to use everything there. Like it wouldn't be a crime to send a 200 OK even if there's no content.
  10. It's okay if one character has many encodings as long as each encoding only corresponds to one character. But that is weird. Again I suggest you contact those people and find out what's going on.
  11. You can tell the web server to treat .php files as something different (like text). For Apache it's AddType text/plain .php in a .htaccess file (that's for PHP-as-a-module setups).
  12. Your "maybe this will work" is causing the problem. $form_month is a string, not an array, and when you [] a string you get one of its characters...
  13. You'd save using something that depends on how you're creating the images. GD has a few image*() functions while ImageMagick has a writeImage() function. But I'm not sure you want to do that. How much can the colors change? Could they be anything? That would mean 281 trillion possible images you'd be saving, and that doesn't include the varying square_size...
  14. I can't tell what it is. Accented characters are represented by some kind of a control character (like a semicolon or 0x10) followed by two hex digits but I don't see a correlation between those and the original character. 0x3B 0x65 0x30 = ã 0x10 0x32 0x63 = á I suggest you contact the people who own the web service and ask them about this. Short of that you can manually substitute those sequences with (for example) strtr() like $string = strtr($string, array( "\x3B\x65\x30" => "ã", "\x10\x32\x63" => "á" )); If you do this, be sure to save the file with this code in whatever encoding you want the characters to be. So save the file as UTF-8 if you want that, or ISO 8859-1 if you want that.
  15. This topic has been passed by-reference to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=355874.0
  16. Normally mojibake shows as unusual characters, not things you'd find on a keyboard. Can you post what you get when you run echo bin2hex($string); (if $string is the response)? Without any modifications to it. Also try using mb_detect_encoding on that response. Sometimes it can tell you what encoding the string is, other times it doesn't know.
  17. Also url() can be used with quotes.
  18. if ($query = mysqli_prepare($conn, "SELECT FirstName, LastName, Age, Hometown, Job FROM people WHERE age With prepared statements you don't stick the values right into the query. For mysqli substitute the variable with a question mark. No quotes, even for strings. Speaking of quotes, don't use quotes for numbers. Prepared statement or not. [code=php:0] if ($query = mysqli_prepare($conn, "SELECT FirstName, LastName, Age, Hometown, Job FROM people WHERE age
  19. There's some kind of output in one of those files that shouldn't be there. Do a View Source on a bad page and see what's wrong. Odds are it's an error message but it could be something as innocent as whitespace in a bad place.
  20. The mechanism is basically the same every time you want to do alternating anything in a loop: $color = the first color you want to use loop { print whatever you want using that $color $color = ($color == first color ? second color : first color); } That ?: line alternates the color: when it's one color it sets it to the other.
  21. There might be a couple easy things you can do. Find the place that phpMyAdmin lets you run queries and enter EXPLAIN SELECT * FROM pp_photos WHERE approved=1 AND cat IN (501,511,502,503,562,504,506,505,508,2,510,509) What do you get?
  22. ...but not PHP 5.3 apparently. Check the manual page.
  23. That while loop is great, but you have to wrap it around the stuff that outputs the table rows. while ($row = mysql_fetch_array($get_members)) { ?>
  24. Look at .checked. And unless you like using ==false you can just use a not (!): !document.forms["form"]["unknownname"].checked
  25. strtok($_SERVER["REQUEST_URI"], "?") That's the method I use.
×
×
  • 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.