Jump to content

requinix

Administrators
  • Posts

    15,066
  • Joined

  • Last visited

  • Days Won

    414

Everything posted by requinix

  1. Passwords never go in cookies. Never ever. Not encrypted, not hashed, not any way whatsoever. Now what are you talking about, putting passwords in cookies? What is this for?
  2. CSV is the right first step. If you only need to show the information there, not do any sophisticated searching or make any modifications, and as long as there isn't "too much" data, then you can keep it as the CSV file and display it using PHP code. Otherwise your best bet is, yes, to import it into a database. That also raises the question of whether the spreadsheet changes and, if so, how often and how you want to deal with updating the database. If you do think the first option is appropriate, consider whether you'll ever possibly want to do more in the future. If there's a chance then you should do the database thing now.
  3. (obligatory disclaimer about getting business/legal/finance advice on the internet) To lower transaction fees, often these kinds of things are done in bulk. Meaning when you take money from the user, you don't immediately transfer it to the (let's just say) hotel. Instead you keep records and then periodically, like monthly, settle accounts. Bookings likely require use of some sort of API so that you can find out about available rooms and provide reservations.
  4. What's the code you're using? What happens when you run it? Exactly what does "can't send any email" mean? Do you get any errors? Is your code even checking for errors?
  5. Use pathinfo to get the extension. Remember that the extension may not be entirely lowercase. You can omit the directory portion of the filename by using basename. Also check that the filename is a file, which will make sure the file exists and block any attempt to delete directories like . or .. (which would fail anyways).
  6. Do the authentication before accepting the file upload, then confirm they're still authenticated when actually accepting the upload. Authentication at the time of an upload isn't a great idea because (a) the user has to wait for the upload before they'll get the authentication dialog, and thus (b) if they fail authentication, such as by mistyping their password, then they have to go through the upload process another time. For the new tab, the simplest thing would be to point the form to a new page (target=_blank) and have the output of the upload script be the "source of the file" or whatever.
  7. 1. What does the error log say about the 500 error? 2. If you use the [R] flag I mentioned, where does your browser get redirected to? If there is a loop then you might not see it and have to look at the server's response headers to find out.
  8. The name is "list[]". Am I missing something?
  9. You shouldn't assign to an on* event handler directly as it only allows you to use one handler per element per event (using that method). Use event registration instead. There are browser differences so it's easier to do with a Javascript framework, but if you want to do it manually then you use element.addEventListener or element.attachEvent. // a quick and simple helper function function registerEventListener(element, event, handler) { // IE9+ and other browsers if (element.addEventListener) { element.addEventListener(event, handler); } // IE<9 else if (element.attachEvent) { element.attachEvent("on" + event, function() { // in here, this != element handler.call(element, window.event); }); } } registerEventListener(document, "keydown", function(e) { // e is already normalized to the event object var key = e.keyCode || e.charCode; // ... });Note that key has the var keyword too. Without it you create/assign properties on the global (ie, window) object, and that creates clutter, and clutter is bad. For the second question, for printable characters, keydown will repeat as long as the key is held down. Which you've discovered. If you want to do something once then you want to do it the first time the keydown event happens, and then reset when the keyup happens. (function() { // separate scope for this variable var once = false; registerEventListener(document, "keydown", function(e) { if (once) return; once = true; // ... }); registerEventListener(document, "keyup", function() { // reset once = false; }); })();That may be a little finicky if you try multiple keys at once.
  10. Backslash. Or use different quotes for the string. 'Ryan O\'neill' "Ryan O'neill"
  11. Is it as simple (in your case) as saying "remove all the whitespace between a > and
  12. How many images will you need? Like a dozen or so, or many more? Will you ever want to change them (either the images or the times) and if so how often?
  13. Caching does not happen by default - only if something on your server told the browser to cache the content. Versioning isn't really that great of a solution, given that there are others which can cause caching to happen the way you want, and more suited for when you don't have control over the server sending the content (like a CDN). What are the response headers for a page on your site that gets cached? Your browser might have something built-in to see them, or you may need an extension. Caching headers include Last-Modified, ETag, Expires, Cache-Control, and Pragma.
  14. There's a newline at the end of the file. How you deal with that is up to you: remove the newline, trim() it off, use a different function than fread() which stops at newlines, use file_get_contents() and avoid the whole file opening thing though you'll still have the newline...
  15. 0xc000007b is generally a problem of mixing 32- and 64-bit applications with DLLs. Are you sure you downloaded the right files and extensions?
  16. Well then, if that's your code: 1. You're missing an opening <?php tag 2. $prog is undefined 3. $fd is undefined 4. $pipes is undefined 5. $ldir is undefined 6. You don't do anything with $proc I'm not asking for a single line of code where you think the problem is. I'm asking for ALL of your code.
  17. What's your code? That should not block, or at least not for long. What you do or don't do afterwards may cause problems. It does not require ticks, but depending on what you do in your code the alarm signal may not be handled without using ticks. Again, depends on your code.
  18. You're using PHP to run a batch file to run an application? Post code.
  19. Ticks aren't deprecated... Either ticks won't help you because you're waiting on an external process to complete, or ticks can help because you have code that's actively running but then you don't need ticks in the first place. Apparently it's the latter. Besides, ticks only work in certain PHP setups. What's your code?
  20. Rather than use the hammer you know to hammer in a screw, learn to use a screwdriver. Install ntp/ntpd/whatever the name of the package is called on your (presumably Linux) distro. And make sure the system is using the right timezone. That's it.
  21. Make sure you're still logging those errors, though! You may not want the error message to appear on your site but you certainly should be aware of any problems.
  22. Apache needs the slash if you want it to serve whatever DirectoryIndex file (eg, index.php) automatically. If you want to turn the slash off then you have to (a) add it back yourself or (b) do the work of serving the index.php yourself. # do not automatically append slashes to directories DirectorySlash off # do automatically use index.php RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*[^/]$ $0/index.php [L]
  23. Use two forms. Besides the fact that having those two buttons on the same form would be confusing, if someone chooses a file to upload and then hits Submit, the file still gets uploaded. If you use two separate forms then you avoid that.
×
×
  • 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.