Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by requinix

  1. Oh dear. If you've got the money to buy Windows Server Datacenter then you've got the money to hire an IT person whose job it would be to deal with these matters.
  2. Don't use a redirect. Half of the point of a 404 page is that it returns a 404, and using a redirect makes it do something different. Why not just change the 404.php to be this new page? Wouldn't that be easier?
  3. Is your custom 404 page on some other site?
  4. Doesn't quite answer my question. The very first rule you have RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] says that anything that does not exist should go to index.php. If you want other things to apply first, other things that also do not exist, then those rules need to go before it.
  5. What are the rules in that .htaccess going to do if a file doesn't exist?
  6. Oh, this is being used by the other pages too? Add a parameter to the function about whether it should include the post's title at the end, default it to true for convenience, then modify the archive and search pages to pass false instead.
  7. Would that not be the level99.value you're already using at the beginning of the function? For your other question, I don't know the right way of going about the math to find a function that lets you scale from a gradual increase (ie, a line) to a severe curve (like the one generated by the formula I gave earlier). To solve that I suggest seeing what you can find on the internet - anything ranging from straight math to some sort of try-it-out graphing tool; the basic form of the final equation will probably be along the lines of a*e^n + b*n + c.
  8. Working backwards, you can see the breadcrumbs come from $items inside wrap(), which is called by render(). Inside that is a "breadcrumbs" which starts with "categories" and then will prepend the "bloginfo" as well as push (append) the $post. So try removing the bit to do with the push. That line also says "active" so you'll probably want to put that on the last item in the breadcrumb list, but honestly that's probably something better suited for CSS.
  9. If you're going to record all the data, wouldn't it be easier to just make the table mirror the user table and stick the old row in there? Or rather, stick the new row in there, and apply the trigger to INSERTs as well.
  10. So /blog/post-title does not exist as a file, right?
  11. Fix what? A null will be coerced to false.
  12. PHP? There's basically always a home directory set up for each user, though it might not actually exist, but that's a system thing.
  13. On a typical Debian/Ubuntu system, website stuff is at /var/www. There's nothing wrong with putting their home directories in there - tons of system accounts do things like that, just check /etc/passwd. And make sure you've disabled logins for those users.
  14. The original line was $V341be97d = preg_replace('/\^([^\^<])/e', "'`' . \$V70dda5df[ord('\\1') % 8]", $V341be97d); That was updating $V341be97d, on the left-hand side of the = assignment, with a new value coming from preg_replace. Your updated version preg_replace_callback('/\^([^\^<])/', fn($matches) => '`' . $V70dda5df[ord($matches[1]) % 8], $V341be97d); changed the preg_replace into a preg_replace_callback but it lost the $V341be97d= that was there before. Still need it, otherwise whatever this replacement was designed to handle (namely the ^0s and ^7s and such that you're now seeing) won't happen.
  15. $V341be97d = preg_replace('/\^x([a-fA-F0-9]{6})/i', "`#\\1", $V341be97d); preg_replace_callback('/\^([^\^<])/', fn($matches) => '`' . $V70dda5df[ord($matches[1]) % 8], $V341be97d); On that second line you lost the assignment that was on the left of the function. So preg_replace_callback is running but the result isn't going anywhere. (what I posted was meant as only the bit about the function, not to be the whole line)
  16. It's a shame the code is open-source but extremely unreadable... I'll use those two as an example. Moving away from /e goes basically like: 1. Switch the function to preg_replace_callback and drop the /e flag, obviously. 2. Change the second argument (a string) to be a function following the template function($matches) { return ___; } where you put in there the replacement string but minus the outer quotes. 3. Replace "\\1" with $matches[1], "\\2" with $matches[2], and so on, and correct any issues with the PHP syntax. So this preg_replace("/\+([\x01-\x7F])#/e", "chr(ord('\\1') + 127)", $V341be97d) starts as preg_replace_callback("/\+([\x01-\x7F])#/", function($matches) { return chr(ord('\\1') + 127); }, $V341be97d) and you replace the '\\1' string to get preg_replace_callback("/\+([\x01-\x7F])#/", function($matches) { return chr(ord($matches[1]) + 127); }, $V341be97d) What you have now is quite a bit different to the point that it won't actually work correctly. If you're using PHP 7.4 or later, you can simplify the function syntax if you want by using a function shorthand: function(...) { return ... } can be shortened to fn(...) => ... preg_replace_callback("/\+([\x01-\x7F])#/", fn($matches) => chr(ord($matches[1]) + 127), $V341be97d) The second one preg_replace("/#(#|[0-9a-f]{2})/ie", "'\\1' == '#' ? '#' : chr(hexdec('\\1'))", $V341be97d) is similar preg_replace_callback("/#(#|[0-9a-f]{2})/i", function($matches) { return '\\1' == '#' ? '#' : chr(hexdec('\\1')); }, $V341be97d) but has a little more to replace, creating preg_replace_callback("/#(#|[0-9a-f]{2})/i", function($matches) { return $matches[1] == '#' ? '#' : chr(hexdec($matches[1])); }, $V341be97d) or with the PHP 7.4 shorthand, preg_replace_callback("/#(#|[0-9a-f]{2})/i", fn($matches) => $matches[1] == '#' ? '#' : chr(hexdec($matches[1])), $V341be97d) The latest one you're working on preg_replace('/\^([^\^<])/e', "'`' . \$V70dda5df[ord('\\1') % 8]", $V341be97d) goes very much the same way preg_replace_callback('/\^([^\^<])/', function($matches) { return '`' . \$V70dda5df[ord('\\1') % 8]; }, $V341be97d) preg_replace_callback('/\^([^\^<])/', function($matches) { return '`' . \$V70dda5df[ord($matches[1]) % 8]; }, $V341be97d) except it has a wrinkle: it tries to use the $V70dda5df variable. You need to adjust the syntax a bit by removing the backslash (it was needed because the code lived inside a string) but also for the fact that variables aren't accessible inside functions... unless you explicitly tell PHP you want that with a "use" attached to the function. That results in, preg_replace_callback('/\^([^\^<])/', function($matches) use ($V70dda5df) { return '`' . $V70dda5df[ord($matches[1]) % 8]; }, $V341be97d) The thing about variables doesn't apply to shorthand functions, so with PHP 7.4 you could simply write preg_replace_callback('/\^([^\^<])/', fn($matches) => '`' . $V70dda5df[ord($matches[1]) % 8], $V341be97d)
  17. No offense but I've removed the file from your post. It doesn't look like something that's meant to be shared, but it also doesn't need to be to address this particular problem. I don't suppose there's a more up to date version of this script available, right? Because that would be ideal. If not, what did you try? The second argument is essentially PHP code, so you just need to translate that string into normal code and use it with preg_replace_callback...
  18. Simple: don't do the routing in your PHP code. Set up your web server to automatically rewrite /blog/* to /views/blog/page.php?page_slug=*. The term you'll want to research is "URL rewriting"...
  19. I take it that means you don't plan to try to restate your question?
  20. If you're going with an OOP model (and that's a completely separate discussion) then you should continue with it. Typically the Car class will handle any type of search against its data, meaning that there would be a method like Car::getByUser(user id). In addition to that, you can provide a shorthand from the User class to find that - namely, $user->getCars() that obviously can supply the user ID to getByUser automatically.
  21. Does it make sense for the model to have a method related to its data? Does it make sense to do the same thing over and over again? Code belongs in the one, single place (hopefully) that it is most related to. If the name is related to the model then it should be the model that deals with the name. If code is related to the controller, that being the place where you have code to deal with requests and responses and deciding what to render, then that is where it should go. Is finding the most recent user something that relates mostly to the data managed by your model or to process managed by the controller?
  22. Your composer.json says it needs to use PHP ^7.2, meaning 7.2 or 7.3 or 7.4. laravel/passport needs ^7.2 as well. So downgrade your version of PHP to 7.2/7.3/7.4, or update your composer.json and laravel/passport dependency such that you can use PHP 8.1 with it.
  • 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.