Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. Not true. You can have multiple email addresses in the "to:". From the manual: mail() My guess is your 2nd one is probably an invalid email address. Or else maybe all 3 are to same domain and having more than 2 triggers a spam filter or something.
  2. depends on what the input is.
  3. sounds more like you are using a preg_xxx or ereg_xxx function and are using / as the delimiter for the pattern (and not escaping the / in your pattern) which also explains that whole business with the question mark. In general, you would escape something by putting a \ before it. But if you want specific help, post some code.
  4. .josh

    regex help

  5. You cannot stop a user from refreshing their browser. I can't really be all that specific in what you can do to handle them doing it, without more details about your site and why you are wanting to prevent them from doing this, but in general, you can start a session variable on initial page load, and check for its existence on the page. If it exists, that means the user reloaded the page. But it might not necessarily be a straight page refresh. User could have loaded the page, gone to a different page on your site, and come back. So you may want to consider that. If you do not want something being counted or whatever for the user's visit no matter what, then it would be okay as is, but if you want to allow them to leave the page and come back you will have to script your other pages to remove the session variable. Also, the session variable will last until it times out (default 30m inactivity), or until the user closes the browser, whichever comes first. So the user could go to this page, leave your site altogether and come back, and session variable will still be there if it's been less than 30m. So you'll have to consider whether you want to count that or not. Easiest way to allow for that is to check the referring url on your page, as well. Also, this is only a solution for immediate user visits or 'sessions' to your site. If you want them to never be able to refresh the page again, you will have to store something in a database or flatfile, linked to the user. If the user is required to be logged in to get to this page, you can store it in their row in the db or link it to their account info easy enough. If they are not required to login to get to this page, you can do things like check the user's IP address, but it's pretty easy to get around that. As far as the actual code for implementing this; it's pretty basic. <?php session_start(); if ($_SESSION['someVar']) { // user has already been here, do something (or don't do something) } else { $_SESSION['someVar'] = true; // rest of page code here } ?>
  6. Store the date for when you want to send it in a table or flatfile. Write a script that queries the db or searches the flatfile for current date(s), and mails relevant stuff based on that. Setup a cronjob to run the script every x amount of time.
  7. .josh

    PHP5

    what file extension does your file have?
  8. .josh

    PHP5

    script extension recognized as something to run as a php script?
  9. Assign the results to a (multi-dim) array in the first loop. Then you can use the array later on in your script.
  10. It's because php doesn't care about your form or the javascript that submits it or any of that. As far as its concerned, it's random text. What you can do is use cURL to have php post data to another page/server/whatever.
  11. Okay so use the preg_match_all then. preg_match_all('~<img[^>]*>~i',$string,$images); $string = implode($images[0]); If there is no image(s) to be found, it will just be an empty string.
  12. well that's kind of what intersection means...an intersection is where something meets. A more common use of that word is with roads and streets. When they cross, that's an intersection.
  13. yeah i just edited my post. I meant to say it doesn't work in the context of it's not the same thing as what he's trying to do as far as using a plain old var as an object.
  14. Why does what work...this? edit: Accidentally hit post. It does work, because it will create an instance of the object using the value of that variable. But that is not the same as linking that variable to the class, or somehow making an object out of a variable. You are simply making use of the value.
  15. Go to the MasterCard or Visa website, just the same. But actually, there are companies out there that act as a middle-man or hub for all the major ones.
  16. Absolutely. I needed to take my daily dose of "Stand up, point at the computer screen and yell BURN" medicine.
  17. I will def agree that if it's an option, restructure your database. I kind of assumed that if that was an option, OP would have mentioned it. Right, OP?
  18. https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/home_US Each company you want to accept payments for will have something similar. Go to their website and look. Usually a link from home page to "Developer" or "Businesses > Developer" or some such.
  19. .josh

    regex help

    http://www.phpfreaks.com/forums/index.php/topic,259638.0.html
  20. When someone sends me an angry PM after having moderated them, I sometimes like to use that one. Anyway, where do you see them? Haha yeah I've done that.
  21. There's no such thing as an ALT tag. 'alt' is an attribute inside an image tag, so the article would not have an ALT attribute unless there was an image tag (nor would the preg_replace be replacing anything unless there was an image tag). Sounds like to me the image src link is broken, so the alt text is being displayed instead of the image.
  22. You should ask your mom. I hear she has lots of crabs, so she'd probably know.
  23. That's a kiss? Looks more like an offer for a bj...
  24. be more specific about "then it wouldn't run." preg_replace only replaces what it finds. So if your string doesn't have any image tags, nothing will get replaced. Example: $string = "something something"; $string = preg_replace('~.*?(<img[^>]*>).*~is','$1',$string); echo $string; // output: something something $string = "something <img src='...'> something"; $string = preg_replace('~.*?(<img[^>]*>).*~is','$1',$string); echo $string; // output: <img src='...'> Well that's something entirely different. Why didn't you mention that in the first place? And be more specific. Are you saying you have a document and if there are image tags in it, you want to check to see if there is an alt tag in the image and remove it? So for instance, "something <img src='...' alt='...'> something" to "something <img src='...'> something"
  25. It is possible, but you have to pass it as the static method version not with the $this shortcut, because it won't parse the $this. Also, you had a couple other things wrong. First, your method is called converttolower but you were trying to array_walk convertolower (missing a t in there). 2nd, you weren't doing it right in your converttolower method. In order to change it, you have to pass the value by reference, and then assign the alteration to the passed value. You cannot array_walk and make changes to the original array the way you were doing ($t[blah]) as that will cause array_walk to go AWOL. So here's how it would look: class test { function one() { $t = array('ONE', 'tWo'); array_walk($t, 'test::converttolower'); } function converttolower(&$value, $key) { $value = strtolower($value); } }
×
×
  • 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.