Jump to content

requinix

Administrators
  • Posts

    15,266
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. But didn't you get that ID when you put the image in the folder? What's the rest of your code? Particularly the bits that involve the database.
  2. You. Cannot. Return. From. The. Success. Or. Failure. Handlers. It will NOT make the socket_open() function return a value. If you want to log to the console (or do something else) on success or on failure then put that code inside the handlers themselves.
  3. So no. But the PHP Installation & Configuration forum sure sounds appropriate.
  4. What you need is stopPropagation. It prevents an event from being "bubbled" up to be handled by parent elements. Put a handler on both the body and the weblink/webdropdown elements, have body's work the way it does now, and have the others' merely call stopPropagation on the event object.
  5. The ready state changes more than once during the lifetime of the connection. That's why there is a .readyState value you can look at. Only make a decision regarding connected/not connected when readyState is 4, which corresponds to the request having completed.
  6. What does the script do? Are there any errors logged? Is cron set up to email you the results?
  7. Word wrap isn't against the rules. You just need a really wide monitor and a really high resolution.
  8. By the way, the one-liner: $input = "dog,white cat,white cat,black cat,white dog,black bird,white"; $output = current(array_map(function($i){return ksort($i)&&array_walk($i,function(&$v){$v=implode(": ",array_reverse(func_get_args()));})?implode("\n",$i):array();},array(array_map(function($i){return arsort($i)&&array_walk($i,function(&$v){$v=implode(" ",func_get_args());})?implode(", ",$i):array();},array_reduce(preg_split('/\r\n?|\n/',$input),function($c,$i){return@++$c[strtok($i,",")][strtok("")]?$c:$c;},array()))))); echo $output;Obfuscated a bit so it's longer than it needs to be.
  9. It's not a super-simple one-liner. You say you have code that isn't working? What is it?
  10. gizmola found and fixed a problem with the emailing system, which handles things like notifications, verification emails, and password resets. It'll be chugging through a backlog of emails for a bit so you may receive some emails for stuff that doesn't matter anymore. There was also a problem with the CAPTCHA verification on the registration page that has also been addressed.
  11. If you're saying that by moving the PDFs outside the web root then that's not entirely true. What matters is whether Google can find a URL (and it's very good at that*) and whether it can get the contents of the URL. Simply hiding the PDFs behind a PHP script isn't enough - it needs to require authentication too. It'll help you with the good bots, but you won't be protected from the bad bots who don't respect robots.txt. * If you use Google Talk, share a link with someone over it, and they click the link, Google will pick it up. At work, we've had them discover development sites that way - they weren't supposed to be publicly accessible but they were misconfigured. The sites got indexed. After applying a robots.txt to our environments and firewalling the boxes, it took a few weeks for the index to lose the sites.
  12. 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.
  13. How often to do you need to access the information? Can it change during the lifetime of the user's session? When and why?
  14. 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.
  15. 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.
  16. 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.
  17. 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().
  18. 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.
  19. 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.
  20. 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;
  21. If you're going to convert it all the time, would it be better to store the number of seconds instead?
  22. Only for the next day or two. Until I remember to change my avatar - I'm overdue. [edit] Annnd changed.
  23. 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')
  24. 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?
  25. What version of PHP are you running on the site (echo PHP_VERSION;)? What does phpinfo output?
×
×
  • 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.