Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. You're joking about the letter, right? What is the sixth item? I don't see one. Does it look familiar?
  2. And it's more correct too. Even though PHP is loosely-typed, being specific helps. I mean for all I know, if loggedIn=1 then maybe loggedIn=2 could mean something else. Normal user versus administrator?
  3. It is not necessary. However it is bad form to modify the values in $_POST et al. so if you need to do something to them then keep that first section and modify your variables instead.
  4. The Arabic Unicode block has 253 characters. The Hebrew block has 87. There are other RTL alphabets. Detecting those characters would be obscene. Enjoy trying to do that.
  5. PHP has to get its information from somewhere. A lot of the stuff you know about is available because PHP runs as a server module or CGI application: DOCUMENT_ROOT, SCRIPT_NAME, HTTP_HOST, and so on. Thus when PHP doesn't run as a module or through CGI you lose it. So think about that. "Is this thing I want available because PHP is running as a webpage? Or can PHP figure it out independently?"
  6. Most of the familiar stuff in $_SERVER isn't available if you're running the script from a command line (such as through a cron job). For example, DOCUMENT_ROOT tends to be empty...
  7. Enable URL rewriting If the domain name contains ".localhost." and The request does not refer to a directory and There exists a file named "(request).html" then (1) Set $1 to the request and (2) continue processing as if the request was actually for "$1.html" instead
  8. How else are you going to find what you want unless you're prepared to search the entire array? The only way was if the array was sorted or otherwise preprocessed, but to do that from scratch you'd still have to look at everything. Your logic is great but plain JavaScript doesn't work like that. As you still haven't said whether you want just one id or all the matching ids, for one the logic is looking at each item in the array, if x > data[0] and y > data[1] and x and for many [code]start with an empty list. looking at each item in the array, if x > data[0] and such then add the id to the list. after searching the array, return the list
  9. First, you have to understand that how the feeds are displayed is outside of your control. You can provide as much information as you want but the ultimate display of the feed will vary. If one includes links and one doesn't then that's how it is. But I did notice your items don't have s. Throw those in. url here And everything that can be text needs to be htmlspecialchar()ed if it isn't already. As for IE showing six, could it be remembering one of the items it saw earlier?
  10. Use a loop. Look through everything and return the current item's ID once you find a match. If there could be more than one you scan the whole array and track all the matching IDs.
  11. Does a background image not suffice?
  12. It doesn't sound like you should be using regular expressions. What do you mean "match an array against zero"?
  13. http_post_fields() comes from a PECL extension, and those are less common than the regular extensions. Your host probably has cURL enabled. Try using that instead.
  14. Does it work?
  15. Your code is not the same as l0gic's. Yours may look like it works but it does not.
  16. 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?
  17. 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.
  18. 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.
  19. "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.
  20. Can $num ever be negative? That's the only difference I can think of.
  21. 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")));
  22. PHP doesn't have a >>> operator. That code should raise a syntax error.
  23. 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.
  24. 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.
  25. 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.
×
×
  • 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.