Jump to content

requinix

Administrators
  • Posts

    15,232
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. If the filename is title + genre + year then you're going to have to identify each piece. The genre will either have to be a single word (so you know the last "word" in the filename was the genre) or one from a specific list, the year is obviously the numbers at the end, and the title would be everything else.
  2. No. Just because you found code posted somewhere on the internet does not make it open source. You can make whatever changes you want but I expect you're going to have a very hard time making it work without using cameratag.com's systems and APIs.
  3. Are you even sure there was a "Titanic" movie in 1990?
  4. If you search for "app-id" in the code you'll see that UUID gets sent to the new_video() function, which makes API calls to www.cameratag.com. Please, please, please, don't go finding Javascript code snippets out there and just copying them into your site without knowing 110% exactly what they do. That's the kind of mistake that results in lawsuits with terms like "monetary damages".
  5. What about the time to maintain this code? There is more than just writing the code and saving the file. What will you do if you have to come back to this file again in the future? What if you need to do another similar AJAX feature somewhere else? Your time to learn this is not a price to pay but an investment in yourself and your employer. Strider64 gave an example of how to do this. AJAX and mod_rewrite are two completely different things.
  6. What "both ways"? Which one? I'm sure it can work, so there's probably something different about your code. Did you check that the HTML works in a regular webpage? What's the rest of the code?
  7. I know what the answer is. It's to wrap your Array in a Proxy. If you don't like that answer then does that mean you want to shop around until you find one you like better?
  8. If you need to use AJAX but don't know how then this would be a good time to learn. Are you using a Javascript framework? If so then see what it offers for AJAX support. If not then you should look into the Fetch API - not XMLHttpRequest, that's mostly obsolete, but the fetch() function and stuff related to it. What you would do is, when someone clicks the button to "submit" the "form", you create a Request with appropriate information (eg, a URL, the POST method, and FormData body), give that to fetch(), and it will give you a Response that you can read from.
  9. If you don't want the page to do anything then use AJAX instead of a <form>. So yes, AJAX can definitely do what you want.
  10. Worry about "clean" and "minimal" once you have stuff that works, first.
  11. You mentioned AJAX in the title so... how about that?
  12. Take a look at Proxy.
  13. On the screen as people are taking the video? I would be very surprised if that was possible. If you need to tell them something, do so on the page before they activate the control.
  14. Once it's installed, sure. But it's not installed by default.
  15. If you need something simple to test a simple site then you can use PHP's built-in server. If you need something more complicated then you're going to have to spend disk space to get it. If you don't need a database then you can install Apache/nginx on its own - if you don't mind configuring them yourself. No? But it is available to install - at least in Pro, not sure about Home.
  16. Apache and PHP do not want to own files. They want to be able to read files, and just like books from a library, they do not have to own the files to be able to read them. For the shared server, you need to find out whether PHP runs as its own user or as your same user account. You must answer this with a webpage, not from a login shell: a webpage that echo exec("whoami"), or uses phpinfo(), or some other method. If PHP runs as the same user as your own account: - All files and directories should be owned by your user account and group - File permissions should be 0640 or 0644 - Directory permissions should be 0750 or 0755 - If you need to support file uploads, nothing special has to be done. Do not use 0777 permissions. If PHP runs as a different user from your own account, such as "www-data": - All files and directories should be owned by your user account and group - File permissions should be 0644 - Directory permissions should be 0755 - If you need to support file uploads: create a special directory for the files (such as "uploads") and set permissions 0777. For your own server, if you want it to have the same website as the shared server then you should make it use the same Apache + PHP setup (mod_php or php-fpm) and with a different user from your regular account (such as "www-data"). Using the same setup is a good way to know that what works on this server will also work on the shared server.
  17. "Won't post" isn't a particularly helpful description. What have you done to troubleshoot this yourself so far? Checked for error messages? Spam folders? Tried using different email accounts, both for sending as well as receiving?
  18. When you log in as a user and then ask the system who you are, it will tell you that you are the user you logged in as. I'm not talking about shell access. I'm talking about PHP when it runs on your website. You have root/sudo access on a shared hosting server? Are you sure it's a shared hosting server? As in there are multiple people with access to the same server your site is on? PHP the application. If your setup uses mod_php then PHP runs as whatever user Apache runs as. If your setup uses php-fpm then PHP runs as whatever user php-fpm is set to run as. That's... not the right thing to do. If you set up the server yourself then you are not, in fact, on a shared hosting server, and therefore most of what I said was a waste of your and my time. And they're right in this situation. And by "right" I mean "wrong". There's basically no reason to put yourself in the www-data group, like, ever. Okay, now I'm confused. Are you running your website on a shared hosting server or not? I don't care about what you're doing locally or on a test server or whatever. I mean, the place where your website is running, is it "shared hosting"? The first guy is wrong. The second guy is mostly right because "you can't even write files to your own server" is partly what you actually want to be the case. Like I said in my first reply, it depends. Primarily on dedicated vs. shared hosting. Just like how the question "how do I put my car in reverse?" sounds really simple but actually has multiple different-but-similar answers.
  19. One is Javascript, one is not. Does what you have now work? Is there anything that says it's obsolete or deprecated? If not then keep using it.
  20. This is a link to the page. The link does not matter once you arrive on that page. If you want to do something with that page then the link to the page is not where you should be focusing your efforts. If the scraping is all done in PHP and there is no output of any kind (or you can remove all of the output already there) then all you have to do is use a header() redirect at the end of the script.
  21. For both questions it depends on the server setup. Even with shared hosting there are multiple approaches. The questions you need answers to are: 1. What user is PHP running as? 2. What group is PHP running as? 3. Do you have a personal "billybob" group too? (Probably.) 4. What other groups do your user account belong to? On shared hosting, it's somewhat common for PHP to run under your own user account. It has exactly the same access to files and directories as you do. It sounds like that is the setup you have. If that's the case then there isn't much point messing around with permissions: you and PHP are the same user so it doesn't matter what group you assign. In fact, it's quite possible that by changing group ownership to www-data you're creating a problem, because if your account is also in the www-data group then that means other users on the server are probably also in the www-data group, and changing group ownership away from your own personal group you've decreased security. But that could easily not be true - I think it would be weird and unlikely that you are a member of www-data, but if you aren't then I don't know how you changed group ownership to it...
  22. What's happening behind the scenes is a matter of 32-bit versus 64-bit integers. You know how everything is 64-bit now, right? That's kinda true. Signed (=capable of representing positive and negative values) 32-bit integers are limited to +/- 2.1 billion. If each of those is 1 second and you start counting from January 1970 then that stops sometime in January 2038. A lot of software is still 32-bit, but less and less each year. Signed 64-bit integers are limited to... well, a very large number in the unfathomably-distant future - which is to say, as far as timestamps are concerned, it's effectively unlimited. Unless you want to try to count sub-second intervals, in which case it's slightly less than but still more or less unlimited. For a simpler example, consider Y2K. If you represent years as just 00-99 then December 1999 ends with you starting January 1900. The best solution to that is to use more digits: four digits means you can tell the difference between 1900 and 2000, just like how with 64-bit numbers you could tell the difference between Jan 1st 1970 (0) and Feb 7th 2106 (2^32). Regarding PHP, it's been 64-bit for a very long time, except on Windows when it's only been available since PHP 7.0 (which most people would also count as "a very long time"). But Y2K38 is still a thing.
  23. PHP won't try to guess your timezone. Tell it explicitly what you want with date.timezone. Like realistically, how often are you moving servers?
  24. No. Using eval is a really bad idea. There are always better solutions to problems than using eval. $num is the only unknown part, right? Look at this: $gm = array( 9 => array( "hodds" => $games[53]["BP"], "aodds" => $games[52]["BP"] ) ); echo $gm[$num]["hodds"]; Really easy.
  25. If you want to submit the form and redirect then you cannot do it with any Javascript or other alterations to the button itself. Has to be PHP. What is the code that handles the form submission?
×
×
  • 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.