Re: [PHP] Unable to send mail from PHP to ATT e-mail address
scubak1w1 wrote: Edward Diener el...@tropicsoft.com wrote in message news:d9.64.21597.c829e...@pb1.pair.com... Chris wrote: kranthi wrote: of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server Somehow I doubt ATT gives out that sort of access ;) Exactly. The idea is right if you have access to both servers though. As you suggested, I can check my own server but I doubt I can get access to ATT's incoming mail server. ATT is potentially using one of the BLs such as SCBLs... Try going to, say, http://www.senderbase.org/, enter the IP and then on the listings page try the DNS-based blocklists [Show/Hide all] links I pinged the domain part of the 'from' email for the sending server and got back an IP address. I entered that IP address at http://www.senderbase.org/ and received a 'Neutral' reputation score with 'no information' found from whois and 'unknown' found for information about the network. I am not sure what final IP address the mail server is using to send out e-mail but 7 addresses starting with the first 3 parts of the IP were listed as addresses and all showed 0 DNSBL listings and 'Neutral' SBRS. Needless to say no spam is being sent from the mail addresses, since it is used by the server as part of a legitimate client-server program. Also bl.spamcop.net shows nothing for the IP address. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Phpster wrote: On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com wrote: I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an ATT address, such as my own as an ATT ISP customer, the mail never gets to me. If the 'to' address is anything other than an ATT address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= 'From: Some From Name somefromname.com'; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg.\r\n\r\n,$headers)) echo good; else echo bad; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns good, so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an ATT address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own ATT address also. I have also checked my ATT mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but ATT $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It might be that the server IP has been blacklisted with att as a domain from which spam is sent. I have found out that the server adds a from header of 'nob...@myserver.com' where 'myserver' is the name of the server. This header gets placed first before the From header I supply in my PHP script ( which should have had the form in the example above of 'somefromn...@myserver.com, my bad ). Perhaps the ATT mail server, when it sees the 'nob...@myserver.com' treats it as spam and does not deliver the mail to even the recipient's spam mailbox. I am not sure if it is normal for outgoing SMTP mail servers to automatically add the 'nob...@myserver.com' from address first in the header, or even why it does so ? Does anybody know if this is normal for mail servers to do this ? Evidently other incoming mail servers do not react to the 'nob...@myserver.com' in any way, so maybe ATT is unique in this. Any light anyone can throw on the 'nob...@myserver.com' address would be most welcome. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Shawn McKenzie wrote: Edward Diener wrote: Phpster wrote: On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com wrote: I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an ATT address, such as my own as an ATT ISP customer, the mail never gets to me. If the 'to' address is anything other than an ATT address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= 'From: Some From Name somefromname.com'; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg.\r\n\r\n,$headers)) echo good; else echo bad; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns good, so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an ATT address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own ATT address also. I have also checked my ATT mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but ATT $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It might be that the server IP has been blacklisted with att as a domain from which spam is sent. I have found out that the server adds a from header of 'nob...@myserver.com' where 'myserver' is the name of the server. This header gets placed first before the From header I supply in my PHP script ( which should have had the form in the example above of 'somefromn...@myserver.com, my bad ). Perhaps the ATT mail server, when it sees the 'nob...@myserver.com' treats it as spam and does not deliver the mail to even the recipient's spam mailbox. I am not sure if it is normal for outgoing SMTP mail servers to automatically add the 'nob...@myserver.com' from address first in the header, or even why it does so ? Does anybody know if this is normal for mail servers to do this ? Evidently other incoming mail servers do not react to the 'nob...@myserver.com' in any way, so maybe ATT is unique in this. Any light anyone can throw on the 'nob...@myserver.com' address would be most welcome. It is using the apache user @ your host name as the default. Try this: ini_set('sendmail_from', 'whate...@wherever.com'); I will try this but I do not understand why it should work. I have a 'From:...' entry in my headers. Why is this not being used as the primary from address and why is 'nob...@myserver.com' being added instead as the first from address ? In other words, I can understand if I supply no 'From:...' header entry that a default 'nob...@myserver.com' would be used but I do not understand why it is used even when I supply a 'From:...' header entry. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Chris wrote: Any light anyone can throw on the 'nob...@myserver.com' address would be most welcome. It is using the apache user @ your host name as the default. Try this: ini_set('sendmail_from', 'whate...@wherever.com'); I will try this but I do not understand why it should work. I have a 'From:...' entry in my headers. Why is this not being used as the primary from address and why is 'nob...@myserver.com' being added instead as the first from address ? In other words, I can understand if I supply no 'From:...' header entry that a default 'nob...@myserver.com' would be used but I do not understand why it is used even when I supply a 'From:...' header entry. From: is used by your mail client to show who it's from. the ini_set (or you can set the 5th param to the mail() function) is a return-path. If the message bounces (recipient's mailbox full, server down, whatever the reason) it gets delivered to that address. They serve different purposes. Does ini_set actually change the php.ini file in any way ? The reason I ask is that after putting in: ini_set('sendmail_from', 'myem...@myserver.com'); into a new script which I tested out against, the 'mail' function now continues to work but no e-mail is received no matter what the recipient e-mail is. Even is I go back to using my old script which does not have the 'ini_set' in it, no e-mail actually gets receoved even though 'mail' succeeds when called. So I have gone from bad to worse and the ini_set seems to have affected all calls to 'mail' in this way for PHP scripts on the server. Can I correct but somehow stopping PHP ( or may Apache ) and restarting it again to bring back the original php.ini setting ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Chris wrote: Edward Diener wrote: Chris wrote: Any light anyone can throw on the 'nob...@myserver.com' address would be most welcome. It is using the apache user @ your host name as the default. Try this: ini_set('sendmail_from', 'whate...@wherever.com'); I will try this but I do not understand why it should work. I have a 'From:...' entry in my headers. Why is this not being used as the primary from address and why is 'nob...@myserver.com' being added instead as the first from address ? In other words, I can understand if I supply no 'From:...' header entry that a default 'nob...@myserver.com' would be used but I do not understand why it is used even when I supply a 'From:...' header entry. From: is used by your mail client to show who it's from. the ini_set (or you can set the 5th param to the mail() function) is a return-path. If the message bounces (recipient's mailbox full, server down, whatever the reason) it gets delivered to that address. They serve different purposes. Does ini_set actually change the php.ini file in any way ? No, it only affects the script it's running in. Comment it out. Check your mail server logs and/or apache/php logs to see if anything is going there. You are correct. The mail server logs showed that a number of outgoing e-mails had been blocked because of an error. Once the outgoing e-mails were released I received my e-mail. It also turns out that the nob...@myserver.com was added to the header as the Reply-To address, not as a primary From address. I should have looked at this myself rather than taken the comment of someone else. I am still trying to investigate why ATT e-mails are not being received but it may have to do with the outgoing mail server and is being investigated by my employer. I will wait on any further script changes until he tells me what is happening with the outgoing mail server. Thanks very much for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unable to send mail from PHP to ATT e-mail address
I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an ATT address, such as my own as an ATT ISP customer, the mail never gets to me. If the 'to' address is anything other than an ATT address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= 'From: Some From Name somefromname.com'; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg.\r\n\r\n,$headers)) echo good; else echo bad; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns good, so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an ATT address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own ATT address also. I have also checked my ATT mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but ATT $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Phpster wrote: On Apr 21, 2009, at 20:32, Edward Diener el...@tropicsoft.com wrote: I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an ATT address, such as my own as an ATT ISP customer, the mail never gets to me. If the 'to' address is anything other than an ATT address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $headers .= 'From: Some From Name somefromname.com'; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg.\r\n\r\n,$headers)) echo good; else echo bad; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns good, so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an ATT address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own ATT address also. I have also checked my ATT mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but ATT $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It might be that the server IP has been blacklisted with att as a domain from which spam is sent. In that case I would have expected the spam to show up in my web mail spam folder. If ATT is blacklisting the sending server IP without even delivering the mail to me as spam, I know of no way to find this out other than trying to talk to an ATT representative. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
kranthi wrote: of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server I doubt ATT will give me access to the log files on their incoming mail server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Chris wrote: kranthi wrote: of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server Somehow I doubt ATT gives out that sort of access ;) Exactly. The idea is right if you have access to both servers though. As you suggested, I can check my own server but I doubt I can get access to ATT's incoming mail server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption/decryption of PHP data
Per Jessen wrote: Edward Diener wrote: Phpster wrote: In reading the license I believe it refers to the gnupg itself, not the application it may be embedded in. You are completely free to use gnupg as you choose including modifying it to meet your needs. I always thought the GNU public license demanded that any non-free modules, which use any software distributed with this license, make their source code freely available to end users. If this is either not the case or no longer the case, then I will be glad to use GnuPG. If you are distributing or selling your non-GPL software and you use GPL software with it, then yes, I believe you are required to make your source code available to the end-user too. The project in which I am working is definitely selling the software and we have no intention of distributing the source code with it. So that leaves GnuPG out. Is there any other PHP public key-private key implementation which I can use which either I will pay for or does not use the Gnu Public license ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption/decryption of PHP data
paragasu wrote: if you want client to send encrypted form to server. then it must be done using some kind of client side script (javascript?). I am using C++. i don't think it is reliable. Why would it not be reliable if I were using a public-key/private-key encryption library which works both with PHP and C++ ? why not just use https protocol. all data between client and server will be encrypted. The data must be encrypted/decrypted going both ways between the client and the server. Does using https automatically do that ? If it does that would be great. On 1/1/09, Per Jessen p...@computer.org wrote: Edward Diener wrote: Phpster wrote: In reading the license I believe it refers to the gnupg itself, not the application it may be embedded in. You are completely free to use gnupg as you choose including modifying it to meet your needs. I always thought the GNU public license demanded that any non-free modules, which use any software distributed with this license, make their source code freely available to end users. If this is either not the case or no longer the case, then I will be glad to use GnuPG. If you are distributing or selling your non-GPL software and you use GPL software with it, then yes, I believe you are required to make your source code available to the end-user too. Maybe have a quick look at http://gpl-violations.org/ /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encryption/decryption of PHP data
Phpster wrote: In reading the license I believe it refers to the gnupg itself, not the application it may be embedded in. You are completely free to use gnupg as you choose including modifying it to meet your needs. I always thought the GNU public license demanded that any non-free modules, which use any software distributed with this license, make their source code freely available to end users. If this is either not the case or no longer the case, then I will be glad to use GnuPG. Bastien Sent from my iPod On Dec 30, 2008, at 10:50 PM, Edward Diener el...@tropicsoft.com wrote: My client application needs to send data to a PHP page in encrypted form and have the PHP code able to decrypt it. Likewise the PHP code needs to return data to my application encrypted and my client application needs to be able to decrypt it. My application is written in C++ and naturally the PHP page is written in PHP. I do understand that public key-private key cryptography is the way to go. So far my Internet search has turrned up GnuPG as a means of doing public key-private key cryptography for PHP with libraries for C++ also. However the client application is a commercial application and unless I misunderstand the GNU General Public License the software of the application which uses GnuPG must allow its source to be freely available in order to use the library. This is of course something which I am completely unwilling to do for the commercial application. Is there any other public key-private key cryptography solution on the PHP side which also has a C++ library which I can use for the client application, which does not adhere to the GNU General Public License ? This does not have to be a free product. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encryption/decryption of PHP data
My client application needs to send data to a PHP page in encrypted form and have the PHP code able to decrypt it. Likewise the PHP code needs to return data to my application encrypted and my client application needs to be able to decrypt it. My application is written in C++ and naturally the PHP page is written in PHP. I do understand that public key-private key cryptography is the way to go. So far my Internet search has turrned up GnuPG as a means of doing public key-private key cryptography for PHP with libraries for C++ also. However the client application is a commercial application and unless I misunderstand the GNU General Public License the software of the application which uses GnuPG must allow its source to be freely available in order to use the library. This is of course something which I am completely unwilling to do for the commercial application. Is there any other public key-private key cryptography solution on the PHP side which also has a C++ library which I can use for the client application, which does not adhere to the GNU General Public License ? This does not have to be a free product. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending mail with Outlook high priority
Is there any PHP functionality for sending mail and attaching a high priority to the mail item ? In Outlook ( and Outlook Express ) there is the notion of a high priority mail item, but I do not know if this corresponds to anything in an RFC for mail. Nor do I know how to mimic this in PHP. If anybody does or could point me to the right functionality, it would be appreciated. Currently I am using the mail() function that is standard in PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending mail with Outlook high priority
Per Jessen wrote: Edward Diener wrote: Is there any PHP functionality for sending mail and attaching a high priority to the mail item ? printf() ? All you need to do is a add header like X-Priority: High. It's just a line of text. Thanks for pointing this header out. My search for X-Priority yields: X-Priority: 1 or X-Priority: 1 (High) as the correct format(s). In Outlook ( and Outlook Express ) there is the notion of a high priority mail item, but I do not know if this corresponds to anything in an RFC for mail. Not too my knowledge. It's a Microsoft standard. Well the X-Priority may do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending mail with Outlook high priority
Per Jessen wrote: Edward Diener wrote: Is there any PHP functionality for sending mail and attaching a high priority to the mail item ? printf() ? All you need to do is a add header like X-Priority: High. It's just a line of text. Thanks for pointing this header out. My search for X-Priority yields: X-Priority: 1 or X-Priority: 1 (High) as the correct format(s). In Outlook ( and Outlook Express ) there is the notion of a high priority mail item, but I do not know if this corresponds to anything in an RFC for mail. Not too my knowledge. It's a Microsoft standard. Well the X-Priority may do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Debugging PHP scripts
I am fairly new to PHP. What is the best way of debugging PHP scripts ? I have put in echo statements to tell me what is happening, but perhaps there are better methods. I have a PHP script on a server, which I access from a client side program ( written in C++ ) and the script is not returning the correct data. I am looking for some easy way to determine what is wrong. Thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Debugging PHP scripts
Dan Joseph wrote: On Fri, Aug 29, 2008 at 11:33 AM, Edward Diener [EMAIL PROTECTED]wrote: I am fairly new to PHP. What is the best way of debugging PHP scripts ? I have put in echo statements to tell me what is happening, but perhaps there are better methods. I have a PHP script on a server, which I access from a client side program ( written in C++ ) and the script is not returning the correct data. I am looking for some easy way to determine what is wrong. Thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Echo's throughout the code isn't a bad way. You can also utilize print_r() and exit() and other things. Really the idea is to set break points, and return data to you that is useful for killing the bug. Its not something that you can simply so Do it like this, as there is really rules to how you should debug really. Just basic deductive reasoning, and some helpful information along the way. Understood. Do you use an IDE at all? You may want to check some out with debuggers built in. That would help you out. I am running on the client, and the PHP script is on a server on another machine. Is there a PHP IDE running from the client which can help me in that sort of situation ? It would really be nice if I could debug in an IDE from the client side, but I suspect I would need to be running on the server machine in order to do so. Of course I can try out the script locally on my client machine and then I would probably be fine. I would have to duplicate the server directory setup in order to do so. I have not looked into PHP IDEs at all so far. Any recommendations ? Thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting JPG to Windows BMP
I have a JPG file on the server which I want to convert to a Windows BMP file. How can I do this in PHP ? I did not see a GD image function for doing this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returning response includes HTML form data
I have a PHP file which does an: echo someresponse to return some data. When I run it from a Windows client program, the response I am seeing is not only the someresponse above but also has the entire HTML form in the PHP file appended to it. Naturally I do not want the form to be included in the response and do not understand how or why I am getting it back ? Does anybody know why this is happening ? As an example of what is happening my form data in the PHP file looks like: form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=name1 TYPE=file input NAME=name2 TYPE=text input NAME=name3 TYPE=text input VALUE=submit TYPE=submit/form Somewhere in the PHP file I am doing: echo someresponse and the data being read back in the response is a string of: someresponse\nform ENCTYPE=multipart/form-data ACTION=METHOD=POST\ninput NAME=name1 TYPE=file\ninput NAME=name2 TYPE=text\ninput NAME=name3 TYPE=text\ninput VALUE=submit TYPE=submit/form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Returning response includes HTML form data
Maciek Sokolewicz wrote: Edward Diener wrote: I have a PHP file which does an: echo someresponse to return some data. When I run it from a Windows client program, the response I am seeing is not only the someresponse above but also has the entire HTML form in the PHP file appended to it. Naturally I do not want the form to be included in the response and do not understand how or why I am getting it back ? Does anybody know why this is happening ? As an example of what is happening my form data in the PHP file looks like: form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=name1 TYPE=file input NAME=name2 TYPE=text input NAME=name3 TYPE=text input VALUE=submit TYPE=submit/form Somewhere in the PHP file I am doing: echo someresponse and the data being read back in the response is a string of: someresponse\nform ENCTYPE=multipart/form-data ACTION=METHOD=POST\ninput NAME=name1 TYPE=file\ninput NAME=name2 TYPE=text\ninput NAME=name3 TYPE=text\ninput VALUE=submit TYPE=submit/form My magical sight into your code reveals nothing. Why? because I can't see it, I don't have any magical sight, so if you don't post any code, I don't know what it is. Now, usually this is simply a designflaw, eg. you have a script like so: ?php // do something echo someresponse; // do something else // do even more echo 'form ENCTYPE=multipart/form-data ACTION=METHOD=POST\ninput NAME=name1 TYPE=file\ninput NAME=name2 TYPE=text\ninput NAME=name3 TYPE=text\ninput VALUE=submit TYPE=submit/form'; // do more stuff ? Probably your code further on doesn't check if you really want to show it or not, there are 2 ways to resolve this: 1. exit after your response (using eg. die() or exit) 2. surround your form with an if() which checks that you really DO wish to show it. But, it might also be something else (though I doubt it), in which case: Post your code, fool!! ([TM] mr. T) Here is the code, with names suitable changed to protect actual functionality of proprietary software: --- ?php if ( ! (isset($_GET['z']) $_GET['z'] == 124) ) { ? script alert( UnAuthorised Access..); window.location =ascript.php; /script ?php echo UnAuthorised Access..; exit; } function MyExampleFunction($param1, $param2, $param3,$param4=) { $param5 = 'Info1' . \r\n; $param5 .= 'Info2' . \r\n; $param5 .= 'Info3'; if(SomePHPFunction($param1,$param3,$param2.\r\n\r\n,$param5)) echo SomePHPFunction called for $param1 OK.\n; else echo Could not call SomePHPFunction for $param1.\nError: .$param4.\n; } if ($_FILES['AFileName']['name'] == ) { echo No AFileName.; exit; } if ($_POST['AInput1'] == ) { echo No AInput1.; exit; } if ($_POST['AInput2'] == ) { echo No AInput2.; exit; } $AVariable1 = $_POST['AInput1']; $AVariable2 = $_POST['AInput2']; $size = filesize($_FILES['AFileName']['tmp_name']); $fp = fopen ($_FILES['AFileName']['tmp_name'], r); $AVariable3 = fread($fp, $size); fclose ($fp); @MyExampleFunction($AVariable1, $AVariable3, $AVariable2); ? form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=AFileName TYPE=file input NAME=AInput1 TYPE=text input NAME=AInput2 TYPE=text input VALUE=submit TYPE=submit/form --- The code takes to input fields and a single file upload, calls the MyExampleFunction, which calls the SomePHPFunction successfully. The SomePHPFunction is a function in one of PHP's libraries. The response comes from the: echo SomePHPFunction called for $param1 OK.\n; statement, plus form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=AFileName TYPE=file input NAME=AInput1 TYPE=text input NAME=AInput2 TYPE=text input VALUE=submit TYPE=submit/form I have no idea why all the form data is being appended to the response. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Returning response includes HTML form data
brian wrote: Edward Diener wrote: Maciek Sokolewicz wrote: Edward Diener wrote: I have a PHP file which does an: echo someresponse to return some data. When I run it from a Windows client program, the response I am seeing is not only the someresponse above but also has the entire HTML form in the PHP file appended to it. Here is the code, with names suitable changed to protect actual functionality of proprietary software: --- ?php if ( ! (isset($_GET['z']) $_GET['z'] == 124) ) { ? script alert( UnAuthorised Access..); window.location =ascript.php; /script ?php echo UnAuthorised Access..; exit; } function MyExampleFunction($param1, $param2, $param3,$param4=) { $param5 = 'Info1' . \r\n; $param5 .= 'Info2' . \r\n; $param5 .= 'Info3'; if(SomePHPFunction($param1,$param3,$param2.\r\n\r\n,$param5)) echo SomePHPFunction called for $param1 OK.\n; else echo Could not call SomePHPFunction for $param1.\nError: .$param4.\n; } if ($_FILES['AFileName']['name'] == ) { echo No AFileName.; exit; } if ($_POST['AInput1'] == ) { echo No AInput1.; exit; } if ($_POST['AInput2'] == ) { echo No AInput2.; exit; } $AVariable1 = $_POST['AInput1']; $AVariable2 = $_POST['AInput2']; $size = filesize($_FILES['AFileName']['tmp_name']); $fp = fopen ($_FILES['AFileName']['tmp_name'], r); $AVariable3 = fread($fp, $size); fclose ($fp); @MyExampleFunction($AVariable1, $AVariable3, $AVariable2); ? form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=AFileName TYPE=file input NAME=AInput1 TYPE=text input NAME=AInput2 TYPE=text input VALUE=submit TYPE=submit/form --- The code takes to input fields and a single file upload, calls the MyExampleFunction, which calls the SomePHPFunction successfully. The SomePHPFunction is a function in one of PHP's libraries. The response comes from the: echo SomePHPFunction called for $param1 OK.\n; statement, plus form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=AFileName TYPE=file input NAME=AInput1 TYPE=text input NAME=AInput2 TYPE=text input VALUE=submit TYPE=submit/form I have no idea why all the form data is being appended to the response. Because you haven't included any conditions to test whether or not to output the form, nor exited the script before the form is parsed. Pick one or the other. I do not understand what you mean by your first statement above when you say 'you haven't included any conditions to test whether or not to output the form'. Am I not 'responding' to the form in my PHP code based on the input parameters to the form in my PHP code ? I also do not understand what you mean by 'nor exited the script before the form is parsed'. Does not the script 'exit' when the PHP code reaches the ending '?' tag ? As I understand it the PHP code, in between the '?php' and '?' tag, is there to process the form, in essence responding to a request on the form. Is this incorrect ? In my PHP code the 'echo' statement sends a response back for the request. Is that not correct ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Returning response includes HTML form data
Benjamin Hawkes-Lewis wrote: Edward Diener wrote: Does not the script 'exit' when the PHP code reaches the ending '?' tag ? Not exactly. PHP processes the remainder of the file too, it just doesn't find any PHP code to execute therein. It does find some text to output, and it outputs it. That text happens to be a form. Now I see. Just like in normal HTML processing a request to a URL which is an HTML page, sends the HTML markup back to the client. My PHP page is a normal HTML page with PHP processing embedded in it. Hit me on the head and wake me up g. How does one stop PHP from outputting data in a PHP file outside of the PHP tags ? Hopefully there is a technique for that. can I just 'exit' in the PHP processing code in order to do that ? It seems that should work and I will try it. In my case I am using the form data just to process the request and not to be sent back to the client, especially as a form itself is not a complete HTML page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Returning response includes HTML form data
Maciek Sokolewicz wrote: Edward Diener wrote: Benjamin Hawkes-Lewis wrote: Edward Diener wrote: Does not the script 'exit' when the PHP code reaches the ending '?' tag ? Not exactly. PHP processes the remainder of the file too, it just doesn't find any PHP code to execute therein. It does find some text to output, and it outputs it. That text happens to be a form. Now I see. Just like in normal HTML processing a request to a URL which is an HTML page, sends the HTML markup back to the client. My PHP page is a normal HTML page with PHP processing embedded in it. Hit me on the head and wake me up g. How does one stop PHP from outputting data in a PHP file outside of the PHP tags ? Hopefully there is a technique for that. can I just 'exit' in the PHP processing code in order to do that ? It seems that should work and I will try it. yes, you can do that. In my case I am using the form data just to process the request and not to be sent back to the client, especially as a form itself is not a complete HTML page. You could also conditially display it, like so: ?php if(isset($_GET['something']) $_GET['something'] == 'something else') { // do something with the data } else { ? form.../form ?php } ? or perhaps like so, by setting a flag: ?php $processed = false; if(isset($_GET['something']) $_GET['something'] == 'something else') { // do something with the data $processed = true; } // lots of stuff going on here if($processed === false) { ? form.../form ?php } ? OK, thanks ! In my case I never want to send the form back to the client since it exists only to handle an HTTP POST on the server side. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using $_GET for POST
In handling an HTTP POST request I came across some PHP code, which I need to modify for my own purposes, which has code like this: if ( ! (isset($_GET['x']) $_GET['x'] == 20) ) { // Do something by returning an error } Can this ever be correct when the form looks like: form ENCTYPE=multipart/form-data ACTION= METHOD=POST input NAME=SomeFile TYPE=file input VALUE=submit TYPE=submit/form ? Is the $_GET possibly being used to check for an 'x' parameter being passed in the query part of the URL ? I am fairly new to PHP so I am trying to understand how $_GET differs from $_POST. Thanks ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php