Jump to content

requinix

Administrators
  • Posts

    15,045
  • Joined

  • Last visited

  • Days Won

    413

Everything posted by requinix

  1. In the long run, it's easier not to try to have one regex handling a bunch of different possibilities. Just make two separately: one for youtube.com and one for youtu.be.
  2. The gradient runs from a single point in the center. Looking at the edges, the gradient will only be uniform if the container is in a circular shape itself - oval, I think. And even then, at 24px wide, you'll probably be stuck with some variation in gradient when comparing the outer and inner edges. In other words, it sounds like you need a different approach. I suggest keeping it simple: a special SVG that draws lines using your desired gradient, or go old-school and use plain images as in the days before CSS supported fancy borders.
  3. You can't use a gradient as a color. You can apply it as a border-image-source, but that may take some playing around with. But I'm not even entirely sure what effect you're going for, or the overall size/shape of the element you're styling (which will have a huge impact on the appearance of a gradient border). Or else you can just use a second container element, set the gradient as a background on the parent, then add padding to create the border effect.
  4. What's your code to make use of this? It seems like you simply set an alt on your IMGs...
  5. One-liners are great and all, but is it worth all the time you've spent on it so far? A simple foreach loop could have solved the problem hours ago.
  6. Have you considered, perhaps, writing some code to do that?
  7. Then either you didn't have PHP set up at all, and what you were seeing was the unexecuted source, or (I assume) you have some kind of logic like "if (form submitted) { do thing } else { show page }" and you weren't triggering the "form submitted" logic (thus it was returning the regular page instead).
  8. Looks normal... You do Bearer authentication by just including an Authorization header in the request. Like if it was any other header. Was the 500 coming from your own site or from theirs? Presumably yours. A 500 means an error, so if you get that then check the server logs to find out what the error is so you can fix it. If the "HTML source" is of a page on their site then that likely means you were sending an incorrect request and/or to the wrong URL.
  9. If your script is working correctly then there will always be output - except in the case that there was no "register" submitted with the form. So first thing is to check that. Otherwise you'll have some sort of error. Make sure your php.ini is set up appropriately for a development environment by ensuring it has these two settings: display_errors = on error_reporting = -1 (like at the bottom) and then restart PHP/the server/whatever you're using. You should then end up with a not-blank page...
  10. 1. Thank you for posting your reCAPTCHA secret to a public forum. Please cancel it and generate a new one immediately. And then don't publish it anywhere. 2. The URL you're constructing has two problems, but they're irrelevant because: 3. Per the documentation, you need to send a POST request to /siteverify. Not a GET request. Which typically means using cURL. If you still have problems, remember to post your updated code.
  11. Is it possible you're not aware that foreach can give you both the keys and the values? That said, you shouldn't be going through every single entry in $_POST without verifying that it's good to add to your SQL. Really, you should be starting with the list of columns you want to support and then looking in $_POST to see what each one's value is.
  12. It'll be finding two versions because you do have two versions: it can't tell that the index.php one is "the homepage" and you're (I assume) using URL rewriting in the backend to map / to /index.php?route=common/home. Redirects are the answer, however they have to be very carefully done: redirect from the ?route= thing if that was the actual URL requested. Because if you don't have that little condition at the end, your server will redirect back and forth between them. How are your redirects set up now?
  13. Sounds like the preprocessing you're doing on your data, namely the $results array, doesn't suit your needs. Take a sample of your data and write it directly into your code, putting it into an array format that you can work with. Toy around with it until you get something that works. Then pull that stuff out and write code to generate the array from $data. Advice: it's totally okay to have something more complicated than a plain 3D array. array( some info here, sub data => array( maybe more info here, sub data => array( stuff ) ) )
  14. How about some details? How was it created? On what schedule? What do you mean by "afterwards"?
  15. That's correct: an ID will only ever refer to one element on the page, so using it for multiple elements is always incorrect. There's a simple solution for you here. Wrap the NOW PLAYING and the button (both) in a container element, then when the button is clicked, have it locate the container and then find the desired element to copy inside of it. IIRC: <div class="copy-container"> <div class="copy-target">NOW PLAYING: Something</div> <button class="copy-button">COPY</button> </div> <script> document .querySelectorAll(".copy-container") .forEach(container => { const target = container.querySelector(".copy-target"); const button = container.querySelector("btn.copy-button"); button.addEventListener("click", () => { copyToClipboard(target); }); }); </script> And please don't implement clipboard functions like that - use the actual Clipboard API instead.
  16. Moved. That is typically why people install Apache, or bundles like WAMP and XAMPP. First piece of advice is that generating HTML files is probably the wrong way to do this. How about some more information? What is it you're developing? What are these text files and HTML files?
  17. Code your bot as a system service, as in something that runs on system startup and probably has a dependency or two (such as networking). Doing that also means the system can monitor the process and restart it if it fails. Yes, that means you need to spend a bit of time learning what those are and how they work, though that shouldn't take long. The only difference between a "normal" service and your bot's service is that the command to run your bot looks like "/usr/bin/php /path/to/your/bot.php".
  18. A <tr> is a table row. A <td> is a table cell. If you want one row with multiple cells then you need one <tr> and multiple <td>s.
  19. That's floating-point arithmetic: the computer can't calculate 573.06 * 100 exactly so it comes up with something close. Something like 57305.9999999999986. And if you truncate that, like with an int cast, then you'll just get 57305. In other cases it might come up with 57306.00000000000005. The solution is super simple: round the number instead of truncating it. function convertToMoneyInteger($input) { return round($input * 100); } Be careful that your $input is never going to have fractional cents or you'll lose them by rounding to 0 digits. If you're concerned that might be possible, round to an appropriate number of decimal places.
  20. Tip: if you want to use programming to make your work easier, you should try considering yourself a programmer. So, what have you tried to do so far?
  21. 1. What have you tried so far? 2. Are you aware that PHP has a variety of DNS functions already?
  22. It's not possible to book a particular seat in the theater. (Most likely.) Instead, one has to book a particular seat in the theater for a particular screening. Thus the status must be associated with something that has both of those pieces of data. You don't have such an entity... basically. You could build one by creating a "screening_seat" table, consisting of a screening_id and seat_id. Rows could be created on-demand, removing the need to pre-populate that table when a screening is created. You would then adapt the booking_details to reference that screening_seat instead. However, if the status is a simple boolean "booked / not booked" then you don't need to store it because it can be inferred from the existence of a booking for a seat. In other words, with the current design, if there is a booking_details with seat_id = $seat and booking.screening_id = $screening then the seat is considered booked, and if not then the seat is considered free.
  23. You've posted bits and pieces. If there's nothing more to it and you've shown us everything then the answer is simple: you can't call PHP functions from Javascript like that. But I suspect you haven't posted everything. Please do.
  24. As mentioned on Discord, if you want wincache because it can cache PHP code, then use opcache instead: it does the same thing, except it's part of the PHP core instead of being some third-party, Windows-only extension.
×
×
  • 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.