Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. The solution to your issue with apostrophes is to use prepared statements, which the old mysql library does not support. As for the reason you can't get $returnData, the value in your SELECT query is not delimited, so there's a syntax error. "SELECT ID FROM TaskTracker WHERE DESCRIPTION = '$description'" This solution will get your code working for some cases, rather than none of them, but to get it working for strings with apostrophes in them you will need to use prepared statements.
  2. All of that is basic Javascript, which lines don't you understand?
  3. What are the exact rules for the resulting URL? Keep it short and simple, I need a list of rules that can apply to every possible scenario. I notice that if three checkboxes are selected, the "n" parameter appears twice in the URL, that's not right.
  4. Your code is not protected from SQL injection. The code will break if there's an apostrophe in any of the strings. The MySQL library is deprecated due to being insecure and the issue you're experiencing right now is the reason why. Use MySQLi or PDO and use prepared statements: http://www.w3schools.com/php/php_mysql_prepared_statements.asp Where did you get this PHP code? It looks like it came from 10 years ago.
  5. When setting it to an empty value, you're telling it to use the value given to it by the stylesheet or if the stylesheet is empty, the browser's default value. You would need to specify "block" or "inline" if the stylesheet had it set to "none" by default.
  6. Object properties are accessed using the dot notation obj.property Array elements are accessed using square brackets and the index of the array arr[2] An array of objects would be accessed like this: arr[2].property An object with arrays as properties would be accessed like this: obj.property[2] Using this knowledge you can access anything in any data structure.
  7. This code works correctly for me: var dateString = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var date = new Date(dateString); console.log(date.toLocaleString()); What does your code currently look like?
  8. The issue is that this line returns a string, not a date: var date = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); You can't use date methods on a string, you have to create a date object.
  9. You have to add a Content-Type header to the e-mail. $headers .= 'Content-Type: text/html' . "\r\n"; Then add the headers when sending the e-mail: mail("felipepinoredes@gmail.com","Formulario Idea",$msg, $headers);
  10. You're missing a closing quote on <div id="header"> but aside from that, it should work fine. You should properly indent your HTML to make it easier to read. Here's how it should be indented. <div id="wrapper"> <!-- start of Header--> <div id="header"></div> <div id="navbar"> <ul id="nav"> <li><a href="#">Home</a></li> <li><a href="#">Weather</a></li> <li><a href="#">Weather Charts</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact US</a></li> </ul> </div> </div> <!-- start of container--> <div id="container"></div> <div id="content"> <!-- start of footer--> <div id="footer">Copyright © StormSeatchers A.B.N;000 000 000 00. All Rights Resrived.</div> </div>
  11. I see, that's right, the sort() method is modifying the source array itself, I had forgotten about that. The points array should be reset on each iteration. When I do that, it does seem that the last position has the most probability of staying the same. I also notice that positions furthest from the 1 on the left have less change of getting a value. It seems the sorting algorithm is unlikely to move an element far from its starting position.
  12. Hmm, when testing in Firefox and Chrome I don't see the issue, it seems to be pretty random to me. This is the code I tested, it seems perfectly random, even when I increased the iterations to 10,000,000 var points = [1, 0, 0, 0, 0, 0, 0, 0, 1]; var a, i, j var result = [0, 0, 0, 0, 0, 0, 0, 0, 0]; for(i = 0; i < 1000000; i++) { a = points.sort(s); for(j = 0; j < a.length; j++) { result[j] += a[j]; } } document.getElementById("demo").innerHTML = result.join(", "); function s(a, {return 0.5 - Math.random()}
  13. You should repeat the experiment 20 or 30 times, and I would go with 1000000 iterations instead of 1000. If you don't do this, the results don't have statistical significance and may just be a coincidence. You should declare the function outside of the loop to make the code more efficient, otherwise it may not be able to handle 1000000 iterations. Other than that, pseudo-random numbers generally are not random enough for scientific application.
  14. The only reason I could imagine a link not working is if there was some Javascript on the page preventing it from doing so. If you could show an example page where the issue can be reproduced we could see it in context and find out where the problem is.
  15. The W3Schools staff doesn't visit the forums, so your best option is to click the "REPORT ERROR" link at the bottom of the page that you found the mistake on.
  16. This piece of code generates the icon: &#9776; It's a Unicode character which may not be supported by the font that Android is using to render the page. My suggestion to solve that is to either use an image or use something like FontAwesome
  17. You want the last two letters attached to each other while the rest are separated? If that's not it then what you actually want to do is remove space from the right edge of the container. A negative margin on the container would fix that. I'm not sure what your page looks like and what you actually intend it to look like. Letter spacing should not affect how the text is centered.
  18. Setting the text-align to center will make the contents of the table cell be centered assuming they're not blocks. You should not be using a table for this, it's really bad.
  19. I would guess than the angle bracket is making the browser think that an XML tag is being opened. You can wrap your scripts in CDATA tags to prevent parsing errors: <script> // <![CDATA[ // The rest of the code here // ]]> </script> XHTML is an outdated technology. You would be better off changing the doctype to HTML 5, then you wouldn't need CDATA tags. <!DOCTYPE html>
  20. You don't need to escape the Javascript, just store it as it is. To the database the Javascript is just plain text. The only real security issue you have is not related to the database at all. It occurs when you put the Javascript back into the HTML page, but since it's Javascript I would assume you intend for it to be executed by the browser. I don't know why you want users to be able to put Javascript on the website, so I can't tell you how to protect from attacks through this vector. We need to know who is allowed to add scripts to the site and who is the one that executes the scripts. The person adding the scripts would be the attacker and the one executing the scripts would be the victim.
  21. That's way too many requests, you need to rethink your requirements. What's causing so many different requests? AngularJS is intended for browser applications, if what you're making is website then I would advise against using AngularJS.
  22. Tables are inflexible and are not capable of being responsive, you have to substitute it for something else. A table will never be smaller than the content within it even if you try to set its width.Table cells adjust to fit the size of the table they're in.
  23. That can happen if the .htaccess file has a syntax error, it can also happen if the server is configured to send a 500 error when PHP has an error.
  24. Ingolme

    The Light Bulb

    The Javascript modifies the src attribute of the image so that the image will change.
×
×
  • Create New...