Jump to content

Ingolme

Moderator
  • Content Count

    13,923
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ingolme

  1. If you need another condition, use else if(), if not then just use else. Neither of them are required, you just use them if you need them.
  2. This line is missing an "if" else ($choice == 'writsEdit')
  3. filter_var() with the FILTER_VALIDATE_INT filter returns an integer, not true, so === true will always fail. By using The ! operator, they transform it into a boolean. This boolean, for any integer other than zero, is always false. This solution doesn't account for the integer zero which converts to true, but W3Schools also has a section talking about that. They could just use !!filter_var() or (bool)filter_var() and they wouldn't need the === false part. This would still not solve the integer zero problem, though.
  4. That depends on where you want it to appear. The code you write does exactly what you tell it to do. I don't know what you want, so I can't tell you how to do it.
  5. That code is literally in the first post that he made. It would do to read more carefully before replying. This topic is really old as well, most likely the person will never see your reply.
  6. I can't see what the exercise actually was, but for learning purposes, the alias you use should not matter at all. Most likely it was the syntax that was incorrect.
  7. Firefox shows all of the event handlers that have been assigned to elements in the document. "Bubbling" indicates that the event fires during the bubbling phase, meaning that events from child elements fire before it. DOM2 just indicates which DOM standard is being used. As for what the Matomo code does when the page unloads, I don't know, there are too many external elements that determine that.
  8. I'm not concerned about the intention behind the code, I'm merely indicating which logic would be equivalent to the original code.
  9. The shortest equivalent code you can make without conditionals would look like this: $str_browser_language = ''; if(!empty($_GET['language'])) { $str_browser_language = $_GET['language']; } else if(!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $str_browser_language = strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','); }
  10. No, they don't produce the same result because in your code you're skipping over some comparisons that have to be made. Regardless of whether $_SERVER['HTTP_ACCEPT_LANGUAGE'] was tested or not, you have to test $_GET['language'] in order for the statements to be equivalent.
  11. You need to understand how the conditional works. In the statement X = C ? A : B , X is either equal to A or equal to B based on whether C is true or not. In other words: if(C) X=A else X=B
  12. No, that is incorrect. Each line is its own set of conditions completely independent from the other line of code. It is equivalent to the following code: if(!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $str_browser_language = strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','); } else { $str_browser_language = ''; } if(!empty($_GET['language'])) { $str_browser_language = $_GET['language']; } else { $str_browser_language = $str_browser_language; }
  13. It is not inside the user_stats menu item, it is in front of it, 40 pixels from the left and 0px from the top of the #iconscontainer element.
  14. Yes. You can use the PHP database libraries in any part of your program.
  15. There are three different things that you need to be aware of: The name of the GET key, the name of the PHP variable and the name of the database field. When it comes to SQL, the only one that matters is the name of the database field. The code that you just provided only handles the GET key and the PHP variable. You should start learning from the very beginning, the W3Schools PHP tutorial is a good place to start, but you have to read and understand every single page of the tutorial.
  16. "id" is just another field, just like CustomerName. They're all just fields in the database. DELETE works equally well whether you filter using strings or numbers.
  17. It looks pretty straightforward. It indicates the request method, headers and body as well as what responses you can expect. What more do you need?
  18. I don't think that can be changed, it is built into the font. There are browser-specific CSS selectors to change the selection box, but I think it only lets you change the colors and not much else. I haven't memorized them so I'd have to look them up.
  19. The purpose is to show which syntax is allowed, the values are the same to make it more clear where the difference is between the two lines of code. Notice that there is an extra comma in the "Not allowed" code.
  20. You can LEFT JOIN the tables. Of course, wherever there's a NULL, all you'll get is NULL for the fields in table 2. If you want to completely ignore NULL rows, a plain JOIN will do that.
  21. Yeah, it's obfuscated. You can decode the strings by just printing them out. It's a long and tedious process, so I'm not going to waste my time on it, but I'll show you some examples with one of the strings: '\x61\x48\x52\x30\x63\x48\x4d\x36\x4c\x79\x39\x6a\x61\x47\x56\x6a\x61\x32\x39\x31\x64\x43\x35\x77\x59\x58\x6b\x75\x5a\x7a\x4a\x68\x4c\x6d\x4e\x76\x62\x53\x39\x78\x63\x69\x39\x6e\x5a\x57\x35\x6c\x63\x6d\x46\x30\x5a\x54\x39\x68\x5a\x47\x52\x79\x5a\x58\x4e\x7a\x50\x54\x46\x51\x54\x58\x63\x35\x57\x44\x4e\x54\x57\x6d\x6c\x48\x5a\x7a\x6c\x54\x59\x31\x42\x4f\x59\x58\x64\x6a\x65\x47\x39\x6c\x63\x44\x56\x30\x64\x32\x6b\x32\x61\x6d\x56\x53\x61\x6b\x55\x6d\x59\x57\x31\x76\x64\x57\x35\x30\x50\x54\x41\x75\x4d\x44\x55\x3d' The first step is to convert the character codes into actual letters. Just opening the Javascript console in your browser, pasting the string and pressing enter will do that and it yields this: aHR0cHM6Ly9jaGVja291dC5wYXkuZzJhLmNvbS9xci9nZW5lcmF0ZT9hZGRyZXNzPTFQTXc5WDNTWmlHZzlTY1BOYXdjeG9lcDV0d2k2amVSakUmYW1vdW50PTAuMDU= The "=" on the end makes it obvious that it's base64 encoded. Javascript uses atob() and btoa() to convert to and from base64. atob() will decode this, so I write this into the Javascript console: atob("aHR0cHM6Ly9jaGVja291dC5wYXkuZzJhLmNvbS9xci9nZW5lcmF0ZT9hZGRyZXNzPTFQTXc5WDNTWmlHZzlTY1BOYXdjeG9lcDV0d2k2amVSakUmYW1vdW50PTAuMDU=") The console then prints this: https://checkout.pay.g2a.com/qr/generate?address=1PMw9X3SZiGg9ScPNawcxoep5twi6jeRjE&amount=0.05 That's one string decoded. It's up to you to decode all the rest.
  22. I recommend you read every post in this thread carefully and consider reading books, tutorials and other resources more carefully as well. It's as though you ignore anything longer than a sentence. You have to stop writing code and begin learning to read code instead.
  23. Why is there a "{" on the first line of your code?
  24. Personally, I don't think books should just be giving examples of how to do things at all. They should be focusing on teaching the material and only provide examples that help solidify understanding that material. A good book wouldn't tell you how to make a login system, it would give you the knowledge to figure out how to make a login system on your own.
  25. Ingolme

    cookies and GDPR

    A session cookie does not need a consent notice, but a "Remember me" cookie identifies a user for a long period of time and is not crucial for site functionality, so you probably need a notice for it. I'm not an expert on this, so it might be better to look for a more definitive answer.
×
×
  • Create New...