Jump to content

requinix

Administrators
  • Posts

    15,290
  • Joined

  • Last visited

  • Days Won

    436

Everything posted by requinix

  1. A responder sends a response.
  2. So the result you're trying to get for those 5 rows of data is one row with cust_id=126 inc_due=0? Does the inc_amount matter? Do you have a larger example?
  3. Fortunately it looks like you know that you need strtotime(), although you went for date() as well. Unfortunately it looks like you threw them together into some mismash thinking it might work. strtotime() takes a date string and converts it into a number. Numbers are nice for comparisons. date() takes a number and converts it into a date string. Strings aren't nice for comparison. Since numbers will be better than strings, what you need is to get a number for the publication date and a number for what was a month ago, then to compare the two.
  4. If you want to display more than one thing then you're going to need a loop: fetch a row from the result, display the row, fetch another row, display it, and so on until you run out of rows.
  5. Could be, sure. WP does have more than its fair share of problems. Wouldn't be surprised.
  6. They're checking your website for vulnerabilities they can exploit. Make sure yours doesn't, then you can more or less ignore it.
  7. You're using a library to manage the carousel. Check if your browser is reporting any Javascript errors that would explain why it isn't working.
  8. If you know that AJAX is a weakness of yours then why not try to do something about it? Can't keep running away from it forever. It's not actually that difficult - not nearly as difficult as it was 10 years ago. From the Javascript side you can use a library (if you have one already) or not, and on the PHP side you do pretty much the same stuff you would always do.
  9. Standard practice in this situation is to use AJAX to send the login information in the background, keeping the dialog open, and if the login failed then present the error message immediately. The user never has to leave the page (until they log in successfully). Your PHP script looks mostly the same except it returns JSON that includes whether the login worked or an error message if it did not, instead of redirecting or outputting HTML. Your Javascript receives that JSON and acts accordingly.
  10. As long as you have a few specific questions that can't be easily answered through documentation or a search engine. The only thing it "means" is that the name inside the %{...} is a variable. What variables you have available are listed in the documentation. There's basically no reason to write 80 or 443. Those are port numbers. What you should be caring about is whether the request is HTTPS or not. Not necessarily. Some practices are outdated, some are harder to read and understand than others, some are dumb, and occasionally some are wrong. But the main criteria for deciding which to use is "does it do what you need it to do". Are you trying to tell me that if you put "htaccess regex tutorial" into Google you won't find anything relevant? Before you answer, consider that I am bothering to spend the time writing this sentence to refute your statement. If it takes you "a full 8 hour day" to learn what %{HTTP_HOST} means then I'm not sure anyone can help you. Maybe the problem is that you're not learning in an efficient way? Memorizing "percent sign then opening brace then HTTP_HOST then closing brace means it uses the HTTP_HOST variable" is going to waste a lot of brain cells if you have to repeat that for every single variable available. Yes, that's right. You know how in SQL there are database names and table names and column names and all that? You know how you can quote them, but don't actually need to unless the name is a special keyword or has some unexpected symbol in it? Same for Apache's configuration files. Quotes are mostly about when you need to write something that has a space. The quotes make sure the whole thing gets treated as a single value instead of multiple values. If you don't have spaces then you don't need quotes. I'm sorry you feel that way but 99% of the programming world does not work like that. And there should be a single year of school where teachers tell me everything I need to know about life. And there should be a single driver's ed. class that tells me everything I need to know about driving vehicles. And there should be a single politician who manages everything about a country. But there isn't. Because stuff is complicated and it can't all be covered in one place at one time. Typically people understand this concept early in life and then learn how to get information from multiple sources to ensure you're getting everything you need. (Unless you're American.) If you keep looking for a single resource that answers all your questions then you're not going to find one. Learn what you can from where you can then move on to the next one, and keep doing that until you don't have any more questions. That's true. Which is why you can't learn everything about mod_rewrite in one place. You need to learn regular expressions and understand a bit about Apache's configuration files and learn to a reasonable degree how mod_rewrite works and know how to test and troubleshoot what you've done if there's a mistake. The good news is that you're not expected to pick this all up immediately. Learning takes time. The bad news is that nobody can learn this stuff for you.
  11. No, benanamen's code will not result in the same error. Try again.
  12. ...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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. In the $hue calculations? The first branch handles the $delta=0 case.
  20. You mean when $delta === 0?
  21. $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.
  22. So what's your question?
  23. 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.
  24. 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.
×
×
  • 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.