Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. It depends on the input and the way the users want the output to be. I was assuming, based on the OP's post, that the users were inputting various strings which would be spit out INSIDE of HTML, rather than the users inputting HTML which would then be output and expected to be formatted. If it's the latter, then no encoding at all is necessary. I bet it's the former though, otherwise misplaced unescaped quotes wouldn't be a problem.
  2. Generally that's how it works when the code is obfuscated. I don't the particulars of ioncube itself, their documentation would explain for sure.
  3. Nothing changes in the way you use it, it just becomes difficult for a human to read it and edit it.
  4. $b in my example is already a timestamp.
  5. If we saw all your code and you told us the reason behind it, I'm sure we could figure out a way to utilize arrays properly and pare the size down a lot. However, if it's working it's working.
  6. In addition, this whole thing could have been worked around with an IF statement without any ill effects on your code. In fact, I bet the IF solution is a little faster than array_filter.
  7. Ok, really, date() can output a date in any format you want. Check the manual page.
  8. Exactly what I posted above, except replace 'c' with 'A'
  9. Indeed I did, which is why I suggested the html function.
  10. The best way to do that is through ioncube or something similar. or simply through a legal agreement with the customer.
  11. Definitely not addslashes, that hasn't been recommended for years. If you're trying to include content inside of HTML tags, you should use the htmlentities() function.
  12. Why do you want this? Describe the problem you're trying to solve.
  13. Yes, obviously, so what you're saying is: "I have three numbers: 4, 9, 18. I want to find the minimum of these numbers, but I don't want to count the middle one, so how do I make it infinite?" Don't include it, and it can't possibly be the min...because it's not included. Call the function without that variable, and it can't possibly be the answer. What am I missing here?
  14. Josh's way is faster than mine, but he trims the trailing slash. You'll have to re-add it.
  15. Whoever told you to use magic_quotes or addslashes is wrong, or at least they stopped being right in 2003 when we moved to mysql_real_escape_string. I don't know where the carat is coming from though.
  16. Neither of the above will handle your second case. You want: echo preg_replace('#^(.*?/.*?/.*?/).*$#', "\\1", $yourString); -Dan
  17. 1) You don't need the array declaration in there, min() supports an infinite number of arguments. 2) Simply remove $maq entirely. You're asking "I want the minimum of two numbers, or infinity." Infinity is never the minimum of any set, just remove it.
  18. Then you have magic quotes turned on, check your php.ini Your slash has been backward in both of your examples so far. Is it really /' or is is \' ?
  19. What problem are you attempting to solve here?
  20. Don't use stripslashes or addslashes, and make sure magic_quotes is OFF. use mysql_real_escape_string on your INSERT statements only. Don't do anything when you retrieve the data.
  21. Ok, it might help if someone else says it: You cannot know what "too long" means in PHP. You can't. Look: WWWWWWWWWW <-- 10 Ws IIIIIIIIII <-- 10 Is See how those are drastically different widths? Now, a CSS way is really the only good way to do this because the browser will know how wide the text it's drawing will be, and the browser can then determine line breaks and line height, both of which can be specified by CSS.
  22. Google weights new sites more heavily than old. Release an update, redesign the site, do something to trigger the "new" flag.
  23. $a = '03-03-2008, 08:26 PM'; list($date, $time) = explode(', ', $a); list($month, $day, $year) = explode('-', $date); $b = strtotime("{$year}-{$month}-{$day} {$time}"); echo date('c', $b); //2008-03-03T20:26:00-05:00 -Dan
  24. You can't edit your post more than 30 seconds after you post it. It's one of the forum rules. The OP needs a lot more than just PHP GET functionality. None of his queries are even being run.
  25. setlocale changes the output of many functions, including date related functions. -Dan
×
×
  • 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.