Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. preg_match_all("~<td class='right_column'>.*?</td>~is",$content,$matches);
  2. Unfortunately, 9/10 times, there is always someone out there enabling their laziness by answering their question anyways.
  3. mmhmm...so making a joke is bad but calling people idiots is okay? I suggest trying www.hellokittyislandadventure.com/forums
  4. You mean the "Oh...that's it? Come back when you grow up, boy" face?
  5. if(!preg_match("/^[-'a-z0-9]{8,12}$/i",$_POST['username'])) You may need to stripslashes $_POST['username'] before preg_matching though. Also, that pattern does not prevent stuff like this from matching: a-----bc a''''''''bc a-b-c-d-e ------abc-- etc..
  6. yes, but it only works within the pattern or within the 2nd argument of preg_replace. You can't turn around do for instance $num = $1; If you want to be able to do something like that, then you need to use preg_match or preg_match_all and it will be assigned to an array specified in the 3rd argument.
  7. Because otherwise the world would be a dull place. It seemed like you started off by acknowledging the joke (the "lol, I wish...") but then later on forgot all about that and chose to go on the offensive. Don't be so uptight. It's just some random dude on some random board on some random site on the internet.
  8. preg_match('~Requires level \d+~i',$Info,$match); print_r($match);
  9. I do it for the chicks.
  10. dude I don't know why you're sitting there gloating. You admitted you misread it in the first place. Even a blind man will hit the bullseye if he gets enough shots. Too bad he shoots everything else in the process.
  11. nah redarrow has it covered. 2hrs from now, we'll have a working php-to-spanish script. gogogogogo
  12. Yeah I saw the copyright date and was like ... writing php3 scripts in 2005 wtf? some method in some class that extends some other class that extends yet another class is trying to call a method that apparently doesn't exist. He says it was working before the upgrade, and now it's giving that error after the upgrade. My first guess is he has uploaded some older file where it doesn't exist yet, or something.
  13. delicious, sweet irony, how I love thee.
  14. Holy Crap...upgrading from php3?!?!?!?
  15. If you're asking yourself these questions, then you probably don't need to go OOP. You go OOP for the same reason you went to putting things into functions: re-usability.
  16. Nothin' else, could just separate it: $t = "{$type}_id"; mysqli_query($db , "UPDATE {$type}s SET login_hold = 0 WHERE $t = '{$row[$t]}' LIMIT 1");
  17. okay if I read/understood that right, it sounds like you are grabbing more than one page worth of info from the db and want to paginate it. The point of pagination is that you only grab one page worth of data at a time. Think maybe you need to back up a few steps in your process and rethink the whole pulling stuff out of the db thing. Or else, you need to be a bit more specific.
  18. have you looked into pcntl? I've never really used it but if I understand it correctly, pcntl_fork returns the child's process id if you're in the parent, 0 if you're in the child, so you should be able to use an if statement to figure out whether you're currently in the parent or child process, and do stuff based off that. Like for instance, you can call pcntl_wait or pcntl_waitpid to make the current process wait for the other one to finish.
  19. http://www.phpfreaks.com/tutorial/basic-pagination
  20. I believe you are talking about threading, in which case, php does not support that. You can look into forking, which mostly simulates it.
  21. array_count_values arsort
  22. You can do it in one regex, doing something like this: '~<td.*?class="(?:file|crcsize|seeds|conns)"[^>]*>\s*(??:<a href="([^"]*)" title="([^"]*)">(.*?)</a>)|(?:<b>)?(.*?)(?:</b>)?)\s*</td>\s*~is' What that basically does is look for any td with class file, crcsize,seeds, or conns. Then it will either look for a link tag and match the stuff inside it, or just do a generic match everything, to accommodate the different scenarios. This pattern will match all of your info. It will match the href, title, stuff between link tags, general stuff between the td tags, check for bold tags, etc.. for any of those 4 classes. The main problem with this pattern is that it will make for some funky ass result formatting. Try it out and do a print_r on the results to see what I mean. There's a whole lot of empty elements, for things that don't match for any given td. Your best bet is to break it down into 2 different regexes. First match the link stuff, then match the other class td's.
  23. another problem with your pattern though is that it doesn't take into consideration other things that might be in your td tags, or certain ones not being there at all. For example, the example you posted: <td class="file"> <a href="link.com" title="title">X</a> </td> <td class="crcsize">X</td> <td class="seeds" colspan="7"></td> That has a colspan in your seeds td, and also your conns td is missing. Both of those things will make your regex fail
  24. no. Negative character classes only match one character at a time. So it will match anything that is not a < or /, not a string of "</" together. What you want is negative lookahead. Something like (?!</a>).*?
  25. very first thing I see wrong in your pattern is this: <td class="crcsize">([^"]*)</td> I think maybe you missed the point of negated char classes vs. match-alls. ([^"]*) is specific to getting stuff between quotes. For example: href="([^"]*)" means to keep matching until you hit a double quote. Well does that really make sense within the context of this? <td class="crcsize">([^"]*)</td> That says to match <td class="crcsize"> and then keep matching until you hit a quote, and then </td> so it's not going to match until it finds the first "</td> in your string, which looks like according to your posted example, doesn't exist.
×
×
  • 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.