Jump to content

requinix

Administrators
  • Content Count

    12,420
  • Joined

  • Last visited

  • Days Won

    270

Everything posted by requinix

  1. No, benanamen's code will not result in the same error. Try again.
  2. ...Yes. You know how you have your RewriteRule that sends a particular URL pattern to index.php? You do not have one for the new URL pattern. That means it won't go to index.php. And PHP cannot do anything if it doesn't get the request. You don't need any PHP for this. All you need is a new RewriteRule for the new URL, and it can still use your index.php with controller and action and id by simply specifying a default value for the one that's missing.
  3. I've used barryvdh/laravel-dompdf before and I was pleased with it. But don't go into this thinking you can use the latest HTML and CSS standards. PDFs do not work like webpages. You may have to resort to using older styles of markup and formatting.
  4. You cannot change the RewriteRule and also not change it šŸ˜‰ If you want to support /shareboard/login -> controller=shareboard, action=users, id=login, then add a new RewriteRule to do that. That's all it takes. Because it's okay to have more than one of these as long as they match different URL patterns. When you do that, please clean them up so less stuff is optional. Because you have a problem with being too flexible on what you're matching. Try going to some invalid URLs and see what happens.
  5. I feel like I should let you know: if I ever see you call me out in your threads, I do not reply to them.
  6. Yes: the mod_rewrite documentation and any place that explains regular expressions. You're then expected to take all the knowledge you learn and apply it towards whatever ends. I can provide you with links to Google, if you'd like.
  7. The documentation for mod_rewrite does explain what %{} means. ^ is not part of mod_rewrite per se but part of the syntax for regular expressions.
  8. 1. Read the documentation for whatever directives you want to use. 2. The term you are looking for is "regular expression". There are many places where you can learn about them.
  9. In the $hue calculations? The first branch handles the $delta=0 case.
  10. $lightness = (($cmax + $cmin) / 2) * 100; $saturation = $delta === 0 ? 0 : ($delta / (1 - abs(2 * $lightness - 1))) * 100; You're multiplying the lightness by 100 too early. This throws off the saturation calculation. Leave it as $cmax+$cmin/2 and multiply when you do the round() later.
  11. You know how if you put numbers in a query string, like ?value=123, and you try to get it in $_GET, the value is a string? Same thing. But what you're doing to total these numbers is... silly. Why are you putting these things into an array? Using Array.reduce? All you need is simple addition. You way overthought it.
  12. First thing to do is read the documentation to understand what you will be working with: PDO's prepared statements If you're still not sure how to use them, there are plenty of resources on the internet about it.
  13. You cannot take down the post, and even though I could it's already too late to stop people from seeing it. Whether you're vulnerable or not depends on how checkInput() works. But that aside, you should do what gw1500se suggested: change your code to use PDO or mysqli, which both support prepared statements that will get rid of the SQL injection problems.
  14. I already did. I specifically said it shouldn't go there.
  15. What you're describing makes me nervous, but yes: you probably should put that block (which doesn't need the Directory) inside your website configuration's VirtualHost.
  16. That's why you would need that table subquery: to break your set of desired departments into single values. Then you can FIND_IN_SET each of those values inside the dept_code list.
  17. SELECT... FROM... JOIN ( SELECT 1 UNION SELECT 2 UNION SELECT 3 ) AS not_an_actual_table There's a term for that subquery but I don't remember what it is.
  18. And I agree that conf-available is not the right place for your RewriteRules. But you shouldn't be creating a new file in sites-available either and for basically the same reason: if you look through sites-available you'll find websites, and your RewriteRules are not websites. But they are used for a website, so put them in your site's configuration. As in inside the VirtualHost block. Alternatively, you could put the rules in a separate file somewhere (like within your application) and include it from inside the site configuration.
  19. If you were using mysql_* functions before then you need to use mysqli_* functions now. They are very similar. Check the documentation because it is not just a matter of adding 'i's to the function names. Otherwise the easiest way to find out what you need to change is to test the site locally on PHP 7 and see what happens. PHP 5.6 to 7.4 isn't a huge set of changes, but there are a number of differences that aren't necessarily easy to spot. Also check the migration guides. Each guide between 5.6 and 7.4.
  20. Take a look at the things in conf-available and see if your custom directives seem to fit in with what's there.
  21. Honestly I don't quite follow exactly what's going on, but if all you need to do is cut off the hours at 20 then I'd think you should simply check the updated $sum and do a bit of math if it's above $horas.
  22. I suspect there's a cleaner way, but the only thing I can think of now is to turn those department IDs into a fake JOINed table (using a SELECT 1 UNION SELECT 2 UNION... chain, or VALUES), then use FIND_IN_SET.
  23. Don't put multiple pieces of data (multiple departments) into one field (dept_code). The correct way to deal with that sort of situation is to create a new table where each row contains (1) the user and (2) one of their departments. Most people will have only one row in the table but some will have more.
×
×
  • 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.