Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Not all versions are compatible with each other, thus different active and stable branches. 5.5.x is the latest, 5.4.x is the second-latest, and 5.6 is in development. What version you upgrade to depends on your code: if you're running 5.3 without problems now then try 5.5.
  2. If you want the entire string then you have to make sure it matches every character from the beginning of the string to the end. That means ^ and $ anchors. Also, - in a character set can mean a range (like "A-Z") so you should either escape it or put it as the very first or very last character (where it couldn't possibly mean a range). Also also, \s is any whitespace so if you don't want tabs and newlines and such then you should put a literal space in there instead.
  3. There is but one line (perhaps multiple times) you'll need to add to whatever you found. Speaking of, what have you tried? And I assume the problem was that they redirected requests for all domains instead of just the one?
  4. Use regular expressions: orig = orig.replace(/<br>/gi, " ");/g is what makes it replace every instance while /i gives you the case insensitivity.
  5. It sounds like you're unaware of the product use rights associated with your licenses (or "keys" as you call them). If you were then you'd know that you cannot reassign Windows 7/8 (ie, desktop versions of Windows) licenses. Get a lawyer before Microsoft sues your pants off.
  6. You do need to check the extension too, in case the web server decides to serve the file based on its extension and not its contents. And extensions need to be managed with a whitelist. For execution, there are a couple things. If everything will always be for download and never served inline you can force a content type on all the files to make them always download. There's also the simple Options -ExecCGI -Includes so files will never be executed or parsed for server-side includes.
  7. Replace a nested http://...... before you do the s and s.
  8. When you're ready to become a serious programmer, start looking into the tons of PHP IDEs available. A small but unnecessary amount. But where did $value get set to the wrong function? Is it happening that way in more than one place? It's a rabbit hole. "Magical", as in "we don't know quite how or why the variables are set to what they are so as far as you're concerned it's magical". Put like that there are tons of things that could qualify as magical. PHP even has things called "magic methods" (__get and __set and such) which are only demystified once you learn how the trick works, but until you learn about them being able to set values on member variables even though they don't exist is "magical". Magical behavior is bad because you don't know why things work the way they do. Magical behavior is difficult to track down and often harder to change. It is poor practice because it impedes your work and the work of anybody who has to maintain the code in the future. Some PHP programmers avoid __get/set and such for that same reason, though not as much because they're firmly entrenched in its implementation of object-oriented programming. Variable variables are not; should they ever be then doing things like echo $value(); may gain wider acceptance... provided all the other problems with it are dealt with. With all that said, sometimes there are legitimate uses for it. What I'm saying is that your example, and in fact most times I see it, is not one of them. Maybe you'd like to elaborate on what exactly you were planning?
  9. No support from the IDE about what is executing. No help from your IDE about possible errors. No idea where all the computer/laptop functions are being called. Slow function calls. Prone to bugs that can be difficult to track down. Lends itself to magical behaviors that are crazy to maintain and support. Adds another attack vector to your code. Using a feature just for the sake of using a feature. Unreadable.
  10. $bi_i is probably a number... What output do you get now and what output are you trying to get?
  11. 1. Turn $due_date into a Unix timestamp (strtotime() it if there isn't a more direct method) 2. Use strtotime() as you did in the first attempt 3. Don't try to use fancy variables like "$days1" but instead use a $days array if you absolutely must have all 70 values at the same time (which I doubt you do)
  12. MySQL will still convert it for you. At the very least try to: if there's a character in the first character set that's not available in the second then you will lose some data (IIRC), but that's not going to be an issue with Latin1 -> UTF-8 (since MySQL's utf8mb3 contains all of the characters in latin1). [edit] But since the reverse is not true, you should check your data to make sure it's all correct: if you tried to save something not valid in Latin1 then MySQL couldn't have saved it correctly and you'll need to fix it manually (since the data would have been lost).
  13. Yes.
  14. If the field named "file"? Have you already submitted the form? By the way, you can't trust the "type". It's provided by the browser which means I could upload any type of file I wanted. Figure out the file type yourself, like with the finfo extension, but know that .docx files look like (they actually are) .zip files.
  15. MySQL will convert it for you.
  16. The session ID was passed in the cookies. PHPSESSID is the default name for it, I think. You don't need to include it in your client-side Javascript. And yes, the user could change their session ID, but it won't do them any good unless they managed to find out somebody else's session ID.
  17. That would do it, yes.
  18. With a typical setup the session data is stored in a file in a format you don't want to bother with. Move your sessions to a database. Old articles but nothing's really changed (besides SessionHandlerInterface): - Storing Sessions in a Database - Saving PHP's Session data to a database Then anything, be it PHP or Node.js, can read and write session data.
  19. There's a good chance they have something like mod_security (for Apache) installed. One of the things it can do is 403 a request if it contains something that looks bad, like "http://" in the URL. Assuming you can use .htaccess files you could actually disable that particular rule, but simply removing the "http://" is a perfectly reasonable solution since it's implied anyways.
  20. The documentation for DOMXPath::query has a relevant example - HTML versus XML doesn't really make a difference in what you do (beside changing a couple method calls). If you want to see the book.xml it uses, it's here.
  21. 1. Depends what search, how to search, and what pages. 2. Depends what numbers and where you're looking for them. 3. Depends where you want to list them and in what output but it'll probably be a foreach loop. In case you thought it, PHP isn't some magical language where you give it commands like "search these pages for this thing" and it gives you what you want. You have to explicitly program it to do exactly what you want and exactly how you want it done.
  22. Don't use regular expressions to parse or navigate through HTML. Use DOMDocument to load it and then DOMXPath to get to that specific part of the HTML using the (untested) example query //div[@id='statistics']/section/ul/li[@class='total-paid']/span
  23. 7 digits for a local number, 3+7 digits with the area code, '1'+3+7 digits (leading '1' + 10 digits) for a long-distance call.
  24. Moved to MySQL because Yes, actually, you do. Well, you might not want to, but that is what you should be doing. It is almost always bad to put multiple pieces of data into one column. Keep them as separate rows - you may think it's more effort now, but it will save you from problems later.
  25. Remove the quotes on the variable (1. variables don't work in quotes and 2. don't use quotes if all you have inside is a variable) and please use a semicolon (it's technically optional there).
×
×
  • 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.