Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. If the PDFs can be publicly viewable, as in anybody on the internet should be able to see them (if they had the link), then go ahead and leave the directory web-accessible. If not, and I suspect not since these are bills that users are sending to people, then don't. Put the directory somewhere else and then make a PHP script which authenticates the user and then serves (outputs the contents of) the PDF.
  2. How often to do you need to access the information? Can it change during the lifetime of the user's session? When and why?
  3. Is what you posted your real code? Because it's incomplete. Like, you need a call to .send() in there. I'm not sure he meant "websockets" as in the tech - more like "open a socket to a website" in the general networking terms.
  4. AJAX is asynchronous - it does not happen linearly with the rest of your code. web_socket_open() will finish executing immediately and then eventually sometime later the onreadystatechange function will fire. Nevermind that the return will only return from that anonymous function and not web_socket_open(). function web_socket_open(href){ var request = new XMLHttpRequest(href); request.onreadystatechange = function() { if (request.readyState === 4 && request.status === 200) { console.log(true); } console.log(false); } } web_socket_open('http://127.0.0.1:8080');And notice that if everything is good you'll see a true and false output.
  5. Javascript cannot interact directly with PHP code or with your database. Use a form. <form action="" method="post"> <button type="submit" name="comehome">Click Me</button> </form>then if (isset($_POST["comehome"])) { // insert the record } // continue on as normalIt's not onclick because that requires AJAX and you said you wanted this thing done quickly. Which is a bad mentality for a programmer to have but whatever.
  6. Don't put the placeholders (which is what they are) inside of quotes. They aren't strings but, well, placeholders. Placeholders for real values which will come after you've called bindparam() and execute().
  7. But... isn't your AJAX hitting PHP in the first place? Because that's where the "html" comes from, and that's presumably the "id=msg results" you're talking about.
  8. I agree with scootstah: this is better served with an interface and an implementing class. Closures/callbacks/anonymous functions are more for simple tasks, like how Jacques's example where it just dumps out a value. The mere fact that the function is named "save" suggests it should conform to a specific signature (be that ($col1, $col2) or (array $cols)) and thus in a class. Fun fact: PHP 7 supports anonymous classes, so one could do... well, it doesn't look particularly pretty so I won't post the example code for it. But if you're concerned about lots of one-off classes, this would be marginally better.
  9. The point of this thread was to find out what data type to use in MySQL. Barand said TIME which is, technically speaking, the appropriate format at it models the actual data you're working with. You talked about how your code would convert the value into seconds which is why I asked about simply storing the number of seconds. If your new question is about how you can have PHP convert "HH:MM:SS" into a number of seconds, the simplest answer is the most obvious: list($h, $m, $s) = explode(":", $time); $seconds = 3600 * $h + 60 * $h + $s;
  10. If you're going to convert it all the time, would it be better to store the number of seconds instead?
  11. Only for the next day or two. Until I remember to change my avatar - I'm overdue. [edit] Annnd changed.
  12. Upgrade the password for the user. Do a SELECT PASSWORD('123456')and make sure you get a long string starting with an asterisk. Assuming you do, SET PASSWORD FOR 'user'@'host' = PASSWORD('password')
  13. Yeah, there's a lot. 1. Near the top is probably a "Configure Command". What is it? 2. Is there a section named "filter"? If so, what does it include?
  14. What version of PHP are you running on the site (echo PHP_VERSION;)? What does phpinfo output?
  15. OP is advertising demonstrating their video about setting up sendmail on Windows.
  16. Why did you delete all the comments in the sendmail.ini!?
  17. It's because end() wants to modify internal information about an array, so it needs to be passed a variable and by reference. If the function returned an array by reference, that would work too. A combination of strrpos and substr will work for a one-liner too.
  18. ICANN/IANA also maintains a list of literally the top-level domains. Meaning it lists "uk" but not "co.uk". Doesn't include the IDN versions of the xn-- labels but that's not difficult to deal with in code. Keep in mind that "foo.bar" is a valid domain name - a user could put forward even the slightest bit of effort to circumvent any sort of general-purpose domain name verification you may put in place.
  19. Use radio buttons instead of checkboxes.
  20. Your serialize methods aren't doing anything with $regList, so that information will get lost during serialization. Drop the Serializable interface and its two methods and let PHP do what it normally would do. Serializable is only really if you want to change how serialization works.
  21. What is the code for RegistryClass::serialize and why aren't you using just serialize()? "__PHP_Incomplete_Class" means PHP couldn't load the class named. Which is SiteNavigation. Are you sure the autoloader is set up properly and gets installed before the call to unserialize()?
  22. I think it's fine: PDO is about databases and this is a database forum. In here or in Coding Help would probably be alright either way.
  23. Do you still have the PM I sent you from last time? I did the same thing again.
  24. Okay, so can you at least say the entire element's value is "YES"? //*[.="YES"]You should also consider actually learning XPath.
×
×
  • 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.