Jump to content

inactive

Members
  • Posts

    97
  • Joined

  • Last visited

Everything posted by inactive

  1. Is * meant to be a wildcard? They maybe a bit of http://www.php.net/manual/en/function.preg-match.php with some simple regex?
  2. I'm not quite sure if I'm describing this correctly, but I'm looking for a php solution that will basically take inbound instructions in the form of SOAP messages, and then send emails out as per those instructions. Has anyone heard of anything similar before? I'm quite happy to build it myself, but some kind of library to work with would be great, or some other script as a reference. I'd prefer not to have to purchase anything, but if there's an industry standard, please point it out to me. Thanks guys.
  3. Sorry for late reply. That's no problem. I'll see what I can do. OK so lets get this strait: With your original array: <?php $register[0] = 0; $register[1] = 1; $register[2] = 1; $register[3] = 1; $register[4] = 0; $register[5] = 1; $register[6] = 0; $register[7] = 1; ?> If we put it through the following script: <?php $register_status = array(); // <<-- note this line ###### foreach ($register as $key => $value) { if ($value == 1) { $register_status[$key] = $value; } } ?> Then we will get $register_status being: <?php $register_status[1] = 1; $register_status[2] = 1; $register_status[3] = 1; $register_status[5] = 1; $register_status[7] = 1; ?> Which means that there were a few issues, and the user should not be registered, correct? That means, if we use: <?php $register[0] = 0; $register[1] = 0; $register[2] = 0; $register[3] = 0; $register[4] = 0; $register[5] = 0; $register[6] = 0; $register[7] = 0; ?> Then there wasn't a problem, and running it through the same code above, should mean that $register_status will be an empty array, but as we have initialized the array in the function (see noted line above), it still exists, but has zero elements in it. We can then do: <?php if (count($register_status)) == 0 { // there were no errors so // all elements in $register equaled zero // so $register_status had no elements in it // (which means the count() for $register_status // will be also zero) // and we can now register user } else { // there was one or more errors, do not register user! } ?> I hope I am on the right track, and this helps. You may want to do a bit more coding around exceptions etc (for example, if $register is not an array, then the foreach loop won't even run, errors will be thrown up etc).
  4. Hmm, I'm not sure exactly what you mean there... could you simplify the situation a bit...which vars get generated, what should happen if its empty or not set etc. BTW, you can use isset($var_name) to see if an variable is set, and is_array($var_name) to see if it is an array or not.
  5. What scanner are you using darkfreaks?
  6. Sorry, that should have read: $register_one = array(); foreach ($register as $key => $value) { if ($value == 1) { $register_one[$key] = $value; } }
  7. $register_one = array(); foreach ($register as $key => $value) { if ($value == 1) { $register[$key] = $value; } } $register_one will contain only keys where $value is 1.
  8. Maybe you're right. Hmmm yeah I suppose I could include it. Thanks heaps.
  9. Sorry, that got in there when I was simplifying my code for the post. The actual code is correct. Any other ideas?
  10. Hey guys, I'm running eval() on a var containing some php code (should be OK, right?). Well it works, but as soon as I add some heredoc code (i.e. <<<EOF), it has a fit. Here is the code from the parent script: <?php $handle = @fopen("foo.inc", "r"); if ($handle) { $buffer = ''; while (!feof($handle)) { $buffer .= fgets($handle, 4096); } fclose($handle); eval(buffer); } else { echo 'shit! something went wrong'; } ?> And foo.inc is: $var1 = 'test text'; $var2 = 'some more test text'; $arr1 = array('alpha','beta','charlie'); $var_heredoc_1 = <<<ENDBODY foo bar foobar ENDBODY; And for my trouble I get: Parse error: syntax error, unexpected $end in index.php(11) : eval()'d code on line 10 If I remove the heredoc part, it works as expected (note that the code above has been simplified a fair bit). Any ideas? I'm sure the syntax in foo.inc is correct (as I renamed it foo.php, and put <?php ?> around, and it worked correctly. Is there limitations on what can and cannot be aval()'ed? Any help would be much appreciated. Thanks guys.
  11. Thats wicked, now we're cooking! The only thing is, I need MySQL to actually provide me with the next available (i.e. used columb = 0) promo code. Would I need to do this first with a Select, and then do the Update?, or can I do both functions at once? Thanks again, really helpful.
  12. You are probably right, but this will sitting on the website of the biggest office supplies chain in Aus, so I need to be 100%, or else my arse is grass. Locking the table sound like an idea, thanks, but I'm still open to other ideas - anyone else? Like I said, I'm a bit of a noob here lol. Thanks again.
  13. I'm sure this kind of question has been asked before, but I wasn't really sure of what to search for, so here goes: We have a form which users fill out, submitted to our PHP backend. We have a list of 5000 promotion codes, and each time the form is submitted we need to pass one back to the user, marking the code off as used. I haven't had much experience with MySQL, but I understand how to do this. What I don't know how to do it ensure that if two people submit the form at the exactly same time (unlikely, but we are heavily trafficked so it is possible), how do I ensure that they both don't get the same promo code before the second part of the script marks that particular promo code as used? I.e. I want to avoid this: User 1: submits form User 2: submits form User 2: is assigned code 27 User 1: is assigned code 27 User 1: marks code 27 as taken User 2: marks code 27 as taken again Thanks guys.
  14. Yes, root, direct physical access to the server. Theoretically I can do anything, however they don't want to make significant changes to the server as there are a few other sites hosted on it which may potentially be affected. Thanks heaps.
  15. Great thanks for your help. However browsing the PECL libraries on pecl.php.net, I cannot seem to find SOAP, which I guess means its no longer provided/supported. Does anyone else know how i can get the PEAR extension working with PHP 4? Cheers ~Mitch.
  16. Hey guys, hope I'm in the right forum here. I'm developing a script that integrates with Salesforce.com using the SF API and PHP's SOAP extension. Works great, but I've just been told that the server its to be hosted on only runs PHP 4, which doesn't have the SOAP extension. My first though was that they should just upgrade to PHP 5, but apparently that's not an option. I read on http://www.brainbell.com/tutorials/php/Creating_A_Web_Service_With_PHP_5%27s_SOAP_Extension.htm the following: However, only having worked with Apache/PHP on Windows before, and considering that the PHP 4 server this is to be hosted on is a Linux box, I'm a bit out of my league, and feel like a bit of a noob here. So does anyone mind explaining the above quote to me if you could, and perhaps a couple of tips on how to get the SOAP extension working with PHP 4 if you've done it before? Thanks for your help. ~Mitch.
  17. OK no probs. I don't think I'll be doing anything too complex yet though . Thanks again.
  18. Oh OK thanks for that I had no idea. I'll give it a shot.
  19. Oh wicked yeah I see. Hence my reason for wanting a host with PEAR/SOAP support...
×
×
  • 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.