Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. 555 for files means readable (which is good) and executable (which is not). 555 for directories means readable (which is good) and browseable (which is also good). In general, files should be 0644 (writable by your account, readable by anyone else) and directories should be 0755 (writable by your account, readable and browseable by anyone else). In reality, it depends on the server setup.
  2. That's fine, but a product and a subscription are not the same thing. You treat one differently than the other, not just internally but with the user experience too. And that distinction matters. But I take back what I said earlier. It's okay to add products things within checkout.php. It makes sense as a single click operation: user wants thing, doesn't want anything more, goes to checkout which also adds that thing to the cart. If you want. You're comparing apples and oranges. The database is the "source of truth" regarding what is currently in the shopping cart. It is not the source of truth for how things get into that cart. That is not at all what they mean. You know how variables defined outside a function are not available inside a function? The $_GET and $_POST (and other) superglobals do not have that restriction. There should never be any sending of POST data between your own PHP scripts.
  3. I don't recommend using the checkout page as a way to add any product. Don't misunderstand: I'm not saying this subscription business should go in the checkout page. I'm saying it can go there - for your own ease of use. (The alternative is having an AJAX-y way of adding products, then when that request completes the button navigates to the checkout page.) What I would do is have the checkout page support adding a subscription product specifically. You can POST to it the subscription ID, then it adds the subscription to the cart if there isn't already a subscription in there. More or less, yes. It would submit the contents of the form to checkout.php instead of to the current URL. Before you continue, you should probably familiarize yourself with HTML forms and how they interact with the server. That's some rather important knowledge to have.
  4. Okay, so then you need to check two ranges: 1. Existing logic, except you base the new start date as coming after the gap end instead of after the fill start. 2. Mostly the same logic, except (a) you determine the new end based on the gap start, then (b) adjust the new start according to the new end. Then decide which of those two new ranges you want to use.
  5. Having your checkout page support form data to add the offer does kinda make sense. You can do that. If you have a page listing your subscription(s) then surely you have something to go with it like a subscription ID? Pass that to the checkout page. POST would be better since you're talking about something that modifies data.
  6. You've posted quite a bit of code. How about you now post a description of the problem, including what you want to see happen and what is actually happening?
  7. That's the only sound I know of that it could be playing...
  8. That does sound relevant. Until it's fixed, you can turn off IPB's sounds through notification settings. Not sure exactly how it plays sounds - best guess being a temporary <audio> - but I think the "stream" term is a misnomer and it's more about the audio resource itself not releasing a sleep lock.
  9. -vcodec copy That says to copy the existing video to the output. You need to re-encode the video as VP8.
  10. Windows 10 1909 here. I have sleep disabled (desktop computer) and powercfg says nothing is happening. I normally have Chrome with the tab open, however most of the time the tab is in the background so eventually the forum stops polling for notifications (indicated by the pause ⏸ in the page title). And I do have desktop notifications enabled. Obviously IPB itself can't tell your computer to not go to sleep... What are your "advanced" power settings? Specifically under the Multimedia group. Here's mine:
  11. Still looks right to me: - Start date = fill's start date (Wednesday 12pm) moved foward to the gap's start (Wednesday 1am) = a week later - End date = new fill's start date (Wednesday 1am) copied forward to the gap's end (Friday 4am) = 2 days later What was the result supposed to be, and why? 3v4l groups by output. Your code uses random numbers and current timestamps so the output from each run will be different. Protip: don't do that.
  12. Looks right to me. https://3v4l.org/UJJfa You don't. 3v4l is meant for testing code across multiple versions. My code uses mutable DateTime objects. If you have to use immutable objects then the code needs to care about return values.
  13. You'll have a database table that contains, at a minimum, (1) some identifier, (2) content, and apparently (3) some "answer to the issue". Right? Link to the page using the identifier, which could (and probably should) be a rewritten URL, then use the identifier to pull the content and whatever. I'm not really sure why there's a question here.
  14. What's the HTML you're trying to render?
  15. ...which it has to do by reading the file. That's the important part. "Working directory". AKA current working directory (cwd). Both of those paths should mean the same thing. What is the code for actually reading the file?
  16. What are the current "webm_encoding_options" settings that the conversion script is using?
  17. Depends what Config is doing with the file path. Probably something simple, like file_get_contents()? Relative paths for plain file access (so not using include/require) are according to the current working directory. From the CLI that's where you were when you started PHP, while for web things it could be the web root or the directory of the executed file or something else. If the config/config.json path is always relative to the same /path/to/my location then you could add that to Config, along the lines of public function __construct($path) { if (strncmp($path, "/", 1) == 0) { // absolute path } else if (!empty($_SERVER["DOCUMENT_ROOT"])) { $path = $_SERVER["DOCUMENT_ROOT"] . "/" . $path; } else { // relative to cwd $path = getcwd() . "/" . $path; } Using a relative path based on __DIR__ might be easier, as in __DIR__/../$path.
  18. It's not so much against forum rules as it is just Not A Nice Thing To Do. The key things to note with it are: 1. The fact that it gets information from $_POST and $_COOKIE. Malicious scripts don't do one single thing anymore - they take instructions sent to them from a person or another machine. 2. That it can output phpversion() data. So someone can see your server configuration. 3. The is_writable() checks and file_put_contents() function calls with ".php" file extensions. It's designed to write arbitrary code to whatever files on your server.
  19. Please don't post malicious code in a public forum. You cannot simply "undo" the attack. There's no way to know the full extent of the damage. Assume that everything has been compromised. Take your website offline. Restore all the files from a recent backup (which you hopefully have), restore the database from a recent backup (ditto), then make sure you are up to date with WordPress and your plugins and everything else. Then bring your site back up and keep a very close eye on it for the next few weeks. Ideally, you can identify the attack vector: an outdated plugin, insecure permissions, something like that. Then make sure that is closed off. If your site has user registration or people's personal information, such as an email address or password, then you need to deal with that too. Which needs to include informing users of the breach.
  20. You saw the link I posted, right? That's most of the way there. 1. Calculate the correct new starting date and time. 2. Get the diff between the gap, in days, then subtract 1 from it. Measured in days because having exact weekdays is important, and a little short so that it's definitely going to be the day before the desired time. 3. Add that many days to the new start, then do the next weekday/time thing. PHP will handle the rest. https://3v4l.org/7JDgp The two things to keep in mind: working with periods defined in terms of month units or larger sucks so don't try, and DST really needs to go away once and for all.
  21. Not all WEBMs are created equal. Codecs matter. That's what I've been trying to tell you.
  22. Almost thought I understood: fillStart 2019-07-23 00:15:00 Tue fillEnd 2019-09-23 13:00:00 Mon gapStart 2019-05-23 00:15:00 Thu gapEnd 2019-06-23 13:00:00 Sun fillStartModified 2019-07-25 00:15:00 Thu fillEndModified 2019-08-25 13:00:00 Sun "fill" is the date range you're working with, and "gap" is a start and end whose weekday numbers and times (aka "WeekDayTimes") should be copied. You need to move the fill's start date forwards the least amount of time (ie, "to the next") such that it has the same weekday number and time as the "gap" start; same for the fill's end date except it goes backwards. That would explain how 07-23 00:15 becomes 07-25 00:15 (moved forwards "to the next" Thu 00:15) but not how 09-23 13:00 moved back almost a month to 08-25 13:00. PS: https://3v4l.org/0lBR6
  23. This is likely due to one or more CSS rules. Would have to see those to know what's wrong.
  24. First step is for you to learn how to indent your code properly. I'm not entirely sure but I suspect your problem will become apparent if you do this.
  25. Is it the same set of information for everyone? Definitely do not do this. No offense, but it doesn't sound like you understand what databases do or how they work. Thing is, you would never actually do that. You would run a SELECT query with a WHERE clause. And the system will be able to pull up the information far more efficiently than you could if you tried to do it yourself.
×
×
  • 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.