Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Then what's the rest of the HTML? Sounds like isn't the full story. And what's your code? That'll be easier to understand than a description.
  2. I'll throw out /html/body/div/node()[not(@class='quote')]but it depends what you're doing now.
  3. No, the result is [68,176,83,152,44,38,107,201,112,139,17,80,242,94,158,181,136,198,98,193]which matches up with PHP's sha1("201311060930|aabbcc@test.com|test") // 44b053982c266bc9708b1150f25e9eb588c662c1
  4. $subject won't be defined if the form has been submitted. On that note, you have your logic backwards in that first if block.
  5. They all end in ".co.uk"? substr($_SERVER["SERVER_NAME"], 0, -6)
  6. If you're unsure about the permissions, try creating the log file in /tmp where everyone has write access.
  7. Did notice you typoed "reflector" a few times.
  8. Your data is not in UTF-8. If it were then you wouldn't be having this problem. As a guess, try ISO 8859-5. $dodajime = $doc->createTextNode(mb_convert_encoding($pod['Name'],"UTF-8","ISO-8859-5"));
  9. You wouldn't use regular expressions with strpos. All you posted was the value "new" which certainly doesn't need a regex. The idea I was trying to get across was just doing a normal match and then negating the result. If if (preg_match($regex, $input)) {is the opposite of what you want, then what you want is if (!preg_match($regex, $input)) {
  10. A .DLL made with .NET can be very easily decompiled into its source. The best thing you can do with your code is license it. Second best would be something like ionCube (that being the only such product I know by name).
  11. If the problem is as simple as you've described (hint hint) then strpos to find the string and only accept if it isn't found. So how about the full story? And full regex.
  12. Character encoding? preg_match() needs to know the character encoding, which might be UTF-8 (and you use the /u flag) or something else (and you convert it to UTF-8 and use the /u flag).
  13. utf8_encode() only converts from ISO 8859-1/Latin1 (which I don't think you're using) to UTF-8. If you have the mbstring extension, I like that better than iconv. $output = mb_convert_encoding($input, "UTF-8", "whatever your input charset is");Otherwise $output = iconv("whatever your input charset is", "UTF-8", $input);The real question is what your current character encoding is.
  14. ...and? You're going to ignore a mechanism to prevent session hijacking because of the remote chance that a user might submit two simultaneous requests in such a way that one attempts to access the session information in the microsecond between the other closing the old session and deleting the file? Because that's literally what happens: one statement to close and unlock the file and the very next statement deletes the file. Which isn't to say that you have no recourse in case the old session isn't deleted: session_regenerate_id() will raise a very nice "Session object destruction failed" warning (and return false) if that happens.
  15. Woah now. What's the reasoning behind that opinion?
  16. Assuming the code is valid, scan for T_FUNCTION tokens and pull the first T_STRING or literal '(' following it. (Won't be immediately after.) If you grabbed a parenthesis then it was an anonymous function, as in $anonymous = function() {};[edit] If you need to account for namespaces then it's a bit more complicated...
  17. There isn't a need to name which session to delete: you want to delete the old one. The one you're changing away from. session_regenerate_id(true) will delete it.
  18. What is the JSON the API returned?
  19. So your question is about how to make it try to match something first before it tries to match nothing? The answer is one of: - Use ? (which may not do the job depending on what else you have in your regex, as happened in your other thread), - Force the engine to backtrack (by sending it too far into the string after which it must backtrack to match the pattern successfully), or - That's not how most/all regex engines work (because they generally want to match as quickly as possible) Maybe you have a specific example?
  20. What? .* - as much as possible but does not have to match anything .+ - as much as possible and has to match something .*? - as little as possible and does not have to match anything .+? - as little as possible but has to match somethingInterestingly enough, compare the usage of the words "and" and "but".
  21. No, the result is not exactly the same: array(2) { [0]=> string(30) "I HAVE HAD ENOUGH OF THIS SHIT" [1]=> string(17) "I HAVE HAD ENOUGH" }became array(2) { [0]=> string(18) "I HAVE HAD ENOUGH " [1]=> string(17) "I HAVE HAD ENOUGH" }Ungreediness means matching as little as possible. Since you used .+? and not .*?, all it has to do is match a single character. It does (a space), then tries the optional group, fails to match (which doesn't matter since it's optional), and ends. You need more. Perhaps you are trying to match the entire string? You need a $ anchor to make sure it matches against the entire string. (A ^ would be a good idea too.) preg_match("/^(I HAVE HAD ENOUGH).+?(THIS SHIT)?$/i",$string,$match); array(3) { [0]=> string(30) "I HAVE HAD ENOUGH OF THIS SHIT" [1]=> string(17) "I HAVE HAD ENOUGH" [2]=> string(9) "THIS SHIT" }
  22. .+ is greedy. It will match as much as it possibly can before the engine even bothers to attempt matching anything else. As such, it will go all the way to the end of the string. Now at the end, it will attempt to match the optional group. It can't, of course, because there's nothing left to match against, but it's optional so that's okay.
  23. The example URLs you gave don't quite match up with your .htaccess. What actually happens is /1/2/3 -> index.php?url=1&method=2 /1/2/?arg=3 -> index.php?url=1&method=2&arg=3"Without putting /index/ before" is like saying "make the url optional with the default value of 'index'".You can basically duplicate the rule you have now but you have to make it accept only the one directory component (or else it'll conflict with what you have now), then pass url=index&method=$1. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9_-]+)/([^/]*)$ index.php?url=index&method=$1 [QSA,L]The [^/]* allows more after the directory and won't conflict with the other rule as long as you don't allow another trailing slash. Oh, and you probably want to do something with that trailing component (the $3 in the original rule and $2 in the new rule).
  24. Three ways of putting an array into a string: "before " . $_SESSION["username"] . " after" // no surprise here "before $_SESSION[username] after" // no quotes for the array key "before {$_SESSION["username"]} after" // with quotes. ' or ", {$ or ${(forum's highlighting is wrong for the third but the syntax is correct)
×
×
  • 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.