Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. What shows up when it fails to work? I suspect that quicktime videos may only play if quicktime is installed on the device, check to see if quicktime is installed and, if it isn't, install it. Are these devices running Windows, Mac or Linux?
  2. You'll have to do some debugging, I don't see any reason why a simple if condition would change how a function works. Have you tried having a PHP file with just the bare minimum in it? You should check to see the value of $_COOKIE. var_dump($_COOKIE);
  3. background: red is correct. background is a shorthand for all background properties, including color. I would recommend omitting "px" or any units if you're just setting values to zero. It will make your code shorter, and zero has no units.
  4. var file = this.files[0]; var type = file.type; It would seem the browser is not able to correctly guess the MIME type of the uploaded file. You could manually check for a ".mov" at the end of the filename and set "type" to be "video/quicktime" (I think that's the correct MIME type for mov files) var type = file.type; if(type == "" && (/\.mov$/i).test(file.name)) { type = "video/quicktime"; }
  5. Cookies have to expire. Setting expires to "false" (equivalent to zero) will cause the cookie to disappear once the browsing session ends. You can set the cookie to a date far in the future, like six months: $expires = time() + 60*60*24*30*6; setcookie($cookiename, $cookievalue, $expires, "/", "localhost"); According to the comment on the PHP manual, setting the domain to "localhost" does not work, though the comment is from 9 years ago. Perhaps PHP has improved since then. I would test not setting the domain or setting an empty string to see if that fixes it.
  6. According to this table MOV is not a supported video format except for in Safari. https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats#Browser_compatibility I'm not surprised since it's a proprietary format invented by Apple.
  7. This is not likely causing the issue, but you're setting the $expires parameter to "false" instead of a number, which it expects. You should set it to 0 if you want the cookie to expire when the browsing session ends. Have you tried removing the domain parameter? Update: It seems "localhost" is the issue: http://php.net/manual/en/function.setcookie.php#73107
  8. That code is working. A cookie you set won't be in the $_COOKIE array until the next time you load the page, which is why it's telling you that it was unable to set the cookie.
  9. Explanations of all the functions are in the PHP manual: http://php.net/mysqli_bind_param http://php.net/mysqli_stmt_execute And there's a manual page explaining the concept of prepared statements in general. You might call it a tutorial: http://php.net/manual/en/mysqli.quickstart.prepared-statements.php PHP is a well-documented language.
  10. That's because the variables are not available inside the scope of the function. This will work: function addCookie() { $cookiename = "test"; $cookievalue = "tests"; setcookie($cookiename, $cookievalue, false, "/", "localhost"); } addCookie(); And this will work: $cookiename = "test"; $cookievalue = "tests"; addCookie($cookiename, $cookievalue); function addCookie($name, $value) { setcookie($name, $value, false, "/", "localhost"); }
  11. I'm not seeing the issue you're describing. Which browser are you using?
  12. You can't add 1 to NULL because NULL is not a number. When a row is created you should be setting the field to a specified numeric value. Assuming the count field is not null, this query will work: $stmt = $conn->prepare('UPDATE table SET count = count + 1 WHERE unique_nr = ? '); $stmt->bind_param("i", $unique_nr); You have to bind exactly the number of parameters that are being used in the SQL. If that's not working, show exactly what error message you got.
  13. The validator makes no mistakes. ::selection is not part of CSS level 3, it's part of a working draft for CSS 4. https://developer.mozilla.org/en-US/docs/Web/CSS/::selection
  14. I was going by the code you provided in the first post, which shows this: if (currentText == "menu") { btn.text("close"); btn.attr("title","close menu"); }
  15. "menu" == "menu" is a tautology, so it would never return the false value. This should work. btn.attr("title", currentText == "menu" ? "close menu" : "menu"); I recommend being very familiar with Javascript before learning jQuery.
  16. The CSS border-radius property allows you to make rounded corners: http://www.w3schools.com/cssref/css3_pr_border-radius.asp
  17. Unfortunately, you may need to rewrite a lot of your code. You should never mix variables into your queries because, aside from the potential to throw errors, they also provide a mean of breaking into your database. The mysql library is deprecated due to security vulnerabilities and no longer works in recent versions of PHP. If your server gets an upgrade at any point your whole program will stop working. There are two alternatives: mysqli and PDO. Personally, I prefer PDO. Now before you jump into either of these, remember that you must not put variables into your SQL even when using these new libraries. So how do you put values into your query? Use prepared statements: http://www.w3schools.com/php/php_mysql_prepared_statements.asp There's a better description of prepared statements in the PHP manual: http://php.net/manual/en/pdo.prepared-statements.php strip_tags() and htmlspecialchars() are operations you should do when retrieving information from the database, not before storing them.
  18. I haven't worked directly with SVG in a long time. Last time I was building a graph, so I used lines, polylines, text and circles. I used the <g> element to group things.
  19. Tables just don't work very well on mobile devices. They're not responsive and refuse to become smaller than the content within them even if you specify a width. The only real solution is to not use tables, use CSS layout techniques.
  20. You have a set of tools, whether you use them or not depends on what you're trying to make.
  21. MDN has a more complete reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element In general you won't need most of them. Just use what you learn in the SVG tutorial.
  22. The example I showed you will only run the Javascript code if the element that you clicked on is not a link. Perhaps you haven't made your requirements clear. What exactly do you want it to do?
  23. When assigning events through Javascript, an event object is passed through with information about what was clicked on. Change your <div> element to have an identifier: <div id="section-link"> Then add an event listener (this script has to be AFTER the div in the document): <script> document.getElementById("section-link").addEventListener("click", open_win1); function open_win1(e) { // "e" contains information about the event // e.target refers to the element that was clicked on // Only open the window if the clicked element does not have an href attribute if(!e.target.hasAttribute("href")) { window.open("http://www.dekentering.info/PaginaActiviteiten.html", "_self"); } } </script> There are many different ways to identify the element, you could also check that e.target == e.currentTarget, where currentTarget refers to the <div> element and e.target is the element that was clicked on.
  24. Oh, right. PHP has it built in. I was on my phone so I wasn't checking the reference.
×
×
  • Create New...