Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. You account for trailing slashes in the request URI only. You'll test with and without the slash, but the map only has the one version. Which is fine as long as you think about which version... Your function does not account for two important things: the request URI starting with the path (and not being only the path), and a potential query string. Slash problem aside, /shop/foo and /shop?bar will both fail to redirect.
  2. Not PHP documentation. I mean what documentation for the Java socket itself do you have? Is there a specification for sending and receiving messages?
  3. The redirect is configured for /shop/. With the trailing slash. Do you really have to do this with PHP? Setting up the redirect with the web server is almost definitely going to be better, and faster, and more efficient, and even simpler. I say this not just because your redirect function there isn't quite correct.
  4. Side note: glob() returns the path to each file according to the pattern you gave it. So all those filenames will look like /path/to/directory/foo.txt. What the client (C++) needs to know is the URL to hit on the server; if every file is in the same directory (which it sounds like it is) then you can get just the file names with basename(). Since you're working from C++, and by the way this is all something doable scriptable a shell and without the use of a compiled program, you'll want to make this all as simple as possible. The server should return just a plaintext list of filenames. You can read each line, get the filename, then download the file. <?php header("Content-Type: text/plain"); foreach (glob("/path/to/directory/*.txt") as $path) { echo basename($path), "\n"; } You still have the problem of having to send an HTTP request to the server and reading the response...
  5. I think that was ginerjm is trying to say is that this may not be the easiest thing in the world for you, but even though there are some people here who don't know stuff like jQuery very well, I know we can help you out in one way or another. I'm sure he wasn't trying to gate-keep the world of software development and say that you had to give up. Right, ginerjm? What I mean is that we don't know anything about your code short of what you can post here and tell us about. As people who have never seen it before, you automatically know more about it (as a whole) than we do. It's not exactly like we can just jump right into the middle of all this and tell you exactly what needs to happen. It's good to know it works somewhere, but if you need help getting it to work someplace it does not then it'd be more helpful if we knew more about that, right? The PHP code is simple enough so any problem is likely to be with the Javascript side. Any errors in the browser console? And the general troubleshooting questions apply: what is it supposed to be doing and what is it actually doing?
  6. So they're... uploaded? Using the site or FTP? Or are created directly on the server? I'm looking for a specific answer here because your requirement to delete the file depends partly on the files and how they get there.
  7. How are the files getting onto the server in the first place?
  8. a) If they say it works but it doesn't function then it doesn't work b) How is it broken? This isn't our code, we can't see it on the site, we don't know anything other than the few bits you've posted.
  9. What documentation do you have for using the connection?
  10. No, you can't get those two either. The MAC address is only available at a very low level in the system and it only tells you the hardware on the other end of the ethernet cable. The computer name is not something that gets sent over the internet.
  11. Make sure there is no whitespace before the opening <?php. Absolutely nothing at all. If you're sure you've removed everything, make sure your editor is not saving files in UTF-8 with BOM format. UTF-8 is fine. BOM is not.
  12. Licensing in this sort of situation is often handled by restricting how many user accounts can be active at once. Assuming your application deals with user accounts, of course. Another scheme is to restrict or limit how much data can be read in the database. You don't stop storing information, you just don't let people access all of it. Like, only showing the most recent. Related to that, you can also limit access to a resource. A fixed number of page views per day, or a number of downloads per assets, or total downloads, or something like that. And of course there's the most obvious one: to limit what features are available to use. Especially suited to complex applications that have a lot to offer.
  13. You want to know if the server can download an EXE to the user's computer and run it, without them knowing? Think about what you're asking. I'm sure you can come up with the correct answer.
  14. It could be a settings problem, sure, but it could just as easily not be a settings problem. Add error_reporting(-1); ini_set("display_errors", true); at the top of the file and see what happens.
  15. Okay, that's what I thought. You cannot read registry settings from the client browsing the website. You can only access the registry from the server PHP is itself running on. And obviously only if it's a Windows machine.
  16. Okay, let's go back a step. Who will own the server that this code will be running on? The client? Is it their server? Or is the code hosted somewhere the client cannot control and they use their browser (or some other means) to access/use/whatever it?
  17. Keep in mind that PHP code is open-source, so if somebody wanted to circumvent your registry key licensing checks, they could do it really easily. Like, in the time it takes me to microwave last night's leftovers. win32std It looks pretty old, though, so you might have to find an alternative. Like a shell command.
  18. Go with the second code. So you have that code in a place that receives the form data and (tries to) output the file. What's the code for the entire script?
  19. And exactly who is the "client" here? Are they the one running this PHP code? Or are they browsing the website or whatever?
  20. What's the code to generate the file?
  21. Okay. Are you still getting the undefined index warning from that details.php?id=20597 page?
  22. Perhaps you've been looking at this for too long and so can't see it. class, equals sign, single quote, the various classes, single quote Your first change to href was: single quote, href, equals sign, the URL, single quote Compare where the quotes were. Your second attempt was the same except you put in double quotes, something which the class attribute was not using, which is no more correct than it was with single quotes except the double quotes conflict with the ones you were using in PHP. One more time. And then, after you've clicked then link, tell me what the URL in the address bar is.
  23. Take another look at how the class attribute is set up.
  24. Do you see how the quotes work with the class attribute? That's the correct usage. Compare with what you did for the href... Can't get values from the URL if there are no values in the URL. Have you been clicking the Details links?
×
×
  • 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.