Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Everybody hasn't got a car. I don't have one, and I don't foresee getting one in the near future. I simply have no need for a car.
  2. Well, it will work for decimals, but it will also allow illegal things like this: 1.2.3.4.5.....7 You can do like this: preg_match('#^-?[0-9]+(?:\.[0-9])*(?:[-+*/^](?:\(-[0-9]+(?:\.[0-9])*\)|[0-9]+(?:\.[0-9])*))*$#', $string); (untested)
  3. Sorry, make it preg_match('#^-?[0-9]+(?:[-+*/^](?:\(-[0-9]+\)|[0-9]+))*$#', $string);
  4. Right, so a number is -?[0-9]+. Either of the operators +, -, *, / and ^ require a number on both sides. preg_match('#^-?[0-9]+(?:[-+*/^](?:\(-[0-9]+\)|[0-9]+))*$', $string); So basically, you can do 1*2, but you can't do 1*-2 because it needs to be 1*(-2). I didn't test it very thoroughly, but I'm pretty sure it works. It can probably be optimized as well.
  5. Actually, there is potential in this. We could prevent people from starting topics in the "PHP Coding Help" board if the PHP manual doesn't show up in their history
  6. It's called "Quick Reply". It's designed for when you need to write quick replies, not for when you're writing CV style novels
  7. I suppose we can do that. I can't say I've ever used any of the buttons though.
  8. Wouldn't it be smarter making the Java applet sending the mac address to your server?
  9. Isn't that exactly what I just said?
  10. No kidding. But it doesn't contain a document object. I'm sure the OP doesn't really need to be confused further by being made aware. As far as I can tell, he is only using document to output things. I have never used any of the SSJS implementations, but I'm sure they support basic things like outputting to stdout. Depending on what kind of JS he wants to execute, I don't see why he couldn't use something like exec to execute it on the server with an SSJS implementation.
  11. Javascript can be run on the server just fine... http://en.wikipedia.org/wiki/Server-side_JavaScript
  12. Setup a certificate with your webserver and then change your links and possibly rewrite http to https using e.g. mod_rewrite for Apache.
  13. Actually, you can only check if a person has viewed a particular site, not get a list of all sites you've viewed. It's still a privacy issue though. Browsing history can be turned off in Firefox though.
  14. Though you shouldn't return an error message from a function call. Instead you should throw an exception or generate an error using trigger_error (exceptions would be preferred).
  15. If you turn on track_errors in php.ini you can get the last error/warning that is generated in $php_errmsg. I don't think it'll work if you suppress the error though. Generally speaking, you shouldn't suppress errors, however. A try-catch block works by transferring control to the catch block if a designated exception is thrown within the try block. If no exception occurs, the catch block will not be executed. An error is not the same as an exception.
  16. file() doesn't throw exceptions.
  17. $keys = array_keys($array); $next = $keys[count($keys) - 1] + 1;
  18. Yeah. You better get away from your computer quickly. It can make your CPU overheat so badly that your computer blows up. Take cover!
  19. Man this climate shit is annoying. The COP15 climate summit is going on in Copenhagen these days and helicopters are constantly patrolling the city. The noise from the rotor blades is driving me crazy Fuck the climate. Maybe we should prohibit sport and other strenuous physical activities. People will need more oxygen and thus produce more CO2.
  20. Specifically, what characters do you allow? It's easier making a whitelist than a blacklist. If you only want alphanumeric chars you can do $str = urlencode(preg_replace('#[^a-z0-9]#i', '', $str));
  21. Plus, anyone who knows just a little bit about HTTP can send their own X-Forwarded-For header with bogus information, which just makes spoofing IP addresses even easier.
  22. I saw someone posting a configuration snippet yesterday (not here) where he made .php* parseable by PHP. I assume it was to get things like .php4, .php5 and such. This could open up for that.
  23. You're missing my point. You generally shouldn't mess with the post. Just escape it using htmlentities. It's equally safe and it preserves the content.
  24. What's the point of using htmlentities here? I assume you wanted to use mysql_real_escape_string.
  25. Hi Blake. Welcome to PHP Freaks! For how long have you been into web development/design?
×
×
  • 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.