Jump to content
#StayAtHome ×


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by requinix

  1. - A role is a user. - Easy mode: a database is a database, ignore schemas and just use "public". - Don't worry about clusters. - Ownership is... ownership. I mean, it's the same thing that it means in English. Owning. - Apache and php-fpm can run as different users, if you want. - No, roles don't need to have database with their name. It's just easy that way. - You can't create a database and give ownership to somebody your role isn't associated with. Use the postgres user to create the michael database, owner michael. Then reconnect as michael and do whatever you want.
  2. Remember what I said about using a form? Use a form.
  3. I'm not sure I followed that question but I think the right reply is something like "if you enter 3-15-2020 as the date then what is the time?"
  4. If the database is on the local machine then you should use peer authentication. When something connects locally, PostgreSQL will ask the system for the username on the connecting end. That'll be your php-fpm pool user. It then allows a connection to the database by that name. IIRC, 1. Use a different user than "postgres". Create a new system user and update your php-fpm pool to use that username (which should mean creating a new pool if you have more than one site running). Restart, obviously. 2. With PostgreSQL, set up authentication for that new user. 3. Create a matching database and move all your data into it. Be careful about ownerships. 4. Update your PDO connection: no host so it connects locally, and drop the username (it's automatic) and password (not used).
  5. ... What is the HTML outputted, both when it didn't work and after your change that made it work?
  6. The code could use some improvement but it should work. Have you done a View Source of the page to make sure the HTML being outputted is correct? Does "cannot get it right" mean anything more than just the checkbox remaining unchecked?
  7. You know what would be even better than that? Not storing the duration. Like Barand said, you don't have to bother storing it and then worrying about what to do when values change when you can just call TIMEDIFF whenever you need it.
  8. TIMEDIFF returns a time string, not a number. If you need a number then try TIMESTAMPDIFF.
  9. 1. As far as I can tell, the "rules" is supposed to be a string - not an object. If you didn't need to account for is_page_loaded then you should say <validation-provider ... rules="required|positive_price"> 2. The validation function needs to return true or false. You are returning string or false.
  10. requinix

    CSS with PHP

    They aren't the same width because you don't have any sort of CSS in there that says anything about a width. It's not like the browser can read your mind about how you want it to appear... Have you tried giving the buttons a width?
  11. Hopefully you being new means you didn't write that code. Right? Because it's... not good. How about some information about this thing? What it's used for? Where? I ask because the problem it's trying to solve is much, much better addressed in other ways - other industry-standard, best practice sort of ways - and I want to know whether it'll be a bother to change it.
  12. Trying my best to not sound flippant, Have you tried Google?
  13. Their own documentation lists a couple jsfiddles. Have you looked at them?
  14. 302 is a temporary redirect that is not supposed to be cached unless the server says it can be cached. Make sure that redirect - the one from nginx - isn't also sending caching headers.
  15. SMS/phone and email are not as secure as everyone thinks. Use OTP codes.
  16. Unless you want to penny-pinch your users out of individual hours, dates are easier. Which one makes more sense to you? Decide now. Don't ask. Decide. Here's a question: does it actually matter? Think about it.
  17. Hmm. <script> $(document).ready(function(){ setInterval(function(){ $("#order-no").load(window.location.href + " #order-no" ); $("#date").load(window.location.href + " #date" ); $("#ip").load(window.location.href + " #ip" ); $("#country").load(window.location.href + " #country" ); $("#payment-type").load(window.location.href + " #payment-type" ); $("#progress").load(window.location.href + " #progress" ); $("#delivery-options").load(window.location.href + " #delivery-options" ); $("#cart-locked").load(window.location.href + " #cart-locked" ); $("#total-price").load(window.location.href + " #total-price" ); }, 3000); }); </script> What you're doing here is requesting the page you're currently on from the server 9 times every 3 seconds. What's worse, you get the entire page every single time, and then jQuery will disregard everything except for whatever tiny portion of it you wanted to keep. The whole process is incredibly wasteful. If you're going to do this, do it right: use AJAX and JSON to get (1) all of the data (2) at the same time (3) without tons of wasted bytes. You make/update your PHP script so that it is capable of returning a JSON object with the order number, date, IP, blah blah blah, keeping in mind that you only need to return data that may actually change. Then use your setInterval to get that data, pull out the bits of it, and update the elements on the page. For those elements, please don't construct complicated IDs that force you to do starts-with/ends-with-type matching. It's just so much of a hassle. Put a particular ID on a container element, then use classes or data attributes on the individual elements inside it. <div id="order-123"> <span data-field="order-no">...</span> $("#order-" + ordernumber).find("[data-field]").each(function() { var field = $(this).attr("data-field"); $(this).text(orderdata[field]); });
  18. The basic process is, if you want literal backslashes in a regex then you need to double it to make PCRE happy, then double it again to make PHP happy.
  19. Either you did not follow the instructions correctly and you extracted the files to the wrong place, or the instructions are wrong and you need to contact whoever wrote them to fix them. Beyond that, I told you what to do.
  20. regex101.com doesn't know that you're trying to put the regex into a PHP string. Escape the backslashes.
  21. MariaDB is just an alternate version of MySQL. Use PDO and pdo_mysql.
  22. You didn't describe the problem, but I would expect it has something to do with logging in never working. Because of passwords. register() needs to stored the (hashed) password in the user file. It's currently storing the hash of an empty string. Then login() needs to use password_verify to check the inputted password against the hash.
  • 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.