Jump to content

DarkWater

Members
  • Posts

    6,173
  • Joined

  • Last visited

    Never

Everything posted by DarkWater

  1. DarkWater

    Replace /

    That only works if there's actually a slash on the end. It doesn't do any detection... CV's solution is the best. Nice one.
  2. 1) You're making it much harder than it really is by not using a regular expression here. Honestly. 2) They are not THAT slow, especially knowing that you're going to have to do several strpos() calls and stuff. 3) My solution grabs everything in one go and is very simple... Good luck doing it with strpos() if you're still going to try it. I wouldn't.
  3. I'm fairly sure that the guy who wrote that was deprived of oxygen for a good hour or two at birth.
  4. If you actually bothered to read the link he gave you, you'd immediately realize that the tutorial does exactly what you're asking for.
  5. Why not use a regex? <?php $string = "SELECT cat_table, cat_key, cat_field_status, cat_field_location FROM bp_object_type WHERE object_type = 'AP'"; preg_match_all('/(\w+)\s*=\s*([\'"])(\w+)\2/', $string, $matches); print_r($matches); $matches[1] and $matches[3] will be the part before the equals sign and after it, respectively.
  6. No, we're not just here to do your work for you.
  7. What? @thread starter: Why don't you just directly interpolate the variables...?
  8. By the way, are you sure you want AND and not OR? =P If you did really mean OR, I'd suggest just checking out the IN() construct. It would make your life much easier.
  9. @flyhoney: No, you wouldn't really want static functions for this.
  10. $_SESSION['submitted'][1]['code'] should contain the value you're looking for, based on the print_r() you posted.
  11. "Everyone does not" and "not everyone does" have the same meaning, although the second one seems more unwieldy and I never really say it like that. =P @darkfreaks: Why don't you just make it recursively handle arrays so he can clean $_POST in one function call?
  12. PHP is pretty smart when it comes to managing memory. You don't need to unset individual variables. Destructors are used to do any absolutely-last-minute work in a class.
  13. 1. The layout still looks incredibly bad. Do you really think that it looks good? 2. Stop posting with random caps lock. 3. I'm surprised that nobody has actually said anything to you about the err...religious propaganda. Everyone doesn't believe in god, you know. Just saying. 4. It seems, like darkfreaks said, that you aren't sanitizing your input still. In the clean() function, why are you starting a new connection every single time?
  14. http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.3fay.com%2F 500+ validation errors. O_O Also, your banner makes absolutely no sense. At all. "Curiosity for find, learn and develop."
  15. DarkWater

    Replace /

    You could do this without a regex, but here: <?php $string = 'http://www.website.com/'; $string = preg_replace('~/$~', '', $string); echo $string; ?>
  16. Ah, good idea. I was thinking of something like that; I just didn't have time to think about it. Nice.
  17. DarkWater

    Echo

    I don't quite get what you're asking. =P
  18. I was under the impression that you could not have numbers as aliases. If my memory is correct, this should work: SELECT icu.id_incr, 2.pt_id, 1.rm_loc FROM icu INNER JOIN dos ON icu.id_incr = dos.pt_id AND icu.id_incr = 4; Substitute 4 for your GET param. Also, sanitize your GET input! Make sure it's actually a number!
  19. You cannot have braces inside of a character class like that. It would just mean that the characters '{', '0', ',', '1', and '}' could appear in that spot. Your no-double-periods deal would probably require some really advanced stuff. In fact, I can't even think of an easy way to implement it in one nice regex.
  20. You could use * instead of + if you wanted to allow things like a9 or something.
  21. Looks good. It's funny because I was thinking to myself "I should use \w so I don't need to put an underscore or anything", and I end up putting an underscore in there. Good catch. It's ironic that I wrote that tutorial and just made a mistake like that. =P
  22. 1. Show us the new script. 2. I'd suggest a foreach loop rather than a for loop for iterating an array...
  23. Number 4 might be really tough actually. The rest is easy though: ^[a-zA-Z][\w.-]+[a-zA-Z\d]$ Notice the + instead of {1,}.
  24. That's weird then. I'll get back to you tomorrow; I need to go.
  25. safe_mode and safe_mode_exec_dir.
×
×
  • 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.