[PHP] Output Buffering Error? 4.3.10??
Hello, is anyone here getting an intermittent error like this one while running output buffering? Warning: Unexpected character in input: ' in /*//tpl.page.product.php on line 10 Parse error: parse error, unexpected T_STRING in /*//tpl.page.product.php on line 10 if I refresh the page the error goes away and if I shut off the output buffering the error never occurs I am running PHP 4.3.10 on our server... could it be a problem that exsisted in this version Thanks for your help! Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: edit $variable online?
"Jesús Alain Rodríguez Santos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, I have in a php page one ($variable = 85), I woud like to change the > value from this variable online, without any data base, for example ussing > a form where I can put the new value and it change the value of the > $variable. > Do you mean that you have a page like this, for example: 1.php 85 ){ do things; } ?> And you wish to permanently change the value of $variable to 86? You could use file rewriting functions to do this. Look in the manual for fputs, fread, fwrite and their friends. If you wish to change the value temporarily for a single user visit (session), use a session variable to store it. If you wish to change it for a period of time, then perhaps consider using a class to retrieve the variable. > > -- > Este mensaje ha sido analizado por MailScanner > en busca de virus y otros contenidos peligrosos, > y se considera que está limpio. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP 5 limits "readfile" to 1.9 MB?
Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header("Content-Type: application/pdf"); header( "Content-Disposition: inline; filename=\"$filename\""); $len = filesize($file_to_read); header("Content-Length: $len"); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone on the list using Moodle?
On Tue, 2005-08-16 at 17:41 -0400, wayne wrote: > Hi, > Before I post some of the install script for > Moodle I thought that I would ask how > $CFG gets instantiated in the install.php script. > Thanks. > Attach is the first 85 line of the moodle install script.What I would like to know is, if I put some code like this after the use of $CFG-> $default_classes = get_declared_classes (); print "" . "THE BEGINNING = "; foreach ($default_classes as $class_name) print 'the class is ==' . $class_name . ''; shouldn't I see the class that $CFG was instantiated from? Thanks. wayne Description: application/php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: access multiple databases
"Bing Du" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I need to access both MySQL and SQL server 2000 in a PHP script on RHEL > 3. In phpinfo(), I noticed 'supported databases' shows 'MySQL ODBC > PostgreSQL Microsoft SQL Server FrontBase Oracle 8 (oci8)'. And > 'Configure Command' has '--with-unixODBC=shared' included. Do I need to > install anything else, like iodbc? > Have you uncommented extension=php_mssql.dll in php.ini? Are you having any specific problems or error messages? > Would anybody give me some guidance how I should start from here? > > Thanks, > > Bing -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone on the list using Moodle?
On Tue, 2005-08-16 at 17:41 -0400, wayne wrote: > Hi, > Before I post some of the install script for > Moodle I thought that I would ask how > $CFG gets instantiated in the install.php script. > Thanks. > Okay, I got a reply from a moodle user pointing me to an archive, apparently someone had the same question. The answer seems to be that $CFG is an array dressed up as an object.The books that I'm learning from don't show this concept. Could some kind soul give an example. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone on the list using Moodle?
wayne wrote: Okay, I got a reply from a moodle user pointing me to an archive, apparently someone had the same question. The answer seems to be that $CFG is an array dressed up as an object.The books that I'm learning from don't show this concept. Could some kind soul give an example. Thanks. http://php.net/manual/en/language.types.object.php When you use the uninitialised $CFG as an object, an object of class stdClass is created. You can then assign and read stuff to and from its properties, basically like you said, as an "array dressed up as an object". There's no real reason for doing this although it may be a hack because some of the required files in that script may expect a $CFG object to exist. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR and MSSQL
We are using PEAR as our database abstraction layer for connectivity to MSSQL. It seems that, for some inexplicable reason, that our code is losing it's connection to the sql server. We have a section of our site where users can come in and fill out a form to get an insurance quote. Once the form is submitted, there is quite a lot of back end database processing, both read and write, which is happening against the same set of tables for every submission. If just a few people access the site at the same time and submit the form concurrently, things are alright. But once more people start doing so, it seems to cause the sql server to hang. In the middle of the process, one of the users will run a query which causes a problem (and it's not the same every time) and in the middle of the process for the other users, when it goes to try to connect to the database again (via one of the class' that are getting instantiated and executed as part of the overall process), PEAR returns an error saying there is no database selected. The DSN has the correct data and it works when there are fewer users, but for some reason it says that the db has not been selected. So it seems that the cause of that error is in the connect method of the mssql class. We are using persistent connections but for some reason when it goes to try to execute the mssql_pconnect it seems as if the connection PHP has to MSSQL has been severed? But whatever has happened, the only resolution to the problem is restarting apache. As soon as we restart apache, everything starts working again (for the most part). Though, if multiple users go in again and submit the form, PEAR returns that same error (no database selected), the system then hangs and an apache restart is again required. I've gone through all of our code and for the life of me I cannot figure out what might be causing the connection to sever in such a way. As far as I can tell, we aren't leaving any open transactions (though, the symptoms seem to indicate that may be the root cause?) and we really aren't doing anything funky with regards to the queries we are running against the database (other than the sheer number of queries - the application requires *alot* of database processing). So I'm wondering if anyone else has run up against a problem similar to this. We've run this test against 3 different servers and the exact same thing (as described above) happens on all 3. Server 1 specs: Windows 2000 Apache 2.0.53 PHP 4.3.8 MSSQL Server 2000 Enterprise SP3 Server 2 specs: Windows 2003 Apache 2.0.53 PHP 4.3.11 MSSQL Server 2000 Enterprise SP4 Server 3 specs: Windows 2003 Apache 2.0.53 PHP 4.3.11 MSSQL Server 2000 Enterprise SP4 Any help, suggestions or ideas at all would be very appreciated and most welcome! thnx, Chris
Re: [PHP] counting nested array
On 8/17/05, Ing. Josué Aranda <[EMAIL PROTECTED]> wrote: > OK this the little function i made to solve this.. > > function countNested($array){ > foreach($array as $value){ > if(is_array($value)) > $total=$this->countNested($value)+$total; > }else{ > $total=$total+1; > } > } > return $total; > } Looks OK-ish - there's a missing '{' on the third line but apart from that it should work fine as a class method. > any optimizations are welcome You can simplify the if-block as below, which might save you as much as a microsecond or two :-) function countNested($array){ $total = 0; foreach ($array as $value) { $total += is_array($value) ? $this->countNested($value) : 1; } return $total; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'God' has spoken... :-)
On 8/15/05, Miles Thompson <[EMAIL PROTECTED]> wrote: > The problem with PHP 5 is that the ISP's have to be so conservative. > There's no tagging mechanism which says "process these files with PHP5, use > PHP 4 for everything else." > Does anyone here remember that on php 3 the file extensions were .php3? That made moving to php4 easy- files ending in .php3 was parsed as 3, and files ending in .php were parsed as 4. Why not do something similar when moving to 5 or 6? Dotan Cohen http://lyricslist.com/lyrics/artist_albums/118/chumbawamba.php Chumbawamba Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone on the list using Moodle?
On Wed, 2005-08-17 at 04:47 -0400, wayne wrote: > On Tue, 2005-08-16 at 17:41 -0400, wayne wrote: > > Hi, > > Before I post some of the install script for > > Moodle I thought that I would ask how > > $CFG gets instantiated in the install.php script. > > Thanks. > > > Okay, I got a reply from a moodle user pointing > me to an archive, apparently someone had the same > question. The answer seems to be that $CFG is > an array dressed up as an object.The books that > I'm learning from don't show this concept. Could > some kind soul give an example. > Thanks. > I have one other question that I would like answered. One of the respondents in the archive file to the above question said that "in PHP objects don't have to be explicitly instantiated", could someone point me to some docs that explains this.The person never did give an explanation. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone on the list using Moodle?
wayne wrote: I have one other question that I would like answered. One of the respondents in the archive file to the above question said that "in PHP objects don't have to be explicitly instantiated", could someone point me to some docs that explains this.The person never did give an explanation. The post I just sent to the list regarding your earlier question explains this. If you do not instantiate an object before using it, it is automatically instantiated as an object of the stdClass class. You can then add and read attributes, like an "array dressed up as an object." Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LDAP, PHP and MS Active Directory
Apologies if this turns out to be a cross-post. I sent it to the list @ evolt, but have seen no traffic on that list for two days now. --- Hello I am using PHP v5 to write an intranet. The site is hosted on a windows 2000 server running Apache. I want to incorporate some form of Windows authentication to allow or deny access to given resources based on usernames and group membership. I am trying to accomplish this using LDAP. I am able to connect and bind to our Active Directory server (also Windows 2000) from PHP, but when I want to perform a search, I need to know what the base record is. This is in the format o=my company, c=the country it is in. This is where the problem lies. How do I find out this information? Is there some facility in Active Directory that allows me to see what the actual name-values are for all the records (like sn=rees)? The line of code causing the problem is this: $ds is a bound connection to the LDAP server $sr=ldap_search($ds, "o=company name, c=uk", "sn=g*"); It returns "Operations error" Thanks in advance Mark -- www.itsagoodprice.com - top-brand electronics for less. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 5.04 register_globals aint acting right.
Daniel Baughman wrote: Its simply a Boolean to indicate whether or not a query should be ran and displayed, and further more its for a small intranet. Register_globals is the directive I meant to say. But your right about globals. Some applications haven't made that change yet... So unless I want to rewrite them (which is time consuming if you didn't originally write the thing) I need to enable it. stick this in a auto_prepend_file (or at the top of a global include: crude, but not exactly a rewrite. I have the directive in my php.ini, which is defaulted to the %systemdir% in windows... But it certainly isn't registering them... I can easily write an include and stick in to mimic the behaviour.. but was wondering if anyone else ran into these issues. probably the php.ini you are editing is not the same as the file php is using to determine its config. -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 16, 2005 7:27 AM To: Daniel Baughman Cc: php-general@lists.php.net Subject: Re: [PHP] php 5.04 register_globals aint acting right. Daniel Baughman wrote: I have register globals enabled, or set to "On". Isn't this suppose to take all of the $_POST variables and $_GET variables and make initialize them by name? register_globals should do that. but not "register globals", regardless is a shitty setting. don't use it. besides its depreciated just use $_POST['whatever'] i.e. $_POST['runquery'] will be accessible via simply $runquery looks like you are stuffing SQL into a GET/POST param - sure you want to do that? ?? Dan Baughman IT Technician Professional Bull Riders, Inc. 719-471-3008 x 3161 CONFIDENTIAL, FOR DESIGNATED RECIPIENTS ONLY: The preceding e-mail message (including any attachments) contains information that may be confidential, privileged, or non-public information. It is intended to be conveyed only to the designated recipient(s) named above. If you are not an intended recipient, please notify the sender by replying to this message and then delete all copies of it from your computer system. Any use, dissemination, distribution, or reproduction of this message by unintended recipients is not authorized and may be unlawful. DISCLAIMER OF ELECTRONIC TRANSACTION: This communication does not reflect an intention by the sender to conduct a transaction or make any agreement by electronic means. Nothing contained herein shall constitute an electronic signature or a contract under any law, rule or regulation applicable to electronic transactions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Be careful! Look at what this spammer did.
Can you explain exactly what he tried to do. I should probably be able to figure this out, but I'm not feeling too well today. He modded his message to put different email addresses into the message field using mime headers? On 8/16/05, Dotan Cohen <[EMAIL PROTECTED]> wrote: > I have a form that my visitors can email me from. Some jerk is trying > to fool the mail() function into sending his spam, and I got this > today: > > [EMAIL PROTECTED] > Content-Type: multipart/mixed; boundary=\"===0110030565==\" > MIME-Version: 1.0 > Subject: 7510b460 > To: [EMAIL PROTECTED] > bcc: [EMAIL PROTECTED] > From: [EMAIL PROTECTED] > > This is a multi-part message in MIME format. > > --===0110030565== > Content-Type: text/plain; charset=\"us-ascii\" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > > blrt > --===0110030565==-- > > > I just updated the code to stop this. I think that if anybody else has > a form that goes to the mail() function, they should learn from this > email and put up some code to block it. > > Dotan Cohen > http://lyricslist.com/lyrics/artist_albums/367/n_sync.php > N Sync Song Lyrics > > -- > 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] UML/OO/Design Pattern book recommendations?
Hello all! I am readjusting my brain from years of procedural programming and I'm rapidly improving my ability to program object-oriented PHP. I'm no expert but I am keen to get my hands on as much good teaching material as I can. I already have a good appreciation for OO concepts BUT I often tie myself in knots (code myself into a corner) because I don't know how to plan my OO projects "correctly". Can anyone recommend some books that describe: - how to plan OO projects (PHP specific would be good but isn't necessary) - how to use UML (is UML what I am after?) - OO design patterns for web applications Thanks for helping me become a better programmer! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] run remote shell script
My PHP script is in svrA. How do I run a shell script in svrB? svrB does not have PHP and Apache :( Is this at all possible? Please advise. -- Roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting nested array
hahaha, thanks robin you save some seconds of mi life... it looks more "pro" with that if... On 8/17/05, Robin Vickery <[EMAIL PROTECTED]> wrote: > On 8/17/05, Ing. Josué Aranda <[EMAIL PROTECTED]> wrote: > > OK this the little function i made to solve this.. > > > > function countNested($array){ > > foreach($array as $value){ > > if(is_array($value)) > > $total=$this->countNested($value)+$total; > > }else{ > > $total=$total+1; > > } > > } > > return $total; > > } > > Looks OK-ish - there's a missing '{' on the third line but apart from > that it should work fine as a class method. > > > any optimizations are welcome > > You can simplify the if-block as below, which might save you as much > as a microsecond or two :-) > >function countNested($array){ > $total = 0; >foreach ($array as $value) { >$total += is_array($value) ? $this->countNested($value) : 1; >} >return $total; >} > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- JOSUE ARANDA>>> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: run remote shell script
* Roger Thomas <[EMAIL PROTECTED]>: > My PHP script is in svrA. How do I run a shell script in svrB? > svrB does not have PHP and Apache :( > Is this at all possible? Please advise. Use ssh. You will have to setup remote key authentication from svrA to svrB (so that a password will not be needed), and then in your script you would call: system('ssh svrB /path/to/scriptToRun'); -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UML/OO/Design Pattern book recommendations?
Hello Alex On 8/17/05 9:33 AM, "Alex Gemmell" <[EMAIL PROTECTED]> wrote: > Can anyone recommend some books that describe: > - how to plan OO projects (PHP specific would be good but isn't necessary) http://www.amazon.com/exec/obidos/tg/detail/-/1590593804/qid=1124289801/sr=8 -4/ref=pd_bbs_4/103-9475507-6895034?v=glance&s=books&n=507846 > - OO design patterns for web applications http://www.phparch.com/shop_product.php?itemid=96 (disclaimer: I work for the company that published this book). HTH, Marco > > Thanks for helping me become a better programmer! > > Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR and MSSQL
Without wading through all the code and queries it might be difficult to give you an exact answer, but maybe some of us can point out a 'gotcha' or two that you can check. One that jumps to mind that I had issues with using ADODB (abstraction layer), and it was mostly with speed but I could see it causing other issues, is connecting and disconnecting from the database too much. Here's some pseudo code: Bad - foreach $insertlist as $insertdata { dbconnect(); dbinsert($insertdata); dbdisconnect(); } Good - dbconnect(); foreach $insertlist as $insertdata { dbinsert($insertdata); } dbdisconnect(); I was doing it inadvertantly because of the way I had things structured and my use of includes and such. Once I figured out that was causing a LOT of slowdown, I was able to do just one connect and disconnect in a script with lots of insert, update, select, etc statements in the middle. It's possible for a database to reach max # connections and such. If you have a lot of people hammering at a system at once, you may not be closing the connection properly and/or creating too many connections. SQL Server should handle a lot, but even it has it's limits. A random factoid about SQL Server.. and I don't remember the specifics, but if you use @IDENTITY (?) to grab the last inserted ID, you'll get the last inserted ID for any user, not just the the current user who just did an insert. I believe you use @@INDENTITY (double @ sign) to specify the current user's last insert. Some of our developers at my last job had an issue with hitting the wrong ID (on a trigger I believe it was) and causing a mess. I could see where something like that could cause a script to go nuts. Just a (probably unrelated) 'gotcha' when it comes to SQL Server. I'm sure someone else has some snakebites they can share :) -TG = = = Original message = = = We are using PEAR as our database abstraction layer for connectivity to MSSQL. It seems that, for some inexplicable reason, that our code is losing it's connection to the sql server. We have a section of our site where users can come in and fill out a form to get an insurance quote. Once the form is submitted, there is quite a lot of back end database processing, both read and write, which is happening against the same set of tables for every submission. If just a few people access the site at the same time and submit the form concurrently, things are alright. But once more people start doing so, it seems to cause the sql server to hang. In the middle of the process, one of the users will run a query which causes a problem (and it's not the same every time) and in the middle of the process for the other users, when it goes to try to connect to the database again (via one of the class' that are getting instantiated and executed as part of the overall process), PEAR returns an error saying there is no database selected. The DSN has the correct data and it works when there are fewer users, but for some reason it says that the db has not been selected. So it seems that the cause of that error is in the connect method of the mssql class. We are using persistent connections but for some reason when it goes to try to execute the mssql_pconnect it seems as if the connection PHP has to MSSQL has been severed? But whatever has happened, the only resolution to the problem is restarting apache. As soon as we restart apache, everything starts working again (for the most part). Though, if multiple users go in again and submit the form, PEAR returns that same error (no database selected), the system then hangs and an apache restart is again required. I've gone through all of our code and for the life of me I cannot figure out what might be causing the connection to sever in such a way. As far as I can tell, we aren't leaving any open transactions (though, the symptoms seem to indicate that may be the root cause?) and we really aren't doing anything funky with regards to the queries we are running against the database (other than the sheer number of queries - the application requires *alot* of database processing). So I'm wondering if anyone else has run up against a problem similar to this. We've run this test against 3 different servers and the exact same thing (as described above) happens on all 3. Server 1 specs: Windows 2000 Apache 2.0.53 PHP 4.3.8 MSSQL Server 2000 Enterprise SP3 Server 2 specs: Windows 2003 Apache 2.0.53 PHP 4.3.11 MSSQL Server 2000 Enterprise SP4 Server 3 specs: Windows 2003 Apache 2.0.53 PHP 4.3.11 MSSQL Server 2000 Enterprise SP4 Any help, suggestions or ideas at all would be very appreciated and most welcome! thnx, Chris ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] optional argument when creating a function
I'm throwing a warning on a function I created. I thought a & in front of the argument was supposed to make it optional. Is there something else I need to do make that argument optional? //I simplified the code function doEmail($username, &$link) { if (isset($link)) { print "$link $username"; } else { print "$username"; } } doEmail($arg1); doEmail($arg1, $arg2); Here is the error: Warning: Missing argument 2 for doemail() in /srv/www/htdocs/test-a/staff/email_scramble.php on line 24 thanks in advance for any help. -- D. Aaron Germ Scarborough Library, Shepherd University (304) 876-5423 "Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5 limits "readfile" to 1.9 MB?
Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the "readfile" command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header("Content-Type: application/pdf"); header( "Content-Disposition: inline; filename=\"$filename \""); $len = filesize($file_to_read); header("Content-Length: $len"); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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] UML/OO/Design Pattern book recommendations?
Blimey! I'm not a regular to these lists so I certainly didn't expect replies from two names I recognise and respect from my years of trawling the internet for valuable PHP and CSS information! The books you both recommend look like exactly what I am after, with the slight caveat that I am actually using PHP4 at work and these books seem to focus on PHP5. I appreciate the real improvements PHP5 has over PHP4 with regards to OO but I have been a little hesitant to make the leap. Perhaps now I will do so. I've also been toying with a subscription to PHP Architect since it first came out. It felt a bit to advanced for me back then but maybe now I'm ready for it. Congrats Marco - I think you've bagged a new subscriber! (I've had StyleMaster for a short while now so you've already done your work John!) Thanks John and Marco for your swift replies, I'll be sure to check out those books. Alex On 17/08/05, Marco Tabini <[EMAIL PROTECTED]> wrote: > Hello Alex > > On 8/17/05 9:33 AM, "Alex Gemmell" <[EMAIL PROTECTED]> wrote: > > > Can anyone recommend some books that describe: > > - how to plan OO projects (PHP specific would be good but isn't necessary) > > http://www.amazon.com/exec/obidos/tg/detail/-/1590593804/qid=1124289801/sr=8 > -4/ref=pd_bbs_4/103-9475507-6895034?v=glance&s=books&n=507846 > > > - OO design patterns for web applications > > http://www.phparch.com/shop_product.php?itemid=96 > > (disclaimer: I work for the company that published this book). > > HTH, > > > Marco > > > > > Thanks for helping me become a better programmer! > > > > Alex > > > > -- Alex Gemmell |:| [EMAIL PROTECTED] |:| -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How Can I delete an Item of one array
Hi people. How Can I do this. I want to delete an element behind of array?, what function What Can I use? best regards TOMAS - Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia.
Re: [PHP] optional argument when creating a function
D A GERM wrote: I'm throwing a warning on a function I created. I thought a & in front of the argument was supposed to make it optional. Is there something else I need to do make that argument optional? The ampersand does not make it optional. It passes it by reference... http://us2.php.net/manual/en/language.references.php //I simplified the code function doEmail($username, &$link) { if (isset($link)) { print "$link $username"; } else { print "$username"; } } doEmail($arg1); doEmail($arg1, $arg2); Here is the error: Warning: Missing argument 2 for doemail() in /srv/www/htdocs/test-a/staff/email_scramble.php on line 24 To make the second variable optional, give it a value in the argument list when defining the function... function doEmail ( $username, $link = NULL ) { -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How Can I delete an Item of one array
Tomás Rodriguez Orta wrote: Hi people. How Can I do this. I want to delete an element behind of array?, what function What Can I use? The last element in the array? http://us2.php.net/manual/en/function.array-pop.php -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UML/OO/Design Pattern book recommendations?
On 8/17/05 11:08 AM, "Alex Gemmell" <[EMAIL PROTECTED]> wrote: > Blimey! I'm not a regular to these lists so I certainly didn't expect > replies from two names I recognise and respect from my years of > trawling the internet for valuable PHP and CSS information! :) > The books you both recommend look like exactly what I am after, with > the slight caveat that I am actually using PHP4 at work and these > books seem to focus on PHP5. I appreciate the real improvements PHP5 > has over PHP4 with regards to OO but I have been a little hesitant to > make the leap. Perhaps now I will do so. I really think you ought to take a look at PHP 5 -- I used it for my latest project (I'll admit that I only did so because the project was an experiment and I had nothing to lose, but I'm happy I did anyway) and it made a big difference, well beyond the OOP stuff. Incidentally, Jason's book on Design Patterns covers *both* PHP 4 and PHP 5 (when appropriate, there is code for both versions, and the differences in implementations are explained). > I've also been toying with a subscription to PHP Architect since it > first came out. It felt a bit to advanced for me back then but maybe > now I'm ready for it. Congrats Marco - I think you've bagged a new > subscriber! Thanks :) Cheers, Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How Can I delete an Item of one array
> I want to delete an element behind of array?, what function What Can I use? Do you mean remove the last member of an array? If so check out array_pop() at www.php.net raz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] optional argument when creating a function
apparently the ampersand means to treat $link as a reference, not as an optional argument: http://www.softwareprojects.org/php-functions-12.htm I think the way to do it would be to set a default value in your function so that if a value is set by the calling statement that would override it: function doEmail($username, $link = false) { if ($link !=== false) { // "doEmail($arg1, $arg2);" gets sent here print "$link $username"; } else { // "doEmail($arg1);" gets sent here print "$username"; } } haven't tested this, but give it a try. Jordan On Aug 17, 2005, at 10:00 AM, D A GERM wrote: I'm throwing a warning on a function I created. I thought a & in front of the argument was supposed to make it optional. Is there something else I need to do make that argument optional? //I simplified the code function doEmail($username, &$link) { if (isset($link)) { print "$link $username"; } else { print "$username"; } } doEmail($arg1); doEmail($arg1, $arg2); Here is the error: Warning: Missing argument 2 for doemail() in /srv/www/htdocs/test-a/staff/email_scramble.php on line 24 thanks in advance for any help. -- D. Aaron Germ Scarborough Library, Shepherd University (304) 876-5423 "Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy) -- 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] How Can I delete an Item of one array
you use the unset() function: unset($array[$key]); // http://www.php.net/unset you can reindex the keys if they are numeric with: $reindexedArray = array_values($array); // http://www.php.net/ array_values Jordan On Aug 17, 2005, at 1:12 PM, Tomás Rodriguez Orta wrote: Hi people. How Can I do this. I want to delete an element behind of array?, what function What Can I use? best regards TOMAS -- --- Este correo fue escaneado en busca de virus con el MDaemon Antivirus 2.27 en el dominio de correo angerona.cult.cu y no se encontro ninguna coincidencia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5 limits "readfile" to 1.9 MB?
Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the "readfile" command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header("Content-Type: application/pdf"); header( "Content-Disposition: inline; filename=\"$filename \""); $len = filesize($file_to_read); header("Content-Length: $len"); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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] Re: PHP 5 limits "readfile" to 1.9 MB?
Ok, just checking (I am new to the fopen() function). That makes sense. Awesome, thanks! Jordan On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the "readfile" command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header("Content-Type: application/pdf"); header( "Content-Disposition: inline; filename= \"$filename \""); $len = filesize($file_to_read); header("Content-Length: $len"); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PEAR and MSSQL
Chris Boget wrote: > We are using PEAR as our database abstraction layer for connectivity > to MSSQL. It seems that, for some inexplicable reason, that our code > is losing it's connection to the sql server. I've had similar problems in the past, only in my situation it was connecting from a Linux machine to MSSQL via FreeTDS. However, from your description it seems like our problems MIGHT have the same root cause. I would suggest that you try the following: (1) Disable persistent connections. This is just my own personal experience, but I've never been able to get PHP's persistent connection mechanism to work reliably, at least with MSSQL. My experience is that it causes intermittent problems which all seem to indicate that the connections eventually become unreliable or unusable, and the persistent connection code doesn't seem to be able to recover from this situation gracefully. At least with normal connections you don't have to worry about a problem with one request persisting to the next. (2) MSSQL Server seems to have a problem with applications that open many connections in rapid succession. Disabling persistent connections will exacerbate this problem, as a connection will be opened for each request. It seems these problems are caused, at least in part, by SQL server limiting the number of incoming connections it will queue up. This behavior can be controlled by adjusting MSSQL's WinsockListenBacklog setting. The default setting is 5, which means that the server will queue up a maximum of 5 incoming connections. The server will then reset any new connections that come in as long as the queue is full. In my situation, I adjusted this value to 10, and this had a HUGE affect. We still have problems from time to time, but now they are very rare and they could probably be eliminated completely by adjusting this number even higher, I just haven't gotten around to doing that yet. For more information on how to adjust the WinsockListenBacklog setting, see these MS knowledgebase articles: http://support.microsoft.com/default.aspx?kbid=328476 http://support.microsoft.com/kb/154628/EN-US/ The following PHP bug reports seem to be related to this: http://bugs.php.net/bug.php?id=19541 http://bugs.php.net/bug.php?id=29074 Try disabling persistent connections and adjusting the WinsockListenBacklog to 10 and see what results you get. HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP 5 limits "readfile" to 1.9 MB?
turns out it's a known bug, fixed in CVS already... haven't tried the PHP 5.1 beta release yet. http://bugs.php.net/bug.php?id=32970 On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the "readfile" command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header("Content-Type: application/pdf"); header( "Content-Disposition: inline; filename= \"$filename \""); $len = filesize($file_to_read); header("Content-Length: $len"); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Be careful! Look at what this spammer did.
On 8/17/05, Rory Browne <[EMAIL PROTECTED]> wrote: > Can you explain exactly what he tried to do. I should probably be able > to figure this out, but I'm not feeling too well today. > > He modded his message to put different email addresses into the > message field using mime headers? > I'll reply soon off list, as I don't think it appropriate to give potential spammers an archive full of new tricks. Dotan Cohen http://lyricslist.com/lyrics/artist_albums/373/newton-john_olivia.php Newton-John, Olivia Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: optional argument when creating a function
* D A GERM <[EMAIL PROTECTED]>: > I'm throwing a warning on a function I created. I > thought a & in front of the argument was supposed to > make it optional. Is there something else I need to do > make that argument optional? As others have noted, the ampersand tells the function to grab a reference to the variable passed. There are two ways to do optional arguments: 1) Set a default value for the argument (must be last argument in the list, or else all other arguments in the list must also have default values): function doEmail($username, $link = null) {} function doEmail($username, $link = null, $linkName = '') {} 2) Parse the argument list via the func_* functions: function doEmail($username) { $argCount = func_num_args(); if (1 < $argCount) { // Retrieve second argument, from a 0-based array: $link = func_get_arg(1); } ... } function doEmail($username) { $argCount = func_num_args(); if (1 < $argCount) { // Retrieve all arguments $args = func_get_args(); // Remove $username from it array_shift($args); // Get $link: $link = array_shift($args); } ... } -- Matthew Weier O'Phinney Zend Certified Engineer http://weierophinney.net/matthew/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: edit $variable online?
If I were you I'd have a file just to define those kind of values (ie. config.php), wich would be included as needed. On 8/17/05, Mark Rees <[EMAIL PROTECTED]> wrote: > "Jesús Alain Rodríguez Santos" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi, I have in a php page one ($variable = 85), I woud like to change the > > value from this variable online, without any data base, for example ussing > > a form where I can put the new value and it change the value of the > > $variable. > > > > > Do you mean that you have a page like this, for example: > > 1.php > $variable=85; > if( $variable>85 ){ > do things; > } > ?> > > And you wish to permanently change the value of $variable to 86? > > You could use file rewriting functions to do this. Look in the manual for > fputs, fread, fwrite and their friends. > > If you wish to change the value temporarily for a single user visit > (session), use a session variable to store it. If you wish to change it for > a period of time, then perhaps consider using a class to retrieve the > variable. > > > > > > > > -- > > Este mensaje ha sido analizado por MailScanner > > en busca de virus y otros contenidos peligrosos, > > y se considera que está limpio. > > > > -- > 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] Help correcting a form mailer problem...
I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print "You have registered for the: $gmev_day Good Morning East Valley Event."; } } else { print 'You are not registered for any events!'; } The results is this: "You have registered for the: September 9th Good Morning East Valley Event." Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= "You have registered for the: $gmev_day Good Morning East Valley Event.\n"; } } else { $mgs .= "You are not registered for any events!"; } result is - "You have registered for the: on Good Morning East Valley Event." I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help correcting a form mailer problem...
I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print "You have registered for the: $gmev_day Good Morning East Valley Event."; } } else { print 'You are not registered for any events!'; } The results is this: "You have registered for the: September 9th Good Morning East Valley Event." Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= "You have registered for the: $gmev_day Good Morning East Valley Event.\n"; } } else { $mgs .= "You are not registered for any events!"; } result is - "You have registered for the: on Good Morning East Valley Event." I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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] mail()
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() I checked php.ini and everything is open [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] SO why does it not work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
George B wrote: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() I checked php.ini and everything is open [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] SO why does it not work? Do you have a MTA running on localhost? -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
Did you install sendmail? http://www.php.net/mail Requirements For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them. PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/ usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary. On Aug 17, 2005, at 11:48 AM, George B wrote: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() I checked php.ini and everything is open [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] SO why does it not work? -- 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] mail()
Do you have a mail server running? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
Jordan Miller wrote: Did you install sendmail? No sendmail for Windows. He either has to have a Microsoft MTA running on localhost, or use an upstream SMTP account. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
John Nichel wrote: George B wrote: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() I checked php.ini and everything is open [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. sendmail_from = [EMAIL PROTECTED] SO why does it not work? Do you have a MTA running on localhost? No,whats an MTA? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
André Medeiros wrote: Do you have a mail server running? No, how do I get a mail server running? And does it allow me to receive e-mails, or only send? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
George B wrote: John Nichel wrote: Do you have a MTA running on localhost? No,whats an MTA? Mail Transfer Agent. A mail server. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
George B wrote: André Medeiros wrote: Do you have a mail server running? No, how do I get a mail server running? And does it allow me to receive e-mails, or only send? That is way beyond the scope of this list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
John Nichel wrote: Jordan Miller wrote: Did you install sendmail? No sendmail for Windows. He either has to have a Microsoft MTA running on localhost, or use an upstream SMTP account. There is no "Microsoft MTA", I searched google couldnt find anything. so. Anyway, im screwed and I cant send mail. I have a program B1Gmail and its like online mail, but it dosent work because I dont have a mail server and Im using windows. So I cant do anything about it right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ob_start changed from php4 to php5?
Hello, I have a function catching the output of a script: function encodeDomain ($domain) { ob_start(); system("echo '$domain'"); $output = ob_get_contents(); ob_end_clean(); } And I have a php-script using this function: http://www.php.net";); ?> While this worked fine in PHP4, with PHP5.0.4 I always get the following error: Warning: Cannot modify header information - headers already sent in test.php on line 4 The redirect works if I don't use the encodeDomain() function. Does the system-output affect the php-outout status in any way? I checked the raw http-output and I can see nothing of the output from the system()-call. Does maybe PHP simply say "output has been send" although it hasn't been send actually? Regards Marten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail()
Can you send to a smtp server provided by your isp? -Original Message- From: George B [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 18:11 To: php-general@lists.php.net Subject: Re: [PHP] mail() * This e-mail has been received by the Revenue Internet e-mail service. * John Nichel wrote: > Jordan Miller wrote: > >> Did you install sendmail? > > > No sendmail for Windows. He either has to have a Microsoft MTA running > on localhost, or use an upstream SMTP account. > There is no "Microsoft MTA", I searched google couldnt find anything. so. Anyway, im screwed and I cant send mail. I have a program B1Gmail and its like online mail, but it dosent work because I dont have a mail server and Im using windows. So I cant do anything about it right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
George B wrote: John Nichel wrote: Jordan Miller wrote: Did you install sendmail? No sendmail for Windows. He either has to have a Microsoft MTA running on localhost, or use an upstream SMTP account. There is no "Microsoft MTA", I searched google couldnt find anything. so. MTA is a mail server. There *are* MTA's for Microsoft. Anyway, im screwed and I cant send mail. I have a program B1Gmail and its like online mail, but it dosent work because I dont have a mail server and Im using windows. So I cant do anything about it right? You could a) install a MTA, b) use an upstream SMTP provider, or c) setup a *nix box with sendmail|qmail|postfix|etc. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail()
[snip] There is no "Microsoft MTA", I searched google couldnt find anything. so. [/snip] http://www.google.com/search?hl=en&q=windows+mail+transfer+agent Lots of options... http://www.google.com/search?hl=en&lr=&q=Microsoft+MTA Actually turned up a lot of stuff. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Be careful! Look at what this spammer did.
> I'll reply soon off list, as I don't think it appropriate to give > potential spammers an archive full of new tricks. I don't know -- I think its always better to discuss this in the open if there is a real security risk that people should be aware of. A couple days after your posting to PHP-General, I saw the same kind of probe on my system: Content-Type: multipart/mixed; boundary="===0493326424==" MIME-Version: 1.0 Subject: c3b8e7fc To: [EMAIL PROTECTED] bcc: [EMAIL PROTECTED] From: [EMAIL PROTECTED] This is a multi-part message in MIME format. --===0493326424== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit awhvtr --===0493326424==-- This was submitted through a simple web contact form with a message, subject, and body form fields. The hakor submitted the above as the body of the message 3-4 times than seemed to give up (although he did send a few obnoxious threats). I don't believe this did anything because 1) I never got a bounce message from the made-up address he attempted to send to ("[EMAIL PROTECTED]") 2) I believe that since the mail function already sent out the headers, any subsequent "headers" would just be ignored. Or they would be treated as text since they occurred in the message portion and not parsed literally. Not sure that there is any risk here, but I'm shrouding my contact script (changing the form variables and script name to something less obvious) just in case. - Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
Shaw, Chris - Accenture wrote: Can you send to a smtp server provided by your isp? -Original Message- From: George B [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 18:11 To: php-general@lists.php.net Subject: Re: [PHP] mail() * This e-mail has been received by the Revenue Internet e-mail service. * John Nichel wrote: Jordan Miller wrote: Did you install sendmail? No sendmail for Windows. He either has to have a Microsoft MTA running on localhost, or use an upstream SMTP account. There is no "Microsoft MTA", I searched google couldnt find anything. so. Anyway, im screwed and I cant send mail. I have a program B1Gmail and its like online mail, but it dosent work because I dont have a mail server and Im using windows. So I cant do anything about it right? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * yeah I can send to the SMTP server of my ISP, but no where else. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail()
yeah I can send to the SMTP server of my ISP, but no where else. If you can send to the smtp server then your ISP should deliver the email. If you have not filled in the sendmail_from var in the php.ini correctly, they cannot send back a mail saying there was a problem with the delivery. This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Be careful! Look at what this spammer did.
Greg Schnippel wrote: I'll reply soon off list, as I don't think it appropriate to give potential spammers an archive full of new tricks. I don't know -- I think its always better to discuss this in the open if there is a real security risk that people should be aware of. I tend to agree on things like this. If it's a generic problem then I think it does everyone some good to discuss it in the open. Although I can see the point of not discussing specific problems with specific applications, at least not until a fix is in and notices have been sent out. Then I think it falls back to the "it does everyone some good to have it in the open" senerio. I learn a lot from my mistakes, but I also learn from other's mistakes too, if I'm given the chance. 2) I believe that since the mail function already sent out the headers, any subsequent "headers" would just be ignored. Or they would be treated as text since they occurred in the message portion and not parsed literally. I was wondering the same thing. That it would just send the message and the MTA's would ignore any other addresses listed in the actual message text. Not sure that there is any risk here, but I'm shrouding my contact script (changing the form variables and script name to something less obvious) just in case. - Greg I think I'm just going to generate some random number to submit to the processor and if it's not there then ignore it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: optional argument when creating a function
Thank you everyone for your help. I tried this and it worked with throwing any errors. function doEmail($username, $link = null) Matthew Weier O'Phinney wrote: * D A GERM <[EMAIL PROTECTED]>: I'm throwing a warning on a function I created. I thought a & in front of the argument was supposed to make it optional. Is there something else I need to do make that argument optional? As others have noted, the ampersand tells the function to grab a reference to the variable passed. There are two ways to do optional arguments: 1) Set a default value for the argument (must be last argument in the list, or else all other arguments in the list must also have default values): function doEmail($username, $link = null) {} function doEmail($username, $link = null, $linkName = '') {} 2) Parse the argument list via the func_* functions: function doEmail($username) { $argCount = func_num_args(); if (1 < $argCount) { // Retrieve second argument, from a 0-based array: $link = func_get_arg(1); } ... } function doEmail($username) { $argCount = func_num_args(); if (1 < $argCount) { // Retrieve all arguments $args = func_get_args(); // Remove $username from it array_shift($args); // Get $link: $link = array_shift($args); } ... } -- D. Aaron Germ Scarborough Library, Shepherd University (304) 876-5423 "Well then what am I supposed to do with all my creative ideas- take a bath and wash myself with them? 'Cause that is what soap is for" (Peter, Family Guy) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start changed from php4 to php5?
This doesn't help with your ob problem, but if you simply want to capture the output of the system cmd, then you can use $output = shell_exec($command) instead of system() IIRC. On 8/17/05, Marten Lehmann <[EMAIL PROTECTED]> wrote: > Hello, > > I have a function catching the output of a script: > > function encodeDomain ($domain) { > ob_start(); > system("echo '$domain'"); > $output = ob_get_contents(); > ob_end_clean(); > } > > And I have a php-script using this function: > > > encodeDomain($domain); > header("Location: http://www.php.net";); > > ?> > > While this worked fine in PHP4, with PHP5.0.4 I always get the following > error: > > Warning: Cannot modify header information - headers already sent in > test.php on line 4 > > The redirect works if I don't use the encodeDomain() function. Does the > system-output affect the php-outout status in any way? I checked the raw > http-output and I can see nothing of the output from the system()-call. > Does maybe PHP simply say "output has been send" although it hasn't been > send actually? > > Regards > Marten > > -- > 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] Re: PHP 5 limits "readfile" to 1.9 MB?
Just for your information there was a topic on this a few months ago. It definately wasn't intentional - Rasmus didn't know about it until then. On 8/17/05, Jordan Miller <[EMAIL PROTECTED]> wrote: > turns out it's a known bug, fixed in CVS already... haven't tried the > PHP 5.1 beta release yet. > > http://bugs.php.net/bug.php?id=32970 > > > > On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: > > > Hi, > > > > Indeed a fclose($fp) is needed (wrote it as an example :)). > > 1MB is more than enough as a buffer. If you have a 53MB file, > > what will happen then ? > > I have no idea if it's a bug or a feature. Either way I did lose > > some hair over this when I switched from PHP4 to PHP5. > > > > Catalin > > > > > > Jordan Miller wrote: > > > >> Catalin, > >> Wow, that worked great, thanks. > >> I'm curious why you set a static buffer of 1024768... why not just > >> do filesize($file), as shown at http://www.php.net/fread ? Is it > >> better for memory usage to have a potentially smaller buffer? > >> Also, you may want an fclose($fp) after the file has been > >> downloaded. > >> So is this a bug in PHP 5 or are they just purposely limiting the > >> abilities of the "readfile" command? > >> Jordan > >> On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: > >> > >>> Hi, > >>> > >>> I've had a similar problem. The download always stopped at > >>> exactly 2.000.000 bytes. > >>> You have to work around that with: > >>> $fp = fopen($file, 'r'); > >>> if($fp) { > >>> while(!feof($fp)) { > >>> echo fread($fp, 1024768);//see the huge buffer to read into > >>> } > >>> } else { > >>> //whatever error handler > >>> } > >>> > >>> Catalin > >>> > >>> > >>> Jordan Miller wrote: > >>> > >>> > >>> > Hello all, > I am new to this list and I have searched the archives to no > avail. I am having a peculiar problem when upgrading to PHP 5: > My downloads are now limited to the first 1.9 MB of the file > in question, with the download either terminating at 1.9 MB > or seemingly continuously stuck in a downloading process at > 1.9 MB. The code in the PHP script has not changed and all > parameters that I could find that are relevant to this problem > are given below: > the minimal code needed for download: > // $file_to_read is the complete path of the file to > download > header("Content-Type: application/pdf"); > header( "Content-Disposition: inline; filename= > \"$filename \""); > $len = filesize($file_to_read); > header("Content-Length: $len"); > @readfile($file_to_read); > php.ini file for both php version 4 and 5 contain the > following settings that may be relevant: > allow_url_fopen = On > max_execution_time = 300 ; Maximum execution time of each > script, in seconds > max_input_time = 300; Maximum amount of time each script > may spend parsing request data > memory_limit = 8M ; Maximum amount of memory a script may > consume (8MB) > post_max_size = 200M > upload_max_filesize = 200M > Some additional details: > All files less than 1.9 MB download fine > It is not a corrupted file, because all files larger than 1.9 > MB fail after 1.9 MB > The connection is not timing out (download of 1.9 MB takes only > ~15 sec) > Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 > Fails for both Safari and Firefox > Fails regardless of "inline" or "attachment" > Fails regardless of "pdf" or "ppt" content-type > This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with > the same settings, above > What am I doing wrong??? Any other parameter in php.ini I > should have set? Any suggestions are much appreciated. > thanks, > Jordan > > > > >>> > >>> -- > >>> 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 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] mail()
Shaw, Chris - Accenture wrote: yeah I can send to the SMTP server of my ISP, but no where else. If you can send to the smtp server then your ISP should deliver the email. If you have not filled in the sendmail_from var in the php.ini correctly, they cannot send back a mail saying there was a problem with the delivery. This message has been delivered to the Internet by the Revenue Internet e-mail service * Ok guys! It has sent the mail succesfully everywhere! Now one more thing. How do I make it so I can receive mail? I am using my ISP's POP server but I dosent send back because my e-mail is [EMAIL PROTECTED] How do I setup my own domain and does it cost money for an e-mail? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
Why not change the email address to be a valid one and receive through your ISP. On 8/17/05 11:28 AM, "George B" <[EMAIL PROTECTED]> wrote: > Shaw, Chris - Accenture wrote: >> >> yeah I can send to the SMTP server of my ISP, but no where else. >> >> >> If you can send to the smtp server then your ISP should deliver the email. >> >> If you have not filled in the sendmail_from var in the php.ini correctly, >> they cannot send back a mail saying there was a problem with the delivery. >> >> >> >> >> >> >> This message has been delivered to the Internet by the Revenue Internet >> e-mail service >> >> * > Ok guys! It has sent the mail succesfully everywhere! Now one more > thing. How do I make it so I can receive mail? I am using my ISP's POP > server but I dosent send back because my e-mail is [EMAIL PROTECTED] How > do I setup my own domain and does it cost money for an e-mail? -- Stephen Johnson The Lone Coder [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
George B wrote: Ok guys! It has sent the mail succesfully everywhere! Now one more thing. How do I make it so I can receive mail? I am using my ISP's POP server but I dosent send back because my e-mail is [EMAIL PROTECTED] How do I setup my own domain and does it cost money for an e-mail? Read the manual about the mail function to set who the mail is coming from. http://us2.php.net/manual/en/function.mail.php Setting up your own domain is beyond the scope of this mailing list. Google is your friend. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail()
Ok guys! It has sent the mail succesfully everywhere! Now one more thing. How do I make it so I can receive mail? I am using my ISP's POP server but I dosent send back because my e-mail is [EMAIL PROTECTED] How do I setup my own domain and does it cost money for an e-mail? I suggest you contact your isp or consult a FAQ on your isp website in setting up your mail client on your machine, they will also tell you what your *real* email address is. If you want to set up your own domain, there are plenty of companies on the web offering this service. But this isn't php talk and you'll get flamed by the self proclaimed php police. This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
If you want to receive e-mails from the outside, yes, you'll have to register a domain, configure an MTA to work on windows and all that jazz. Besides, if you want to manage pop, you might as well start looking at the php4-imap / php5-imap module to be able to work with POP more easily. I might be mistaken, but I believe that installing an MTA on your PC will allow you to send/receive e-mails locally. Not sure if that suffices for your sittuation though. Either way, check Jay's google queries. They might give you an insight on some MTA servers you can use (I had to code a webmail application once and I found a few free MTA servers, so I believe you'll be able to do that to without breaking a swet :) Good luck with your project! On 8/17/05, George B <[EMAIL PROTECTED]> wrote: > Shaw, Chris - Accenture wrote: > > > > yeah I can send to the SMTP server of my ISP, but no where else. > > > > > > If you can send to the smtp server then your ISP should deliver the email. > > > > If you have not filled in the sendmail_from var in the php.ini correctly, > > they cannot send back a mail saying there was a problem with the delivery. > > > > > > > > > > > > > > This message has been delivered to the Internet by the Revenue Internet > > e-mail service > > > > * > Ok guys! It has sent the mail succesfully everywhere! Now one more > thing. How do I make it so I can receive mail? I am using my ISP's POP > server but I dosent send back because my e-mail is [EMAIL PROTECTED] How > do I setup my own domain and does it cost money for an e-mail? > > -- > 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] Re: PHP 5 limits "readfile" to 1.9 MB?
I know there was ! No one said it was intentional ! Catalin Rory Browne wrote: Just for your information there was a topic on this a few months ago. It definately wasn't intentional - Rasmus didn't know about it until then. On 8/17/05, Jordan Miller <[EMAIL PROTECTED]> wrote: turns out it's a known bug, fixed in CVS already... haven't tried the PHP 5.1 beta release yet. http://bugs.php.net/bug.php?id=32970 On Aug 17, 2005, at 10:19 AM, Catalin Trifu wrote: Hi, Indeed a fclose($fp) is needed (wrote it as an example :)). 1MB is more than enough as a buffer. If you have a 53MB file, what will happen then ? I have no idea if it's a bug or a feature. Either way I did lose some hair over this when I switched from PHP4 to PHP5. Catalin Jordan Miller wrote: Catalin, Wow, that worked great, thanks. I'm curious why you set a static buffer of 1024768... why not just do filesize($file), as shown at http://www.php.net/fread ? Is it better for memory usage to have a potentially smaller buffer? Also, you may want an fclose($fp) after the file has been downloaded. So is this a bug in PHP 5 or are they just purposely limiting the abilities of the "readfile" command? Jordan On Aug 17, 2005, at 3:36 AM, Catalin Trifu wrote: Hi, I've had a similar problem. The download always stopped at exactly 2.000.000 bytes. You have to work around that with: $fp = fopen($file, 'r'); if($fp) { while(!feof($fp)) { echo fread($fp, 1024768);//see the huge buffer to read into } } else { //whatever error handler } Catalin Jordan Miller wrote: Hello all, I am new to this list and I have searched the archives to no avail. I am having a peculiar problem when upgrading to PHP 5: My downloads are now limited to the first 1.9 MB of the file in question, with the download either terminating at 1.9 MB or seemingly continuously stuck in a downloading process at 1.9 MB. The code in the PHP script has not changed and all parameters that I could find that are relevant to this problem are given below: the minimal code needed for download: // $file_to_read is the complete path of the file to download header("Content-Type: application/pdf"); header( "Content-Disposition: inline; filename= \"$filename \""); $len = filesize($file_to_read); header("Content-Length: $len"); @readfile($file_to_read); php.ini file for both php version 4 and 5 contain the following settings that may be relevant: allow_url_fopen = On max_execution_time = 300 ; Maximum execution time of each script, in seconds max_input_time = 300; Maximum amount of time each script may spend parsing request data memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) post_max_size = 200M upload_max_filesize = 200M Some additional details: All files less than 1.9 MB download fine It is not a corrupted file, because all files larger than 1.9 MB fail after 1.9 MB The connection is not timing out (download of 1.9 MB takes only ~15 sec) Mac OS X 10.3.9 with Marc Liyanage's PHP 5.0.4 Fails for both Safari and Firefox Fails regardless of "inline" or "attachment" Fails regardless of "pdf" or "ppt" content-type This PHP code ALWAYS works for Marc Liyanage's PHP 4.3.4 with the same settings, above What am I doing wrong??? Any other parameter in php.ini I should have set? Any suggestions are much appreciated. thanks, Jordan -- 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 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] mail()
André Medeiros wrote: If you want to receive e-mails from the outside, yes, you'll have to register a domain, configure an MTA to work on windows and all that jazz. Besides, if you want to manage pop, you might as well start looking at the php4-imap / php5-imap module to be able to work with POP more easily. I might be mistaken, but I believe that installing an MTA on your PC will allow you to send/receive e-mails locally. Not sure if that suffices for your sittuation though. Either way, check Jay's google queries. They might give you an insight on some MTA servers you can use (I had to code a webmail application once and I found a few free MTA servers, so I believe you'll be able to do that to without breaking a swet :) Good luck with your project! On 8/17/05, George B <[EMAIL PROTECTED]> wrote: Shaw, Chris - Accenture wrote: yeah I can send to the SMTP server of my ISP, but no where else. If you can send to the smtp server then your ISP should deliver the email. If you have not filled in the sendmail_from var in the php.ini correctly, they cannot send back a mail saying there was a problem with the delivery. This message has been delivered to the Internet by the Revenue Internet e-mail service * Ok guys! It has sent the mail succesfully everywhere! Now one more thing. How do I make it so I can receive mail? I am using my ISP's POP server but I dosent send back because my e-mail is [EMAIL PROTECTED] How do I setup my own domain and does it cost money for an e-mail? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Can you send a link to a free MTA server please?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Be careful! Look at what this spammer did.
On 8/17/05, Greg Schnippel <[EMAIL PROTECTED]> wrote: > > I'll reply soon off list, as I don't think it appropriate to give > > potential spammers an archive full of new tricks. > > I don't know -- I think its always better to discuss this in the open > if there is a real security risk that people should be aware of. > > A couple days after your posting to PHP-General, I saw the same kind > of probe on my system: > > > Content-Type: multipart/mixed; boundary="===0493326424==" > MIME-Version: 1.0 > Subject: c3b8e7fc > To: [EMAIL PROTECTED] > bcc: [EMAIL PROTECTED] > From: [EMAIL PROTECTED] > > This is a multi-part message in MIME format. > > --===0493326424== > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > > awhvtr > --===0493326424==-- > > > This was submitted through a simple web contact form with a message, > subject, and body form fields. The hakor submitted the above as the > body of the message 3-4 times than seemed to give up (although he did > send a few obnoxious threats). I don't believe this did anything > because > > 1) I never got a bounce message from the made-up address he attempted > to send to ("[EMAIL PROTECTED]") > > 2) I believe that since the mail function already sent out the > headers, any subsequent "headers" would just be ignored. Or they would > be treated as text since they occurred in the message portion and not > parsed literally. > > Not sure that there is any risk here, but I'm shrouding my contact > script (changing the form variables and script name to something less > obvious) just in case. > > - Greg I believe that sendmail would send the two emails. How could it know that the headers are not part of a new message? I haven't tested it yet, but to be on the safe side I put up some filters that chech for certain content in the form. If the content is there, then nothing gets sent to mail(). Just a little while the spammer sent me message with the form, regarding his opinion of myself, my mother, a horse, and a dead man. His IP was 80.172.48.102 Dotan Cohen http://lyricslist.com/lyrics/artist_albums/332/mccartney_paul.php McCartney, Paul Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help correcting a form mailer problem...
thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would first start out by dumping the values of $_POST['gmev'] by using > > print_r($_POST['gmev']); > > Sounds to me like you're not getting the data that your expecting > from the form for some reason. Maybe $_POST['gmev'] is an array of > null values? > > -Good Luck > > On Aug 17, 2005, at 12:15 PM, zedleon wrote: > > > I previously built a sticky form with dynamic checkbox > > array's. > > The form works beautifully thanks to help from Jochem Mass and > > Kathleen > > Ballard. > > > > I now have a slightly different problem...I have built an email > > form to send > > the form data. > > I copied and used the following code which works great in the sticky > > form. > > > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > >foreach ($_POST['gmev'] as $gmev_day) { > > > >print "You have registered for the: $gmev_day Good > > Morning East > > Valley Event."; > > } > > > > } else { > > > >print 'You are not registered for any events!'; > > > > } > > > > The results is this: > >"You have registered for the: September 9th Good Morning > > East > > Valley Event." > > > > Now when I use the same code modified for the form mailer I am > > getting this > > result. > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > > foreach ($_POST['gmev'] as $gmev_day) { > > > > $msg .= "You have registered for the: $gmev_day Good Morning East > > Valley > > Event.\n"; > > } > > > > } else { > > > >$mgs .= "You are not registered for any events!"; > > } > > > > result is - "You have registered for the: on Good Morning > > East > > Valley Event." > > > > I am missing the value of the variable even though I am receiving > > all the > > instances of the variables from the checkboxes. When they are > > selected, they > > are present. > > > > I really don't know what to do about correcting the problem. Any > > guidance > > here would really be appreciatedand...go easy on me...I am new > > to PHP > > > > Thanks before hand... > > > > zedleon > > > > -- > > 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] Help correcting a form mailer problem...
wherever you think you are adding data to the gmev array, you are merely adding the "on" string. I would search your script for the string "on" and you will find the problem. what you need is the value in the HTML form to be the text you want inserted into the array, such as: Jordan On Aug 17, 2005, at 3:30 PM, zedleon wrote: thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print "You have registered for the: $gmev_day Good Morning East Valley Event."; } } else { print 'You are not registered for any events!'; } The results is this: "You have registered for the: September 9th Good Morning East Valley Event." Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= "You have registered for the: $gmev_day Good Morning East Valley Event.\n"; } } else { $mgs .= "You are not registered for any events!"; } result is - "You have registered for the: on Good Morning East Valley Event." I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem using Metabase
Hello, on 08/16/2005 10:17 PM Pablo Gosse said the following: [snip] I suspect that the problem is with file permissions. I recall that since Metabase uses include to load class files, the script will not exit when it fails to include a PHP class file. Assuming that is the case, make sure that all Metabase class files are readable by your Web server user. [/snip] The permissions seem fine. However, I've discovered something else. I was able to use Metabase without any trouble on a linux server to access a Postgres database. I then removed the call to MetabaseSetDatabase and changed the drive to odbc-msaccess, and the errors returned. Changed it back to pgsql or mysql and the errors go away. I just now tried this on the IIS box and got the same results. If I specify postgres I get an error telling me that postgres is not enabled in that php implementation, and if I specify mysql it works fine. If I change it back to odbc-msaccess, the errors are there. So, the error message I get is only triggered when I specify Access as the database. Does this provide any further insight? Not really but I looked again at your error message and sample script and realized a few things that seem to be the problem. Your error message said: Fatal error: Class metabase_manager_odbc_class: Cannot inherit from undefined class metabase_manager_database_class in C:\Inetpub\wwwroot\etrakFE\classes\metabase\metabase_odbc.php on line 13 There is no class definition on line 13 of metabase_odbc.php . That definition is in manager_odbc.php. So I wonder if you did not typed the error message with inadverted changes. In your example you call SetDatabase. That does not make Metabase load the ODBC driver schema manager extension. I suspect that you meant CreateDatabase. That would trigger the extension class loading and eventual errors. If you are sure permissions are ok, the only other possibility to make the class loading include fail is incorrect include path. I suspect you need to specify absolute path to make it work. What is your include path in php.ini? Anyway, I changed Metabase base class to make it gracefully fail (not make PHP exit with a fatal error) if any of the extension include files does not load properly for some reason. Please try the updated version getting it from CVS or a current snapshot that you can download from here: http://www.meta-language.net/download.html#snapshots Metabase is inside the archive: http://www.meta-language.net/download/metal-cvs.zip or http://www.meta-language.net/download/metal-cvs.tar.gz Once you use this version your script should no longer exit with a fatal error. It should fail but a call to $db->Error() should return a meaningful error message. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Be careful! Look at what this spammer did.
I believe that sendmail would send the two emails. How could it know that the headers are not part of a new message? I haven't tested it yet, but to be on the safe side I put up some filters that chech for certain content in the form. If the content is there, then nothing gets sent to mail(). Just a little while the spammer sent me message with the form, regarding his opinion of myself, my mother, a horse, and a dead man. His IP was 80.172.48.102 Dotan Cohen http://lyricslist.com/lyrics/artist_albums/332/mccartney_paul.php McCartney, Paul Song Lyrics I just tried it on my hosted account and only got the one email that I was supposed to get. Maybe there's an old sendmail exploit that would send the second mail? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail()
George B wrote: Can you send a link to a free MTA server please?? I don't mean to be rude, but this is getting beyond a joke. This is a PHP mailing list, not a PHP-and-MTAs-and-domains-and-everything-in-between mailing list. Google is your friend: http://www.google.com/search?q=free+MTA+server Now surely you could have managed that? Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help correcting a form mailer problem...
Sorry I should clarify... checkboxes don't send their values through they send their names and states... so if you have the array: Name="qmev[1]"... name="qmev[2]"... name="qmev[3]" And your array contains [1] => on : [3] => on 1 and 3 are selected -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would first start out by dumping the values of $_POST['gmev'] by using > > print_r($_POST['gmev']); > > Sounds to me like you're not getting the data that your expecting > from the form for some reason. Maybe $_POST['gmev'] is an array of > null values? > > -Good Luck > > On Aug 17, 2005, at 12:15 PM, zedleon wrote: > > > I previously built a sticky form with dynamic checkbox > > array's. > > The form works beautifully thanks to help from Jochem Mass and > > Kathleen > > Ballard. > > > > I now have a slightly different problem...I have built an email > > form to send > > the form data. > > I copied and used the following code which works great in the sticky > > form. > > > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > >foreach ($_POST['gmev'] as $gmev_day) { > > > >print "You have registered for the: $gmev_day Good > > Morning East > > Valley Event."; > > } > > > > } else { > > > >print 'You are not registered for any events!'; > > > > } > > > > The results is this: > >"You have registered for the: September 9th Good Morning > > East > > Valley Event." > > > > Now when I use the same code modified for the form mailer I am > > getting this > > result. > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > > foreach ($_POST['gmev'] as $gmev_day) { > > > > $msg .= "You have registered for the: $gmev_day Good Morning East > > Valley > > Event.\n"; > > } > > > > } else { > > > >$mgs .= "You are not registered for any events!"; > > } > > > > result is - "You have registered for the: on Good Morning > > East > > Valley Event." > > > > I am missing the value of the variable even though I am receiving > > all the > > instances of the variables from the checkboxes. When they are > > selected, they > > are present. > > > > I really don't know what to do about correcting the problem. Any > > guidance > > here would really be appreciatedand...go easy on me...I am new > > to PHP > > > > Thanks before hand... > > > > zedleon > > > > -- > > 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help correcting a form mailer problem...
Hi If the checkbox exists in the array it is selected... if it isn't there it's not selected That's my experience :) -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would first start out by dumping the values of $_POST['gmev'] by using > > print_r($_POST['gmev']); > > Sounds to me like you're not getting the data that your expecting > from the form for some reason. Maybe $_POST['gmev'] is an array of > null values? > > -Good Luck > > On Aug 17, 2005, at 12:15 PM, zedleon wrote: > > > I previously built a sticky form with dynamic checkbox > > array's. > > The form works beautifully thanks to help from Jochem Mass and > > Kathleen > > Ballard. > > > > I now have a slightly different problem...I have built an email > > form to send > > the form data. > > I copied and used the following code which works great in the sticky > > form. > > > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > >foreach ($_POST['gmev'] as $gmev_day) { > > > >print "You have registered for the: $gmev_day Good > > Morning East > > Valley Event."; > > } > > > > } else { > > > >print 'You are not registered for any events!'; > > > > } > > > > The results is this: > >"You have registered for the: September 9th Good Morning > > East > > Valley Event." > > > > Now when I use the same code modified for the form mailer I am > > getting this > > result. > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > > foreach ($_POST['gmev'] as $gmev_day) { > > > > $msg .= "You have registered for the: $gmev_day Good Morning East > > Valley > > Event.\n"; > > } > > > > } else { > > > >$mgs .= "You are not registered for any events!"; > > } > > > > result is - "You have registered for the: on Good Morning > > East > > Valley Event." > > > > I am missing the value of the variable even though I am receiving > > all the > > instances of the variables from the checkboxes. When they are > > selected, they > > are present. > > > > I really don't know what to do about correcting the problem. Any > > guidance > > here would really be appreciatedand...go easy on me...I am new > > to PHP > > > > Thanks before hand... > > > > zedleon > > > > -- > > 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help correcting a form mailer problem...
Sorry, I believe you are mistaken here... you *can* specify a value for each checkbox and have it come through. I have written scripts that do this, and here is another example: http://www.tizag.com/phpT/examples/formex.php/ all zedleon needs to do is add the correct value parameter to each checkbox. Jordan On Aug 17, 2005, at 3:57 PM, <[EMAIL PROTECTED]> wrote: Sorry I should clarify... checkboxes don't send their values through they send their names and states... so if you have the array: Name="qmev[1]"... name="qmev[2]"... name="qmev[3]" And your array contains [1] => on : [3] => on 1 and 3 are selected -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print "You have registered for the: $gmev_day Good Morning East Valley Event."; } } else { print 'You are not registered for any events!'; } The results is this: "You have registered for the: September 9th Good Morning East Valley Event." Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= "You have registered for the: $gmev_day Good Morning East Valley Event.\n"; } } else { $mgs .= "You are not registered for any events!"; } result is - "You have registered for the: on Good Morning East Valley Event." I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- 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] Be careful! Look at what this spammer did.
In a message dated 8/17/2005 1:17:54 P.M. Central Standard Time, [EMAIL PROTECTED] writes: >I tend to agree on things like this. If it's a generic problem then I >think it does everyone some good to discuss it in the open. Although I >can see the point of not discussing specific problems with specific >applications, at least not until a fix is in and notices have been sent >out. Then I think it falls back to the "it does everyone some good to >have it in the open" senerio. I learn a lot from my mistakes, but I also >learn from other's mistakes too, if I'm given the chance. I agree as well... I was just reading about the whole thing at the Black Hat convention in Vegas, what some were jokingly calling "Ciscogate". These problems should definitely be discussed out in the open so people can know about the problem - not just 'developers of the product'. - Clint
RE: [PHP] Help correcting a form mailer problem...
I do apologise... it's been one of those days and the form I was thinking of didn't actually have any values attached to the checkbox Ignore me :) -Original Message- From: Jordan Miller [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 22:28 To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... Sorry, I believe you are mistaken here... you *can* specify a value for each checkbox and have it come through. I have written scripts that do this, and here is another example: http://www.tizag.com/phpT/examples/formex.php/ all zedleon needs to do is add the correct value parameter to each checkbox. Jordan On Aug 17, 2005, at 3:57 PM, <[EMAIL PROTECTED]> wrote: > Sorry I should clarify... checkboxes don't send their values > through they > send their names and states... so if you have the array: > > Name="qmev[1]"... name="qmev[2]"... name="qmev[3]" > > And your array contains > > [1] => on : [3] => on > > 1 and 3 are selected > > -Original Message- > From: zedleon [mailto:[EMAIL PROTECTED] > Sent: 17 August 2005 21:30 > To: php-general@lists.php.net > Subject: Re: [PHP] Help correcting a form mailer problem... > > thanks for the reply... > after using the print_r($_POST['gmev']); and selecting all the > checkboxes to > send to the form > the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So > the > values are missing. > don't really know how to proceed at this point. > any help is appreciated. > > > "Joe Wollard" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> I would first start out by dumping the values of $_POST['gmev'] by >> using >> >> print_r($_POST['gmev']); >> >> Sounds to me like you're not getting the data that your expecting >> from the form for some reason. Maybe $_POST['gmev'] is an array of >> null values? >> >> -Good Luck >> >> On Aug 17, 2005, at 12:15 PM, zedleon wrote: >> >> >>> I previously built a sticky form with dynamic checkbox >>> array's. >>> The form works beautifully thanks to help from Jochem Mass and >>> Kathleen >>> Ballard. >>> >>> I now have a slightly different problem...I have built an email >>> form to send >>> the form data. >>> I copied and used the following code which works great in the sticky >>> form. >>> >>> >>> if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { >>> >>>foreach ($_POST['gmev'] as $gmev_day) { >>> >>>print "You have registered for the: $gmev_day Good >>> Morning East >>> Valley Event."; >>> } >>> >>> } else { >>> >>>print 'You are not registered for any events!'; >>> >>> } >>> >>> The results is this: >>>"You have registered for the: September 9th Good Morning >>> East >>> Valley Event." >>> >>> Now when I use the same code modified for the form mailer I am >>> getting this >>> result. >>> >>> if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { >>> >>> foreach ($_POST['gmev'] as $gmev_day) { >>> >>> $msg .= "You have registered for the: $gmev_day Good Morning East >>> Valley >>> Event.\n"; >>> } >>> >>> } else { >>> >>>$mgs .= "You are not registered for any events!"; >>> } >>> >>> result is - "You have registered for the: on Good Morning >>> East >>> Valley Event." >>> >>> I am missing the value of the variable even though I am receiving >>> all the >>> instances of the variables from the checkboxes. When they are >>> selected, they >>> are present. >>> >>> I really don't know what to do about correcting the problem. Any >>> guidance >>> here would really be appreciatedand...go easy on me...I am new >>> to PHP >>> >>> Thanks before hand... >>> >>> zedleon >>> >>> -- >>> 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 > > > > > __ NOD32 1.1196 (20050817) Information __ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > -- > 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DB access and sessions
Hello- I'm developing a web-based system whereby users can edit documents and then e-mail the documents to selected recipients. The "documents" are comprised of the data from several MySQL fields. I want to make sure that two people don't edit a document at the same time. My users log in via a script that starts a session. My initial idea was to have a field to denote file access (1 for "in use" 0 for available). The problem with this would be if a user navigates to a different page or closes the browser window without clicking a "save" or "close" button (which would execute a query to set the in_use field to 0). I'm sure others have dealt with the issue of exclusive access to a MySQL resource. I've looked into InnoDB transactional support, but that doesn't seem to be what I need, since I'm not overly concerned about simultaneously access, just simultaneous editing. How can I ensure the "document" isn't accessed by two people at the same time? Thanks, Bret smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] DB access and sessions
Since you can't be sure to be notified when a user stops editing a page, whatever solution you choose will probably involve some sort of timeout-based system. (e.g. when someone starts editing a page, set a "last_opened" time field on the resources, and when someone else tries to edit the same page, check to see if "last opened" is in the last 30 mins). If you combine this with an ajax/iframe reload, you can be much more precise (e.g. while someone is editing a document, have their browser hit a designated url every 60 seconds; when the repeated hits stop, you know they're done) Since no such system is absolutely positively foolproof, you'll probably want to look into optimistic locking if you want to guarantee that no one's changes are accidentally overwritten. Tyler On 8/17/05, Bret Walker <[EMAIL PROTECTED]> wrote: > Hello- > > I'm developing a web-based system whereby users can edit documents and > then e-mail the documents to selected recipients. > > The "documents" are comprised of the data from several MySQL fields. > > I want to make sure that two people don't edit a document at the same time. > > My users log in via a script that starts a session. > > My initial idea was to have a field to denote file access (1 for "in > use" 0 for available). The problem with this would be if a user > navigates to a different page or closes the browser window without > clicking a "save" or "close" button (which would execute a query to set > the in_use field to 0). > > I'm sure others have dealt with the issue of exclusive access to a MySQL > resource. I've looked into InnoDB transactional support, but that > doesn't seem to be what I need, since I'm not overly concerned about > simultaneously access, just simultaneous editing. > > How can I ensure the "document" isn't accessed by two people at the same > time? > > Thanks, > Bret > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sending HTML (incl. embedded images) to browser
Hi List, I am a PHP newbie, pardon the elementary question - I am starting out with using print() to send HTML to the browser to be rendered. All is well with text and tables and other HTML formatting, but when trying to send IMG tags, my images aren't getting displayed. Is there a good tutorial out there (I can't seem to find it) on how to send HTML to a browser where the HTML includes IMG tags with links to image files? If I need to set up the filepaths with variables I can figure that out, but not sure what functions to use to set the paths up. Thanks for any pointers! -Jake
Re: [PHP] Help correcting a form mailer problem...
Ted, On your "sticky" page, your checkbox input commands no longer have their corresponding "value" attributes. Just add those back in, and you will be all set (you only have the "value" attribute set on the event_reg.php page, NOT on the event_reg_calc.php page). This is your only problem. i.e. change the code so that the output here: http://www.passeycorp.com/event_reg_calc.php will change from this: to this: checked="checked"/> Jordan On Aug 17, 2005, at 4:52 PM, Support wrote: Thanks for the post... The problem I am having here is that once the "sticky" or dynamic form is created... The checkboxes at that point don't seem to be "passing the value" only the state. So when it is submitted to the send mail form no value appears. I need to make the "sticky" pass the value... How is this done? test form is on http://www.passeycorp.com/event_reg.php check it out and I think you'll see what I mean. The suggestions and help are greatly appreciated. Ted - Original Message - From: "Jordan Miller" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: Sent: Wednesday, August 17, 2005 5:28 PM Subject: Re: [PHP] Help correcting a form mailer problem... Sorry, I believe you are mistaken here... you *can* specify a value for each checkbox and have it come through. I have written scripts that do this, and here is another example: http://www.tizag.com/phpT/examples/formex.php/ all zedleon needs to do is add the correct value parameter to each checkbox. Jordan On Aug 17, 2005, at 3:57 PM, <[EMAIL PROTECTED]> wrote: Sorry I should clarify... checkboxes don't send their values through they send their names and states... so if you have the array: Name="qmev[1]"... name="qmev[2]"... name="qmev[3]" And your array contains [1] => on : [3] => on 1 and 3 are selected -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I would first start out by dumping the values of $_POST['gmev'] by using print_r($_POST['gmev']); Sounds to me like you're not getting the data that your expecting from the form for some reason. Maybe $_POST['gmev'] is an array of null values? -Good Luck On Aug 17, 2005, at 12:15 PM, zedleon wrote: I previously built a sticky form with dynamic checkbox array's. The form works beautifully thanks to help from Jochem Mass and Kathleen Ballard. I now have a slightly different problem...I have built an email form to send the form data. I copied and used the following code which works great in the sticky form. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { print "You have registered for the: $gmev_day Good Morning East Valley Event."; } } else { print 'You are not registered for any events!'; } The results is this: "You have registered for the: September 9th Good Morning East Valley Event." Now when I use the same code modified for the form mailer I am getting this result. if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { foreach ($_POST['gmev'] as $gmev_day) { $msg .= "You have registered for the: $gmev_day Good Morning East Valley Event.\n"; } } else { $mgs .= "You are not registered for any events!"; } result is - "You have registered for the: on Good Morning East Valley Event." I am missing the value of the variable even though I am receiving all the instances of the variables from the checkboxes. When they are selected, they are present. I really don't know what to do about correcting the problem. Any guidance here would really be appreciatedand...go easy on me...I am new to PHP Thanks before hand... zedleon -- 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- 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] sending HTML (incl. embedded images) to browser
Hi Jake, You don't have to do anything special, you just have to have standards compliant HTML output. What is the HTML for the IMG tag output to the browser (i.e. go to the web browser, load the page in question, find the img tag, and send us this text). I think maybe your images are just not in the right directory or are not being referenced correctly. also, what is the actual PHP code used to print the img tag? maybe you're not escaping quotes correctly...? Jordan On Aug 17, 2005, at 5:42 PM, Jake Sapirstein wrote: Hi List, I am a PHP newbie, pardon the elementary question - I am starting out with using print() to send HTML to the browser to be rendered. All is well with text and tables and other HTML formatting, but when trying to send IMG tags, my images aren't getting displayed. Is there a good tutorial out there (I can't seem to find it) on how to send HTML to a browser where the HTML includes IMG tags with links to image files? If I need to set up the filepaths with variables I can figure that out, but not sure what functions to use to set the paths up. Thanks for any pointers! -Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sending HTML (incl. embedded images) to browser
i think using echo ''; should display the image. if you want to make that image a link you should use: echo ''; of course, you can use print or echo to send the output to the browser
Re[2]: [PHP] mail()
Hi, Thursday, August 18, 2005, 3:02:40 AM, you wrote: GB> André Medeiros wrote: >> Do you have a mail server running? GB> No, how do I get a mail server running? And does it allow me to receive GB> e-mails, or only send? Try this, they have a free version which will do what you want. If you have a fixed IP you can even receive your own mail. http://mailenable.com/ -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sending HTML (incl. embedded images) to browser
Hello, on 08/17/2005 07:42 PM Jake Sapirstein said the following: I am a PHP newbie, pardon the elementary question - I am starting out with using print() to send HTML to the browser to be rendered. All is well with text and tables and other HTML formatting, but when trying to send IMG tags, my images aren't getting displayed. Is there a good tutorial out there (I can't seem to find it) on how to send HTML to a browser where the HTML includes IMG tags with links to image files? If I need to set up the filepaths with variables I can figure that out, but not sure what functions to use to set the paths up. You need to use absolute URLs for the images. Still, some mail programs and webmail sites disable remote image displaying by default as images may be beacons to spy on users. ALternatively you can embeded images in the actual HTML messages and they always display properly. That is done with MIME multipart/related messages. You may want to take a look at this MIME message class that can be used to compose messages with embedded images. It comes with an example named test_html_mail_message.php that shows exactly how to do that: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sending HTML (incl. embedded images) to browser
Hello, on 08/17/2005 07:42 PM Jake Sapirstein said the following: > I am a PHP newbie, pardon the elementary question - I am starting out with using print() to send HTML to the browser to be rendered. All is well with text and tables and other HTML formatting, but when trying to send IMG tags, my images aren't getting displayed. > > Is there a good tutorial out there (I can't seem to find it) on how to send HTML to a browser where the HTML includes IMG tags with links to image files? If I need to set up the filepaths with variables I can figure that out, but not sure what functions to use to set the paths up. You need to use absolute URLs for the images. Still, some mail programs and webmail sites disable remote image displaying by default as images may be beacons to spy on users. ALternatively you can embeded images in the actual HTML messages and they always display properly. That is done with MIME multipart/related messages. You may want to take a look at this MIME message class that can be used to compose messages with embedded images. It comes with an example named test_html_mail_message.php that shows exactly how to do that: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] True Upload Max Filesize
Does anybody have a function handy to calculate/compute the True maximum upload filesize -- one that encompasses php.ini limits such as upload_max_filesize and post_max_size, as well as httpd.conf RequestBodyLimit, and maybe even takes an argument for the speed of the network connection to multiply with max_input_time to predict for the user EXACTLY how much they can upload before they start? Ideally, you've already thought of any other factors in httpd.conf of which I am unaware... Is it still the case that altering upload_max_filesize in .htaccess or the FORM will take the minimum of those values, rather than over-riding?... I guess I could test that last one by setting up a dev box just for that purpose while not messing up all the other work happening on that box... Or uploading some monster file and waiting an hour or two for it to finish... PS Please Cc: me -- I'm WAY behind on my mailing list reading. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] [EMAIL PROTECTED]|%a!<%k$7$?7o$G$9(B
http://awg.webchu.com/nanpara/?user1 2$BEYL\$N%a!<%k$K0Y$C$F$7$^$$BgJQ?=$7LuM-$j$^$;$s!#(B $B$5$F!"@hF|%a!<%k$5$;$FD:$$$?!y!z0lK|1_(B(1000$B%]%$%s%H(B)$BJ,%W%l%<%s%H!z!y$N7o$G$9$,!"(B $Bhttp://awg.webchu.com/nanpara/?user1 [EMAIL PROTECTED]"(B $B!y!z0lK|1_(B(1000$B%]%$%s%H(B)$BJ,%W%l%<%s%H!z!y$r$4MxMQD:$/;v$,$G$-$^$9$N$G!"(B $B@'Hs0lEY!"$4MxMQ2<$5$$$^$9MM$*4j$$?=$7>e$2$^$9!#(B $B$7$+$7A02s!";[EMAIL PROTECTED]@ITB-$N$;$$$+!"Cf$K$O0lK|1_(B(1000$B%]%$%s%H(B)$BJ,$r!"(B $B>e/$J$+$i$:$$$i$7$?$h$&$G$9!#(B $B3'$5$s$K$O$-$A$s$HO"Mm$r:9$7>[EMAIL PROTECTED]"$kBP1~$r$5$;$FD:$$$?$D$b$j$G$9$,!"(B $BO"MmO3$l$NL5$$$h$&$K!":FEYG0$rF~$l$F$*Aw$j$7$F$$$^$9!#(B $B99$K!"3'$5$s$K2r$j0W$$$h$&$K%Z!<%8$N0lIt$r99?7$7$^$7$?!J0lEY$4Mw$K0Y$C$F2<$5$$!K!#(B http://awg.webchu.com/nanpara/?user1 $B$^$?!"6K!9$o$:$+$N$*5RMM$NCf$K$O!";dC#$N5$;}$A$,EA$o$i$:!"(B $B9+$K2#9T$9$kLBOG%a!<%k$NMM$K46$8$i$l$?J}$b$$$i$7$?MM$G$9!#(B $B;dC#<+?H$N5;=QITB-$N0Y!"0lIt$N%5!<%P!<$rB>%5%$%H$+$i%l%s%?%k$7$F$$$k;v$b!"(B $B$=$NMM$J8m2r$K0lLrGc$C$F$$$k$N$+$bCN$l$^$;$s!"(B $B$7$+$7!";dC#$OCG$8$F!XNI?4E*$JC1FH1?1D!Y$r4S$$$F9T$/$D$b$j$G$9!#(B http://awg.webchu.com/nanpara/?user1 $B:G8e$K0Y$j$^$9$,!"$3$N%a!<%k$NG[?.$r$rIT2w$^$?$OITMW$H;W$o$l$kJ}$O!"(B $B$*e$2$^$9!#(B $BG[?.ITMW$O$3$A$iKx"*(B [EMAIL PROTECTED] In an unnecessary delivery, even here is $B"*(B [EMAIL PROTECTED] $BAw?.IT<{MW"*(B [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DB access and sessions
We use a combination of timeout and user who has locked the record in a form e.g. User A opens the form. A record id is stored in the page and the db record has 3 cols -> is_locked (y/n), locked_by (user_id) & locked_time (datetime) B then opens the form. If the record is locked & more then 5 minutes has passed then B's ID will then be updated into the table and a new locked_time set. If it's locked and within the time an error message pops up saying "Record locked by XYZ for another 3 minutes". If user A comes back in 10 minutes and submits, the sys checks if his user id is in the "locked_by" col, and then alerts him that his 5 minutes were up and he needs to refresh. It's never let us down. If you can improve on it let me know :) Bret Walker wrote: Hello- I'm developing a web-based system whereby users can edit documents and then e-mail the documents to selected recipients. The "documents" are comprised of the data from several MySQL fields. I want to make sure that two people don't edit a document at the same time. My users log in via a script that starts a session. My initial idea was to have a field to denote file access (1 for "in use" 0 for available). The problem with this would be if a user navigates to a different page or closes the browser window without clicking a "save" or "close" button (which would execute a query to set the in_use field to 0). I'm sure others have dealt with the issue of exclusive access to a MySQL resource. I've looked into InnoDB transactional support, but that doesn't seem to be what I need, since I'm not overly concerned about simultaneously access, just simultaneous editing. How can I ensure the "document" isn't accessed by two people at the same time? Thanks, Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: run remote shell script
OK. I am able to setup remote key authentication between svrA and svrB. From svrA I can login to svrB with something like [EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED] and I can also execute a shell script like [EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED] /tmp/test.sh On svrA I have a PHP script like so: /tmp/test.sh on svrB is only a one liner like so: mkdir /tmp/$1 I ran the script from the browser but the /tmp/someDIR is not created :( Could it be that user nobody on svrA is *not* allowed to connect to svrB because the public key belongs to user www ? How do I rectify this ? In the actual situation, I need to execute a shell script in svrB (from browser served by Apache on svrA) that only root can run. Please advise. I am getting very worried. -- Roger Quoting Matthew Weier O'Phinney <[EMAIL PROTECTED]>: > * Roger Thomas <[EMAIL PROTECTED]>: > > My PHP script is in svrA. How do I run a shell script in svrB? > > svrB does not have PHP and Apache :( > > Is this at all possible? Please advise. > > Use ssh. You will have to setup remote key authentication from svrA to > svrB (so that a password will not be needed), and then in your script > you would call: > > system('ssh svrB /path/to/scriptToRun'); > > -- > Matthew Weier O'Phinney > Zend Certified Engineer > http://weierophinney.net/matthew/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: run remote shell script
On Wed, August 17, 2005 9:50 pm, Roger Thomas wrote: > OK. I am able to setup remote key authentication between svrA and > svrB. From svrA I can login to svrB with something like > [EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED] > > and I can also execute a shell script like > [EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED] /tmp/test.sh Excellent! If 'www' can do it in a shell, then PHP, running as 'www' can usually do do it -- though a FEW commands require an honest-to-god tty real-login-shell connection or they refuse to run. I think su is one of them. > On svrA I have a PHP script like so: > system('ssh [EMAIL PROTECTED] /tmp/test.sh someDIR'); //Do this: exec('ssh [EMAIL PROTECTED] /tmp/test.sh someDIR', $output, $error); if ($error) echo "OS Error: $error\n"; echo implode("\n", $output); This will tell you what error messages, if any, you are getting. Most likely what is happening is that the 'www' user in PHP does not have a true shell set up -- so 'www' has no "home" dir, so ssh does not find the keys you stuck in ~/.ssh/ so you need to do something like: exec('ssh -i /home/www/.ssh [EMAIL PROTECTED] /tmp/test.sh someDIR', $output, $error); Read "man ssh" for more details about "-i" flag, but it basically tells ssh where to find the keys it needs to use to get into svrB (and anywhere else 'www' has access to) I did the same thing with scp (kinda like FTP tunnelling through SSH) and that was the thing that took me awhile to figure out. > ?> > > /tmp/test.sh on svrB is only a one liner like so: > mkdir /tmp/$1 > > I ran the script from the browser but the /tmp/someDIR is not created > :( > Could it be that user nobody on svrA is *not* allowed to connect to > svrB because the public key belongs to user www ? How do I rectify > this ? Whoa. First of all, you have two different 'www' users running around: [EMAIL PROTECTED] and [EMAIL PROTECTED] >From here on, I'll specify users with @svr? so we know what we're talking about. If the user '[EMAIL PROTECTED]' is the one PHP runs as, then, yes, '[EMAIL PROTECTED]' needs to have a copy of the [half-]key that currently is owned by '[EMAIL PROTECTED]' which is what allows '[EMAIL PROTECTED]' to ssh to '[EMAIL PROTECTED]' without supplying a password. Though why you have a '[EMAIL PROTECTED]' user and then have '[EMAIL PROTECTED]' running Apache/PHP is beyond my ken... It's MORE likely that '[EMAIL PROTECTED]' really is running Apache/PHP, and you are getting tripped up by what I outlined above. BUT - yes, if the user running Apache/PHP doesn't have the half of the key-pair that it needs to access srvB, then that user ain't getting into svrB. NOTE: It's usually the PRIVATE key belonging to '[EMAIL PROTECTED]' that you would have sitting in the .ssh directory for '[EMAIL PROTECTED]' and then the PUBLIC half would be sitting in '[EMAIL PROTECTED]' .ssh directory. IE, the presence of the PUBLIC key belonging to somebody "else" ([EMAIL PROTECTED]) in the file that, in theory, only '[EMAIL PROTECTED]' can write, is how [EMAIL PROTECTED] gave permission for [EMAIL PROTECTED] to get in. [EMAIL PROTECTED] has the PUBLIC key to [EMAIL PROTECTED], but that's okay. It's a PUBLIC key, so anybody can safely hold it. [EMAIL PROTECTED] has the PRIVATE key in his own .ssh directory, which only he can access. What you MAY have done, and which MIGHT work (or not) but seem backwards to me: [EMAIL PROTECTED] made a key-pair, and then handed over the PRIVATE key to [EMAIL PROTECTED] IF you did that, and IF that works, the risk here is that you've got a key that is labeled as PRIVATE that has been handed "out" to somebody else, which is a no-no. And you've got a key that is labeled as PUBLIC (sitting up on [EMAIL PROTECTED]) that you could easily someday think "Oh, it's okay to hand this out, it's PUBLIC" but, really, *that* PUBLIC key is what is supposed to be kept secret so that the PRIVATE key handed to [EMAIL PROTECTED] can tie in... > In the actual situation, I need to execute a shell script in svrB > (from browser served by Apache on svrA) that only root can run. Please > advise. I am getting very worried. I'd be real worried about the script that only 'root' can run... Set up a new user on svrB that has permission to create the directories you need, and that's pretty much all that user can do. Using 'root' access is just too much power. Minimize your exposure ; Minimize your risk ; Minimize permissions -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ob_start changed from php4 to php5?
On Wed, August 17, 2005 10:12 am, Marten Lehmann wrote: > I have a function catching the output of a script: > > function encodeDomain ($domain) { > ob_start(); > system("echo '$domain'"); > $output = ob_get_contents(); > ob_end_clean(); > } > > And I have a php-script using this function: > > > encodeDomain($domain); > header("Location: http://www.php.net";); > > ?> > > While this worked fine in PHP4, with PHP5.0.4 I always get the > following > error: > > Warning: Cannot modify header information - headers already sent in > test.php on line 4 I'm guessing that the error message has MORE information than that -- like the line number of the file in which the output occurred. I'm also guessing that it's the LAST line of the file with the "encodeDomain" function in it that you "include" in your test.php I'm also guessing that there's a NEWLINE character after the final ?> in that file on your 5.0.4 box, but that NEWLINE character is *NOT* there on your 4.0 box. > The redirect works if I don't use the encodeDomain() function. Does > the > system-output affect the php-outout status in any way? I checked the > raw > http-output and I can see nothing of the output from the > system()-call. > Does maybe PHP simply say "output has been send" although it hasn't > been > send actually? Sort of. Apache may be buffering output, or you may even have output_buffering set to "on" in php.ini or gzip may be involved and buffering or... But as far as PHP is concerned, the headers went "out" even if somebody else somewhere is buffering them and you don't see any output. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php