Jump to content

requinix

Administrators
  • Posts

    15,266
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. Why the heck are you sending emails from within the database server?
  2. Why did you comment out the return false? Don't you want it to return false for all the other cases that it didn't return true?
  3. The hash is invalid. It's probably something wrong in your code.
  4. I can guess, but I'll ask anyways: What's your code now?
  5. Depends on the case...
  6. So you're seeing that "thank you for your email" message but not receiving the email? Did you change anything after taking the code from the original test script (where you got the email using PHPMailer) and copy/pasting it into the script that handles the contact form? And I assume the values for Username and Password and From are all correct in your real code and you edited those just for posting it here?
  7. onfocus="this.readonly=false;" readonly is a boolean attribute on most s. Unless you want to actually remove the existing readonly attribute. The primary difference is what would happen if the form is reset. this.removeAttribute('readonly')
  8. Alright. Use a DateTime for the chosen date and diff it to starting date. That will give you a DateInterval which can tell you how many days are between the two dates. Since you don't care about the number of cycles between the two dates (k from before) all you have to do is use modulus to get the day number (d). Which needs a bit more of an explanation. Say the diff is 108 days. The most obvious course of action is to +1 (because the starting date is day #1 and not day #0) and %15 to get 4. That's not quite right. Say the diff is 14 days. Smaller number. +1 is 15 and %15 is 0. That's not right: you need to get 15 and not 0. You could say "if result == 0 then result = 15" but there's an easier way: ($diff % 15) + 1What you're actually doing is taking the diff, +1 because of the starting date, then doing a trick where you -1 then %15 then +1. Watch: (14 % 15) + 1 = 15which is the result you wanted. And (108 % 15) + 1 = 4like before. $pattern = 15; $start_date = new DateTime("2015-12-14"); // day 1 // Day 15 = 2015-12-29 $chosen_date = new DateTime("2016-03-30"); $difference = $chosen_date->diff($start_date)->days; $day_number = ($difference % $pattern) + 1; If($day_number == 13 || $day_number == 15) { Echo "possible outcome. Day $day_number."; } Else { Echo "not possible, day $day_number"; }
  9. Okay, so I think I figured out what you want. $start_date is the first date. You may have picked it arbitrarily, I don't know. 14 days later is the end of that cycle (1+14=15), and 15 days later (2015-12-30) is actually day 1 of the next cycle. Now you have a $chosen_date. That's going to be 15 * k + d inclusive days between it and the starting date, where k is the number of complete cycles between them and d would be the day number. As an example, with 2015-12-31 it's 17 = 15 * (1) + (2), meaning 1 complete cycle and the date is day #2 in the cycle. If the chosen date is 2016-03-30, that's 108 days later or day #109 (1+108) of the cycle. 109 = 15 * (7) + 4 and so the date is day #4 of whatever cycle. Right?
  10. Yes, that's the code. Currently it says "if not using HTTPS then redirect to the https:// version of the page". That needs to be modified to say To get that new condition you can use RewriteCond %{REQUEST_URI} !^/index.php?route=ebay/openbay/(which assumes that this site is not located in a subdirectory underneath the domain) added next to the existing RewriteCond.
  11. There is so much more to doing emailing properly, and so many ways it can go wrong. Do yourself a favor and get yourself a copy of PHPMailer. (There are other things but it's the most popular.) There are tons of examples and plenty of documentation on how to use it, and it will take care of everything for you.
  12. As mentioned earlier, mysqli_stmt::get_result() is only available with the mysqlnd driver. If you don't have that method then you are using the old libmysqlclient, which is unfortunate. If you keep with the mysqli extension then you'll have to go the long way to get results, meaning bind_result() and fetch() and all that. Speaking of that, your problem with $user. mysqli_stmt::fetch() only returns true/false/null as to whether there were any more results to fetch. To get actual data you need to bind the result values to variables, just like how you bound input values to variables. Each time you call fetch those variables will be updated with appropriate values.
  13. No, it's a float value. Okay. Like I said: you have a function that returns true if something is inside the range, so it should be a simple matter to make it return true if something is outside the range. Change your comparisons so that the page value is = max.
  14. Using strictly PHP and GD? Well yeah, sure it's possible, but here are all the GD functions available to use and none of them do what you want. Meaning you'd have to do the edge detection* or masking yourself. Bite the bullet and use something like ImageMagick instead. It does come as a PHP extension but more commonly you invoke the command-line program. It's powerful and I'm sure it can at least do the second method, if not both. * GD can do edge detection, where it creates an image showing edges, but it won't work for arbitrary points on an image so you couldn't rely on it.
  15. strtoupper() is a function that already exists. You don't make it yourself. It takes a string as an argument and returns a string. What it returns is uppercased. echo strtoupper(TextFunctions::$string);
  16. If it correctly returns true for values inside the range, and you want it to now return false for values outside the range, I would expect that all you'd have to do is do an else { return false; }. If that's not it then, What table? What data? Where are all those values coming from? How is the function supposed to return both true/false and something like "1,2,3,7,8,9" (which I assume is either a string or an array)? All that your code demonstrates is 1. Get the min and max values from the form. 2. Get data item 11 (whatever that means) as the page number. 3. Return true if the min and max fit those criteria.
  17. So to spell out what Jacques sees, That error message is being shown with some sort of Javascript code. It isn't a browser thing. Now, the most reasonable way that would happen is because your form did an AJAX request, but the response had an error. Specifically, the unexpected It just so happens that the very first character in your PHP code (which generates the AJAX response) is a The best thing to do is to fix the to use the standard, long-form <?php opening instead. If that doesn't do it, use Chrome's Network tab to see exactly what response was being returned during the AJAX; to catch the request you need to open the Network tab, or at least the inspector window, before submitting the form.
  18. Your question does not make sense. Where is 1,2,3,7,8,9 coming from? What does this have to do with the code you posted, which clearly only tries to return true?
  19. myMethod is supposed to be inside the class body, like with getProducer and ShopProduct. Buuut I'm pretty sure that whole class is just supposed to be a visual example. Not actual code you use.
  20. It sounds like OP wants to call all three functions. Not just one of them.
  21. I should probably read the rest of the thread, but I could imagine a legitimate use case: a third-party service that acts on behalf of some company but itself stays mostly in the shadows. Salesforce does it. Various payment providers and gateways have something like it (like the one my health insurance company uses). It makes sense for those services to be sending email that looks like it's from the hosted company rather than the service's own domain. With that said, those are the kinds of situations where the hosted company should set up emailing properly - by creating SPF/DKIM records to validate the service's mail servers (as providing email server information would be iffy). It's a concept that's so frequently abused but still possible to use legitimately.
  22. Well-developed, free, open-sourced code that happens to do exactly what you want and precisely how you want to do it? If I put it that way, does it make it clearer as to why you haven't found it yet? HTML 5 has a drag and drop API you would use to get the file uploaded. Storing the file works just like any other file upload. Expiration is a matter of using a cronjob to run a script which finds and deletes old files.
  23. Is this really a PHP question?
  24. I wouldn't think there's anything wrong with it. May be suspicious, to the receiver. Consider putting some kind of notice within the email indicating that it was sent by you on someone's behalf. "Report abuse" kind of thing. If that even makes sense. I assume bigcorporation.com is the domain of the email who you're claiming to send as? This is part of spam filtering, and can easily get your emails filtered out, so if that's going to be a problem then you need to re-think what you're doing and how. Two things you can do to avoid it: 1. Send using the user's actual emailing service, which will require information they don't know and information they might not want to give you. 2. Set up domain verification. DomainKeys (DKIM) and SPF validation are the mechanisms for that, but to do verification the user needs to alter the DNS records for their domain to indicate that your email server is allowed to send emails on their behalf. In other words, you can't really do anything about it. With that said, there is a third option: 3. Don't claim to be sending from their email address. You'll avoid the verification problem because you're not attempting to act on behalf of anyone. Again, this may or may not make sense/be viable for your uses. A little notice at the bottom of the email, "This email was sent on behalf of from . Report abuse, etc." would be a good idea.
  25. But wouldn't that mean the source you scraped from had "\E8" too? That would be odd. If not then there was a problem with your scraper...
×
×
  • 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.