Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. I think the point is, Xdebug facilitates debugging. There are some things that XDebug provides that don't require a client, but to get what I think you want, which is traditional IDE style debugging, you'll also need an IDE that can make use of the XDebug api. I'm guessing that most if not all the editors that people have brought up, will work with XDebug, once properly configured.
  2. Well there are many reasons this could happen. Did you try looking at the error log on the backup server?
  3. Let me see if I understand you correctly: -You have some programs on server A. -On server B you need to run a program on server A, as if it was local to server A. Is that the question? If so, no, that can not be done by PHP or any other language.
  4. What does the preg_replace have to do with this? Your sample code isn't even valid. Trim will let you trim any arbitrary character you want, if you use the 2nd parameter, so ... $match = trim($match, ','); Will remove a trailing comma no problem.
  5. Yes, I'm sure that Yahoo and Google and Facebook and (10 million other websites) agree with you that PHP sucks, although they continue to use it. If only you were there to share your insights with them.
  6. Well let's take mikesta707's code and just add a bit: $content = file_get_contents('email.txt'); $emails = array(); $emails = explode(',', $content); $emails = preg_replace('/]*>/', '', $emails); // strip out all the from the addresses array_map("trim", $emails);//this just removes trailing or leading whitespace from all the entries // Didn't you mention a sort? sort($emails); foreach ($emails as $value) { // write out to your new file } [/code]
  7. Are you using the cleaned up version I provided, that removed some of the stuff that wasn't required? You also never provided info about the operating system and MTA you are using. Does email #1 get sent? Does email #2 get sent, and if so what are the email headers. This is all important diagnostic info, that only takes a minute to determine.
  8. It's not that php can't send portions of a page -- it can. But that doesn't seem to be what you're trying to do. Sending parts of an HTTP response is tricky stuff and involves all sorts of intermediary issues that can interfere with your intentions from proxies to the anti-virus someone is using. If you want a page that sends (IN HTML!) 1 2 3 4 etc. Yes you can do that, but to what end I don't know, AND it's really tricky to deal with buffering, AND it won't work the way you want for some clients (as mentioned earlier). For all those reasons, thorpe is pushing you towards a clientside solution, which could be pure javascript or AJAX if it needs to be something more complicated.
  9. Personally, windows is suppossed to accept either \ or / as path seperators. Just to remove any confusion I would only use the slash, so you don't have to be concerned about the escape property. With that said, if the code is not returning any error conditions, then my only suggestion is that the extracto path requires the ending slash. My suggestion would be to change your code so that it only uses the slash characters: so the extracTo method call would be: $zip->extractTo('//asecasiagsd/AGS/AGS/WIP/PROOF_QA_CSR/extract/', $file);
  10. Ok, a lot better explanation. So the 2nd query, if I understand you correctly, is working correctly, only you are thinking that DISTINCT does something different than it does. Consider this: mysql> select * from teams; +--------+-------------+ | member | hockey | +--------+-------------+ | bob | Black Hawks | | bob | Flyers | | bob | Kings | | joe | Caps | | joe | Penguins | +--------+-------------+ 5 rows in set (0.00 sec) mysql> select distinct hockey from teams where member = 'bob'; +-------------+ | hockey | +-------------+ | Black Hawks | | Flyers | | Kings | +-------------+ 3 rows in set (0.00 sec) Now if your complaint is that you are getting 3 rows in this result set, then you don't understand what distinct does. Distinct removes duplicates from the result set. Since your result set only includes teams, you are getting the results that are expected -- any unique teams. This can be further illustrated if we have a true duplicate row for bob: mysql> select * from teams; +--------+-------------+ | member | hockey | +--------+-------------+ | bob | Black Hawks | | bob | Flyers | | bob | Kings | | joe | Caps | | joe | Penguins | | bob | Flyers | +--------+-------------+ 6 rows in set (0.00 sec) Now you can see clearly the effect of the distinct: mysql> select hockey from teams where member = 'bob'; +-------------+ | hockey | +-------------+ | Black Hawks | | Flyers | | Kings | | Flyers | +-------------+ 4 rows in set (0.00 sec) mysql> select distinct hockey from teams where member = 'bob'; +-------------+ | hockey | +-------------+ | Black Hawks | | Flyers | | Kings | +-------------+ 3 rows in set (0.00 sec) In fact distinct is internally the same mechanism in mysql as using a GROUP BY clause on the columns specified. So, I'm actually not 100% clear on what it is that you really want, in plain english. It occurs to me that you have relationships between these 3 tables, such that you should be able to eliminate the need to do 3 seperate questions, by simply using joins -- and probably simple inner joins, but that's a bigger topic, and I'm again not clear on exactly what you're trying to do with this set of loops. I might also point out that your outside query, is going to cause your internal query to be run multiple times, if a member has multiple friends -- but hopefully you were clear on that originally.
  11. Ok, so that code makes a couple of things a bit clearer. The first thing i see is that your main assumptions are: $sector['resources'] is an array. That might be true but it might not. There is no way for me to know or help you debug, because the answer is entirely dependent on what $db->getSectorList() does. Secondly, I'm curious about $resources. All you're doing is an assignment statement, so I would again want to know if $resources is an array immediately after you create it with the assignment of $resources = $nation['resources']; Here is one thing that you may have stumbled upon previously, and that's the use of print_r(). If you print_r an array you are moving the internal array pointer that is used by foreach(). So if you did that inside a foreach loop, you could have caused a side effect that caused you to become confused. You can try the is_array() or you can reset() the array after the print_r. Needless to say print_r is great for questioning assumptions, but at times it's a good idea to simply use die() after it, and then figure out one conundrum at a time.
  12. No it wasn't clear at all. PFMaBiSmAd just made an assumption, and guessed right. Sometimes that happens, so you got lucky, nothing more. In the future try and work a bit harder when you're formulating your questions.
  13. Ok, so let's try and clean this up, and then I'll ask questions: //my original mail $to = 'mymail@mail.com'; $subject = "$thecompany request"; $headers = 'From:' . $email . "\r\n"; $message = "Name: " . $thename; $message .= "\nCompany or Club Name: " . $thecompany; $message .= "\nAddress: " . $theaddress; $message .= "\nRequired Date: " . $thedate; $message .= "\nPhone: " . $phone; $message .= "\nEmail: " . $email; $sentOk = mail($to, $subject, $message, $headers); echo "sentOk= $sentOk"; //delaer and clients duplicate emails $to = $email; $subject = "Thank you..."; $headers = 'From:' .$tf . "\r\n"; $headers .= 'Cc: ' . $tf . "\r\n"; $message = "thank you...."; $message = "Name: " . $thename; $message .= "\n\nCompany or Club Name: " . $thecompany; $message .= "\n\nAddress: " . $theaddress; $message .= "\n\nRequired Date: " . $thedate; $sentOk = mail($to, $subject, $message, $headers); echo "sentOk= $sentOk"; ?> So, now the question -- is this the *entire* script? Where are the values of the variables coming from -- I don't see you getting them from a $_POST or $_GET. Is this because you're using register_globals? At any rate, I don't see where the value of $tf is set. If it has no value, obviously things won't work. This is why I suggessted for debugging you echo out the values for example: echo '$to-> ' . $to . ' '; echo '$subject-> ' . $subject . ' '; echo '$message-> ' . $message . ' '; echo '$headers-> ' . $headers . ' '; $sentOk = mail($to, $subject, $message, $headers); echo "sentOk= $sentOk";
  14. Let's take a look at your assumptions: -people know my database (no we don't) -I have 3 queries here, something is wrong, but I haven't explained what it is yet. -I'm assuming it's the distinct, but again I have 3 quereies and some PHP code, although I've provided no output. -"It's not working" is a good description of my problem I'd love to help you really, as I've helped hundreds and probably thousands of people before you. But you have to articulate your problem better.
  15. Have you put in some debug code that echos or print_r's your variables prior to the call to mail()? Are these what you expect them to be? What are the values of $to, $subject, $message, $headers? Let's see the current version of the code you have as well.
  16. I'm not sure what you mean by redirect php injection. I'm also not sure what you mean about your javascript files. Were they physically changed on the server so that they now include the crackers bad jscript? The only way to figure out what happened is to analyze the system and the logs. Is allow_url_fopen = On set in your php.ini?
  17. Your question is beyond unclear. "I want to fetch the date from a variable date" could be interpreted a bunch of different ways. Your example code doesn't help. What are you attempting to derive? $startdate - $daysaway = Answer is a Date. or $mydate = $startdate? = Answer is number of days difference
  18. Yeah, I didn't even look carefully at that, but that's not how you pass parameters. should be: $sentOk = mail($to, $subject, $message, $headers); In the future, more information is better. I assumed that your emails were actually going out, since you stated that the problem was in the Cc: when in fact the entire email was not being sent.
  19. What's special about an intranet? There's no discernable difference between an intranet and an extranet, other than the fact that intranets aren't exposed to the outside world.
  20. I think the problem might be here: $headers .= "Cc: $tf\r\n"; Assuming your email address has the '@' which is a reserved character in PHP, it's possibly being interpreted by PHP. Maybe this will fix it: $headers .= 'Cc: ' . $tf . "\r\n"; Notice where I used single quotes vs. double quotes -- it's very important to the end result.
  21. Ok, so when you do your query you are issuing this: $this->run_dropusersql = mysql_query($this->dropusersql) or trigger_error('Query failed: ' . mysql_error(), E_USER_ERROR); In this case, or trigger_error is never processed, because "or" has a lower operator precedence than the assignment "=" operator. http://us2.php.net/manual/en/language.operators.precedence.php This is not unique by any means to PHP. To get what it appears you want, which is to have the return value considered, you could use the higher precedence "||" operator, however, a clearer way to write this (practically out of the PHP manual) is to put in an if condition: $this->run_dropusersql = mysql_query($this->dropusersql); if (!$this->run_dropusersql) { trigger_error('Query failed: ' . mysql_error(), E_USER_ERROR); } else { // Query worked ok. With that said, there is an obvious question about your delete approach: -If the user_id is unique (and it's the primary key of the table) why are you including other criteria? All you should need to delete a user, is the user_id.
  22. Everything looks ok -- however, I'm wondering if these routines work ok with the windows file share? Can you try mapping a drive on the server and specifying the drive letter instead? It also might be a permissions or path issue. Are you using IIS or Apache? Can you create a simple file in that same directory using fopen() fwrite() fclose(), and see if that works ok?
  23. Can you post the exact code you're using at the moment.
  24. I personally use Eclipse with the PDT module. However, none of these provide debugging without XDebug installed in PHP.
  25. Inside your function, call is_array() on $nation['resources']. I'm guessing you'll find it's not an array.
×
×
  • 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.