Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Here's an article by Mozilla explaining the logic that all browsers use to calculate CSS priority: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity Here's the actual official standard by the W3C, it basically says what Mozilla's article says but in more technical terms: https://www.w3.org/TR/selectors/#specificity https://www.w3.org/TR/css-style-attr/#interpret
  2. You can't pass a query string in the file system. The whole "?module=API&action=index&method=VisitsSummary.get&..." part can only be done through HTTP because that's part of a URL, not a file path.
  3. The problem is you're setting the width to 100% here. It's just as wide as the window, but starts off almost halfway through the screen, so a large part of it is outside of the right boundary of the page. /* Caption text */ .text { ... ... width: 100%; ... ... } Remove the width property. It is not needed because it's a block element.
  4. You have to remove the element's style attribute.
  5. Drop the for() loop and just initialize a variable $i and increment it yourself, like this: <?php $i = 1; // Initialize $i outside the loop while ($row = $resource->fetch_assoc()) { echo $i; // No "+1" here because we started $i as 1 already // All the rest of your code here // // // // Increment $i $i++; }
  6. That's not actually an array, it's an HTMLCollection. It behaves a bit like an array, but does not have any of the array-specific methods like .slice() or .forEach(). If you use document.querySelectorAll() it will give you a NodeList object which does have a forEach() method. jQuery is a program built with Javascript, it is more inefficient and memory-intensive than regular Javascript by a couple of orders of magnitude.
  7. The style attribute always takes precedence over a stylesheet definition. If you want to reset it then use Javascript to set the style to an empty string. You should either do everything with classes or everything with the style attribute, don't mix them. The class option is better since the stylesheet gets to decide how to display each element.
  8. The answer given on StackOverflow will update the data structure, but it will not be saved to a file. The data disappears as soon as the user leaves the page. There is no way for Javascript to write to a file. You have to use a server-side program to write to the file for you. Javascript can send the data to the server, but the server has to write the data to the file.
  9. It doesn't mean anything in any languages I know.
  10. If you want to write to a file on the server then you will need a server-side program that does the writing. Javascript is not able to write to the server.
  11. You don't need to change your variables. By using prepared statements you solve all of the major security problems. W3Schools has a tutorial page explaining how to do prepared statements: https://www.w3schools.com/php/php_mysql_prepared_statements.asp
  12. PDO and MySQLi are basically the same. I find PDO easier to use, but both libraries have the same functionality. Nobody can see your PHP or SQL code directly, but they have the URL of a page that handles data and the names of several variables. It's not hard to infer that there is a database table with field names that are similar to the variable names, and it's even easier to just send an apostrophe in just to see if it breaks something. Your website is a blackbox, anybody is capable of sending inputs and reading the output to see how the blackbox behaves and make guesses as to what is going on inside. https://xkcd.com/327/
  13. If the curl request is failing you should check the curl_error() method. You can also get more information with curl_getinfo().
  14. That last closing brace looks like a syntax error. You should check the error log.
  15. You can embed anything into an iframe. PHP by default sends a text/html header and that should work without a problem. What does it mean when you say that it does not work? What appears inside the iframe?
  16. PHPMyAdmin might be correcting your queries. You should always use backticks if the field has special characters (including spaces and dashes) in its name or if the field name is the same as one of the MySQL reserved words. You might not think it's normal, but people can easily find any file on your website that does server-side processing. Press F12 to open the browser's developer tools, open the network tab, click the "persist log" option. Now when your website goes through that PHP file, all of the information that was sent and received from the server is visible and the person can experiment by sending different data and seeing what happens. SQL injection should be a concern to anybody developing a website. There is no good reason to be lazy about it. Even if it's not about protecting your website, you also want to have to trust of potential employers who can know that you will do your best to keep their websites safe.
  17. Your field names have spaces and dashes in them, so they should be wrapped in `backticks`. Outside of that, the code you're using is vulnerable to hacking. You should read about prepared statements and SQL injection: https://www.w3schools.com/php/php_mysql_prepared_statements.asp
  18. Yes, it is difficult, but you either have to learn how to do it yourself by reading books and taking software development courses or pay somebody to do it for you. The work necessary to meet your requirements is much more than could be feasibly communicated through a forum.
  19. This is quite a large project you're asking about. I'd expect around 8 hours just for the research and analysis phase. I'd need to get a good understanding of how Matomo works and how exactly it is set up on your website. This might help you to start off: https://matomo.org/docs/integration/ As for the GDPR and the NSA, they are basically polar opposites. The former is a new regulation by the European Union designed to force large companies to stop harvesting and selling user data carelessly. The latter is a USA organization dedicated to stealing peoples' information regardless of how ethical the methods are. You really should do some research before jumping to conclusions.
  20. Print out the entire SQL string, not just the limit part. I don't know what's wrong, but I do know how to find out.
  21. The purpose of an object template, such as "Person" is for organizing code. In any part of your software, if you are given an object of type Person you know for sure that you can find a name and age property on it. If the object has no type then you don't know what properties it might have. You would use an object template if your software uses the same kind of object a lot. If you're only using the object in one place then you can use the shorthand {} to define it.
  22. The first step is to clearly define your requirements. You need to have a clear picture of how the software is supposed to behave. This is not a five-minute job, it is a project and it needs to go through a planning and design phase.
  23. You should print out the entire query and analyze it for yourself to see where the error is.
  24. In the loop, the variable $row is an associative array that contains all the values that you need. The $row variable works exactly the same as it does in this example: https://www.w3schools.com/php/showphpfile.asp?filename=demo_db_select_oo For the LIMIT part, it doesn't matter if you're using PDO or anything else, you just need to put the two numbers in the query. You can have two variables: $offset and $limit and then set the query to be "LIMIT $offset, $limit". Make sure that $offset and $limit are both forced to be integers or you'll be facing the problem of SQL injection again.
  25. I made a mistake, the fetch() method is called on the statement itself while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
×
×
  • Create New...