php-general Digest 8 Jun 2005 09:28:25 -0000 Issue 3500
php-general Digest 8 Jun 2005 09:28:25 - Issue 3500 Topics (messages 216573 through 216602): Re: The goto discussion on the Internals List 216573 by: Robert Cummings 216576 by: Jay Blanchard 216578 by: John Nichel 216579 by: Robert Cummings 216580 by: Jay Blanchard Re: How to execute local applications on the client 216574 by: Matthew Weier O'Phinney 216577 by: John Nichel 216597 by: Rory Browne 216600 by: Matthew Weier O'Phinney Re: Unit testing ? 216575 by: Matthew Weier O'Phinney Re: linux php editor 216581 by: Miguel Guirao looking for php/guru/drinking partners! 216582 by: bruce handling spanish accents 216583 by: Graham Anderson curl 216584 by: Jon 216585 by: Mikey Beautiful HTML Invoice - Prints like crap! I need some suggestions! 216586 by: Matt Babineau 216587 by: Jack Jackson 216588 by: Jack Jackson 216589 by: Matt Babineau 216591 by: Ligaya Turmelle 216592 by: Marek Kilimajer string highlight 216590 by: Sebastian 216594 by: David Duong 216595 by: David Duong 216596 by: Rory Browne Message could not be delivered 216593 by: Returned mail 216598 by: Mail Administrator [Announce] Call For Papers: php|works and web|works 216599 by: Davey Shafik Re: Displaying an Outlook Calendar on a webpage using PHP 216601 by: Justin.Baiocchi.csiro.au Returned mail: see transcript for details 216602 by: Mail Administrator Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- On Tue, 2005-06-07 at 10:50, Jay Blanchard wrote: [snip] Goto has (I believe) been described as a method of shooting yourself in both feet at the same time. [/snip] goto (not a 'new' construct as was mentioned earlier) had its uses, but thos would seem depricated now as you can call a function, which is essentially what a goto did. Consider; if('foo' == $bar){ goto(1001); //essentially a line number (remember, old school) OR goto(LABEL); //defined constant } else { goto(2001); } Absolutely nobody in this day and age advocated goto lineNumber. The only use to have useful advantage is goto labelName and of course that is where the labelName exists within the current execution scope. A function call is not an acceptable replacement since you incure the overhead of setting up the function and the stack. Contrast the difference in speed between is_null( $foo ) and $foo === null. VS. if('foo' == $bar){ assimilate($bar); } else { anhylate($bar); } Where problems arose from goto they would arise from function use as well. Nesting goto's was every bit as challenging as properly constructing regex statements. goto also did not fit as well with OOP methodology, being more of a procedural construct in accordance with the procedural programming at the time that it was conceived. PHP has never purported to be an OOP only language. It advocates both procedural and OOP programming methodologies. Just ask Richard Lynch :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' ---End Message--- ---BeginMessage--- [snip] Absolutely nobody in this day and age advocated goto lineNumber. The only use to have useful advantage is goto labelName and of course that is where the labelName exists within the current execution scope. A function call is not an acceptable replacement since you incure the overhead of setting up the function and the stack. Contrast the difference in speed between is_null( $foo ) and $foo === null. [/snip] The speed difference is negligible though, in this day and age, dependent upon how much hair-splitting you would care to do. You're still setting aside a block of code which will have to be parsed and you incur the same setup if the goto section is the same code as the function. The overhead is introduced in the calling of the function. But we're splitting hairs here :) [snip] PHP has never purported to be an OOP only language. It advocates both procedural and OOP programming methodologies. Just ask Richard Lynch :) [/snip] I never said that PHP was OOP only,
[PHP] Returned mail: see transcript for details
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] Your message was undeliverable due to the following reason(s): Your message was not delivered because the destination server was unreachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there is a network problem that prevented delivery, but it is also possible that the computer is turned off, or does not have a mail system running right now. Your message could not be delivered within 4 days: Mail server 193.165.114.28 is not responding. The following recipients could not receive this message: php-general@lists.php.net Please reply to [EMAIL PROTECTED] if you feel this message to be in error. file attachment: instruction.pif This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Add Excel/Word documents to a dynamic pdf.
I know how to create dynamic PDF's on the fly using the PDF library functions. Is there a way I can add Excel and Word documents to the dynamic PDF as well? Here's what I need to do. Basically I have a master list of available files in the following formats: text, JPEG images, Excel, Powerpoint, and Word. The user selects all the documents they need from the list and then I need to build a dynamic PDF containing all the selected files. Is this possible? Thanks, Dave Regards, Dave Bosky Programmer/Analyst Horry Telephone Cooperative, Inc. 3480 Highway 701 N Conway, SC 29526 Email: [EMAIL PROTECTED] Business: 843.369.8613 Fax: 843.369.7188 HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
Marek Kilimajer wrote: Matt Babineau wrote: Hi all - I've got a great html invoice that prints like crap because of my user of background images and foreground images. Does anyone have any good suggestions other than turn on images in IE to get this thing to print the graphics? Is there a good way I could convert the HTML view to a JPG? I'm on a linux box and have php 4.3.10. make css for print media: @media print { /* style sheet for print goes here */ } http://www.w3.org/TR/REC-CSS2/media.html ^^^ This is a good suggestion. But if you only need to print just this one invoice then you can also take a full screen shot, paste that into your favorite image program and then print from there. (Usually this is Print Screen on your keyboard). -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl
Jon wrote: I have not used curl before and it looked interesting from the manual. So, does anyone have a sample script or a tutorial that covers the logon procedure. What I want to do is logon to an asp site and download some files. Can someone point me in the right direction? I have done some searches on google but I guess that I have not used the correct key words because I have not found any hints at how to logon to a site with curl. http://curl.haxx.se/libcurl/php/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: string highlight
Rory Browne wrote: On 6/8/05, David Duong [EMAIL PROTECTED] wrote: Sebastian wrote: i'm looking for a function that can highlight certain search terms in a string. anyone have something already made that i can plugin to my exisiting code? I found a couple but they do not work very well.. some break html code if the string contains the keywords in the html. thanks. You can use str_replace to highlight the search terms. For example, you could use the following code for each search term (this function also accepts arrays, see http://php.net/str_replace): str_replace ($search_term, b$search_term/b, $body_text); Bad idea. Very bad idea. for example ( using bold to highlight ): ?pseudo_code $html = htmlbodyI want to hightlight the word body in this text. /body/html; $search = body; $output = str_replace($search, b$search/b, $html); // $output == htmlbbody/bI want to hightlight the word bbody/b in this text. /bbody/b/html; // see what I mean? ? Good catch Rory. A regex replace would work better here. $search = body; $find = /\b . $search . \b/; preg_replace ( $find, b . $search . /b, $html ); -- 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] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
Jason Barnett wrote: Marek Kilimajer wrote: Matt Babineau wrote: Hi all - I've got a great html invoice that prints like crap because of my user of background images and foreground images. Does anyone have any good suggestions other than turn on images in IE to get this thing to print the graphics? Is there a good way I could convert the HTML view to a JPG? I'm on a linux box and have php 4.3.10. make css for print media: @media print { /* style sheet for print goes here */ } http://www.w3.org/TR/REC-CSS2/media.html ^^^ This is a good suggestion. But if you only need to print just this one invoice then you can also take a full screen shot, paste that into your favorite image program and then print from there. (Usually this is Print Screen on your keyboard). And if it does not fit on one screen, take more screenshots and glue them together in the favorite image program :) The OP's problem is that images are printed, so this crazy solution would not work -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Really simple regex
Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! I searched marc because I know that I've seen this, but I don't know on what keywords to search. I know that php uses perl-compatable regular expressions, but in no tutorial did I find this. I know that * matches any amount of occurances of a string, but formulating it to do it in the middle of a string of text I could not get. Dotan http://lyricslist.com/lyrics/artist_albums/19/adams_bryan.php Bryan Adams Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Really simple regex
preg_replace(/x+/, x, $string); should do it. Having that said, regex generally comes back and bites me in the ass, so... On 6/8/05, Dotan Cohen [EMAIL PROTECTED] wrote: Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! I searched marc because I know that I've seen this, but I don't know on what keywords to search. I know that php uses perl-compatable regular expressions, but in no tutorial did I find this. I know that * matches any amount of occurances of a string, but formulating it to do it in the middle of a string of text I could not get. Dotan http://lyricslist.com/lyrics/artist_albums/19/adams_bryan.php Bryan Adams 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
Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
@media print { /* style sheet for print goes here */ } http://www.w3.org/TR/REC-CSS2/media.html ^^^ This is a good suggestion. But if you only need to print just this one invoice then you can also take a full screen shot, paste that into your favorite image program and then print from there. (Usually this is Print Screen on your keyboard). And if it does not fit on one screen, take more screenshots and glue them together in the favorite image program :) The OP's problem is that images are printed, so this crazy solution would not work Maybe that's the way you read it, but to me it looks like he's complaining that what he sees in his browser is what he wants to print, but this is not what is being printed (I assume because of alpha images). My point was that if the OP only needs to print one or two invoices then it's a bit overkill to create a CSS for print media when he can just print out a screenshot. Yeah it's out of the box / not the purist answer. Sue me. :P -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Really simple regex
* Rory Browne [EMAIL PROTECTED] : preg_replace(/x+/, x, $string); should do it. Having that said, regex generally comes back and bites me in the ass, so... That one won't -- that's spot on. On 6/8/05, Dotan Cohen [EMAIL PROTECTED] wrote: Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! I searched marc because I know that I've seen this, but I don't know on what keywords to search. I know that php uses perl-compatable regular expressions, but in no tutorial did I find this. I know that * matches any amount of occurances of a string, but formulating it to do it in the middle of a string of text I could not get. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: string highlight
On 6/8/05, John Nichel [EMAIL PROTECTED] wrote: Rory Browne wrote: On 6/8/05, David Duong [EMAIL PROTECTED] wrote: Sebastian wrote: i'm looking for a function that can highlight certain search terms in a string. anyone have something already made that i can plugin to my exisiting code? I found a couple but they do not work very well.. some break html code if the string contains the keywords in the html. thanks. You can use str_replace to highlight the search terms. For example, you could use the following code for each search term (this function also accepts arrays, see http://php.net/str_replace): str_replace ($search_term, b$search_term/b, $body_text); Bad idea. Very bad idea. for example ( using bold to highlight ): ?pseudo_code $html = htmlbodyI want to hightlight the word body in this text. /body/html; $search = body; $output = str_replace($search, b$search/b, $html); // $output == htmlbbody/bI want to hightlight the word bbody/b in this text. /bbody/b/html; // see what I mean? ? Good catch Rory. A regex replace would work better here. $search = body; $find = /\b . $search . \b/; preg_replace ( $find, b . $search . /b, $html ); I don't think so. If I'm reading your code correctly you still have the same problem, as I outlined above. There is no simple solution to this. It either involves advanced regex(more advanced than my understanding of it), or a proper parser. ?pseudo_code function highlight_html_string($needle, $haystack); $retval = ; $i = 0; while($i strlen($haystack)){ $str = get_text_between_certain_point_and_first_instance_of_($i); $str = preg_replace(what john said above); $str .= get_tag_text($i); $retval .= $str; $i += strlen($str); } return $retval; ? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
Jason Barnett wrote: @media print { /* style sheet for print goes here */ } http://www.w3.org/TR/REC-CSS2/media.html ^^^ This is a good suggestion. But if you only need to print just this one invoice then you can also take a full screen shot, paste that into your favorite image program and then print from there. (Usually this is Print Screen on your keyboard). And if it does not fit on one screen, take more screenshots and glue them together in the favorite image program :) The OP's problem is that images are printed, so this crazy solution would not work Maybe that's the way you read it, but to me it looks like he's complaining that what he sees in his browser is what he wants to print, but this is not what is being printed (I assume because of alpha images). My point was that if the OP only needs to print one or two It sound to me like background images are not being printed, which is indeed off by default (in IE) I believe - solution is to not use background images, or not use images at all in the invoice. invoices then it's a bit overkill to create a CSS for print media when he can just print out a screenshot. Yeah it's out of the box / not the purist answer. Sue me. :P do you have money? ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Of .txt to .zip
Hi All, I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. Thanks Denyl.
Re: [PHP] Re: string highlight
John Nichel wrote: Rory Browne wrote: On 6/8/05, David Duong [EMAIL PROTECTED] wrote: Sebastian wrote: i'm looking for a function that can highlight certain search terms in a string. anyone have something already made that i can plugin to my exisiting code? I found a couple but they do not work very well.. some break html code if the string contains the keywords in the html. thanks. You can use str_replace to highlight the search terms. For example, you could use the following code for each search term (this function also accepts arrays, see http://php.net/str_replace): str_replace ($search_term, b$search_term/b, $body_text); Bad idea. Very bad idea. for example ( using bold to highlight ): ?pseudo_code $html = htmlbodyI want to hightlight the word body in this text. /body/html; $search = body; $output = str_replace($search, b$search/b, $html); // $output == htmlbbody/bI want to hightlight the word bbody/b in this text. /bbody/b/html; // see what I mean? ? Good catch Rory. A regex replace would work better here. $search = body; $find = /\b . $search . \b/; if I were Richard Lynch I would mention that you probably want to backslash your backslashes: $find = /\\b . $search . \\b/; but then again if I were Richard Lynch I would probably assume that John Nichel knows that kind of thing, therefore I would not bother mentioning it, or would I? what would Richard Lynch say? (no offence Richard!, Im just being playful :-) (btw Richard is right about the backslashing!) preg_replace ( $find, b . $search . /b, $html ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HELP! form validation
Hi phpers, What would be the best method of validation a large (8 stages) form written in php? The form validates using php at the moment but it only displays the errors in a group, what we want it to do is highlight the fields or labels for the incorrect entries (if that makes sense.) so the user can easily see where to correct their mistakes. Any advice, or links to good resources would be great!! I do not really know javascript so a php solution would be preferable. Thanks in advace. Dave -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.5 - Release Date: 07/06/2005
Re: [PHP] Re: string highlight
Rory Browne wrote: On 6/8/05, John Nichel [EMAIL PROTECTED] wrote: Rory Browne wrote: On 6/8/05, David Duong [EMAIL PROTECTED] wrote: Sebastian wrote: i'm looking for a function that can highlight certain search terms in a string. anyone have something already made that i can plugin to my exisiting code? I found a couple but they do not work very well.. some break html code if the string contains the keywords in the html. thanks. You can use str_replace to highlight the search terms. For example, you could use the following code for each search term (this function also accepts arrays, see http://php.net/str_replace): str_replace ($search_term, b$search_term/b, $body_text); Bad idea. Very bad idea. for example ( using bold to highlight ): ?pseudo_code $html = htmlbodyI want to hightlight the word body in this text. /body/html; $search = body; $output = str_replace($search, b$search/b, $html); // $output == htmlbbody/bI want to hightlight the word bbody/b in this text. /bbody/b/html; // see what I mean? ? Good catch Rory. A regex replace would work better here. $search = body; $find = /\b . $search . \b/; preg_replace ( $find, b . $search . /b, $html ); I don't think so. If I'm reading your code correctly you still have the same problem, as I outlined above. There is no simple solution to John is using \b in his regexp to denote a word boundary - I don't believe counts as a boundary char therefore niether 'body' or 'body bla=bla' would be preg_replace()'d this. It either involves advanced regex(more advanced than my understanding of it), or a proper parser. ?pseudo_code function highlight_html_string($needle, $haystack); $retval = ; $i = 0; while($i strlen($haystack)){ $str = get_text_between_certain_point_and_first_instance_of_($i); $str = preg_replace(what john said above); $str .= get_tag_text($i); $retval .= $str; $i += strlen($str); } return $retval; ? -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Really simple regex
On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Dotan Cohen [EMAIL PROTECTED]: $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; hope it helps.. Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! I searched marc because I know that I've seen this, but I don't know on what keywords to search. I know that php uses perl-compatable regular expressions, but in no tutorial did I find this. I know that * matches any amount of occurances of a string, but formulating it to do it in the middle of a string of text I could not get. Dotan http://lyricslist.com/lyrics/artist_albums/19/adams_bryan.php Bryan Adams Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks, that did it. I did not know about the +. And what is the 'sim' doing? I can't find any information on that. Dotan http://lyricslist.com/lyrics/artist_albums/64/beatles.php Beatles Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: string highlight
[snip] I don't think so. If I'm reading your code correctly you still have the same problem, as I outlined above. There is no simple solution to this. It either involves advanced regex(more advanced than my understanding of it), or a proper parser. ?pseudo_code function highlight_html_string($needle, $haystack); $retval = ; $i = 0; while($i strlen($haystack)){ $str = get_text_between_certain_point_and_first_instance_of_($i); $str = preg_replace(what john said above); $str .= get_tag_text($i); $retval .= $str; $i += strlen($str); } return $retval; ? [/snip] Also it should be noted that the b tag pair has really been depricated in favor of strong tags. Here is another thought, can you ignore your search string where it has tags immediately before and after it, so that body could be ignored? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HELP! form validation
On 6/8/05, Dave Sayer [EMAIL PROTECTED] wrote: What would be the best method of validation a large (8 stages) form written in php? The form validates using php at the moment but it only displays the errors in a group, what we want it to do is highlight the fields or labels for the incorrect entries (if that makes sense.) so the user can easily see where to correct their mistakes. Any advice, or links to good resources would be great!! I do not really know javascript so a php solution would be preferable. You might want to have a look at the following links: http://kalsey.com/simplified/form_errors/ http://www.sitepoint.com/print/practical-xml-form-validation http://simon.incutio.com/archive/2003/06/17/theHolyGrail I use a slightly modified version of Kalsey's method on my weblog and it works quite well. Paul -- Rogue Tory http://www.roguetory.org.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Of .txt to .zip
[snip] I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. [/snip] http://www.php.net/zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HELP! form validation
Hi phpers, What would be the best method of validation a large (8 stages) form written in php? The form validates using php at the moment but it only displays the errors in a group, what we want it to do is highlight the fields or labels for the incorrect entries (if that makes sense.) so the user can easily see where to correct their mistakes. Any advice, or links to good resources would be great!! I do not really know javascript so a php solution would be preferable. Hi Dave - I sent you a private message with sample code attached. What I do is, when the form is submitted, validate the fields, and if any are invalid, redisplay the form with the fields pre-populated with the previous values and change the background color of the fields in question. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] HELP! form validation
-Original Message- From: Jim Moseby [mailto:[EMAIL PROTECTED] Sent: 08 June 2005 15:18 To: '[EMAIL PROTECTED]' Subject: RE: [PHP] HELP! form validation -Original Message- From: Dave Sayer [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 08, 2005 9:58 AM To: php-general@lists.php.net Subject: [PHP] HELP! form validation Hi phpers, What would be the best method of validation a large (8 stages) form written in php? The form validates using php at the moment but it only displays the errors in a group, what we want it to do is highlight the fields or labels for the incorrect entries (if that makes sense.) so the user can easily see where to correct their mistakes. Any advice, or links to good resources would be great!! I do not really know javascript so a php solution would be preferable. Hi Dave, I have attached a simple example of how I do it. You may be able to adapt it to your own situation. Jim Hi Jim, I can see that being a very nice way of doing it. I will get on and give it a go this afternoon. Thanks so much for the speedy response! Cheers, Dave -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.5 - Release Date: 07/06/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Include (evaluate) PHP/HTML code stored in a variable
Hi all, I am trying to figure out how mixed HTML and PHP code (like one might have in a normal PHP file) can be evaluated if it is stored in a variable, e.g. obtained from a database query. Unfortunately, the ``eval'' function only accepts pure PHP code which (in addition) must not have any syntax errors. My hope is that there exists a function similar to ``include(..)'' that accepts a variable containing code. Or: is there a possibility to invoke the parser of the ``include'' function to evaluate and execute mixed PHP and HTML code? Any other suggestions? Thank you! Marc. Example : = sample HTML/PHP code stored in variable $code form action=?action=?php print(FORM_ACTION); ? input name=?= INPUT_A ? type=text value=?php print(get_value(INPUT_A)); ? / input name=?= INPUT_S ? value=Submit / /form end sample HTML/PHP sample PHP code ?php // 1. build the container of a page ... // 2. access database and retrieve the content code //into $code // 3. evaluate $code, similar to include(...) ? end sample PHP code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with IE and php
Hi all, I running two php web page...therefore the page name has the .php on the end. The first page contains a form with a submit button at the botton. That submit button actions the second .php page. When I use my firefox browser everything works fine. When I use Internet Explorer, the submit button does not work. the button is the following: trtd input type=submit name=submit value=Commit /td/tr Could the html be treated differently when there is php around it or maybe when we use .php could the html be treated differently? Oh yeah, I created a duplicate of the pages with no php and had the two pages marked as .html and the button worked fine. Any help would be great. CHeers Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Of .txt to .zip
I do not want to open a ZIP , I want create a ZIP fron TXT . - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Denyl Meneses Guillén [EMAIL PROTECTED]; php-general@lists.php.net Sent: Wednesday, June 08, 2005 7:11 AM Subject: RE: [PHP] Of .txt to .zip [snip] I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. [/snip] http://www.php.net/zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 08/06/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returned mail: see transcript for details
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Happy Birthday, PHP!
Ten years ago today, Rasmus announced Personal Home Page Tools (PHP Tools) version 1.0. Today, numerous people contribute to PHP and to the nurturing of its community, but the project has never lost sight of Rasmus's original goal of solving the web problem. Thanks (of course) to Rasmus for getting things started, to Zeev and Andi for their early contributions, and to everyone else who continues to contribute to PHP - whether it's by contributing directly to the language, answering questions on mailing lists like this, or just writing interesting applications in PHP - you are what makes PHP what it is today. Thank you. (See http://del.icio.us/tag/a_decade_of_php for more thoughts on PHP's birthday.) Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returned mail: see transcript for details
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Message could not be delivered
I just got this one? Of course I didn't open the attachment, but someone sick is trying to involve the php group into a spreading of viruses. -afan Returned mail wrote: Dear user of lists.php.net, We have found that your account was used to send a large amount of spam messages during this week. We suspect that your computer had been infected and now contains a hidden proxy server. Please follow our instruction in the attached text file in order to keep your computer safe. Virtually yours, The lists.php.net team. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux php editor
On windows platform I use HomeSite 5.5 and I'm more then happy. On Linux platform QuantaPlus For small and fast changes on file vi/vim is the best. -afan On 6/6/05, Clive Zagno [EMAIL PROTECTED] wrote: what php GUI editors do you recommend. any other recommendations, thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux php editor
On windows platform I use HomeSite 5.5 and I'm more then happy. On Linux platform QuantaPlus For small and fast changes on file vi/vim is the best. my $.02 :) -afan On 6/6/05, Clive Zagno [EMAIL PROTECTED] wrote: what php GUI editors do you recommend. any other recommendations, thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Explanation in Shiflett's PHP Security Briefing
I was reading PHP Security Briefing from brainbulb.com (Chris Shiflett) and didn't get one thing: in example: ?php $clean = array(); if (ctype_alnum($_POST['username'])) { $clean['username'] = $_POST['username']; } ? why to set the $clean as array? what's wrong if I use: ?php if (ctype_alnum($_POST['username'])) { $clean = $_POST['username']; } ? -afan
[PHP] Returned mail: see transcript for details
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with IE and php
PHP doesn't really have anything to do with IE or Firefox working or failing to work, it's all about the HTML that PHP generates. What does your form tag look like? That's probably more the issue than your button or anything having to do with PHP. If you have no form tag, then the browsers might be trying to figure out what you really meant to do. This could be trying to submit the form data to the current page (yourscript.php) or could be trying to submit to the default document in that folder (possibly index.htm or index.html or default.htm or something like that). If you don't have a form tag, try something like this: form action=yourscript.php method=POST input type=submit name=submit value=Commit /form Changing yourscript.php to your script name of course, and you can use either POST or GET for the method depending on what you want to do. If that didn't help, please post more of your code. -TG = = = Original message = = = Hi all, I running two php web page...therefore the page name has the .php on the end. The first page contains a form with a submit button at the botton. That submit button actions the second .php page. When I use my firefox browser everything works fine. When I use Internet Explorer, the submit button does not work. the button is the following: trtd input type=submit name=submit value=Commit /td/tr Could the html be treated differently when there is php around it or maybe when we use .php could the html be treated differently? Oh yeah, I created a duplicate of the pages with no php and had the two pages marked as .html and the button worked fine. Any help would be great. CHeers Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ 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
Re: [PHP] Really simple regex
Dotan Cohen wrote: On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Dotan Cohen [EMAIL PROTECTED]: $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; hope it helps.. Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! I searched marc because I know that I've seen this, but I don't know on what keywords to search. I know that php uses perl-compatable regular expressions, but in no tutorial did I find this. I know that * matches any amount of occurances of a string, but formulating it to do it in the middle of a string of text I could not get. Dotan http://lyricslist.com/lyrics/artist_albums/19/adams_bryan.php Bryan Adams Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks, that did it. I did not know about the +. And what is the 'sim' its not one thing but 3 things, everything that comes after a regexp closing marker (but inside the string) is treated as a regexp modifier, in this case the modifiers are: modifer - meaning s - PCRE_DOTALL i - PCRE_CASELESS m - PCRE_MULTILINE read more here: http://nl3.php.net/manual/en/reference.pcre.pattern.modifiers.php doing? I can't find any information on that. Dotan http://lyricslist.com/lyrics/artist_albums/64/beatles.php Beatles Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem between IE and PHP
Hi all, I'm having a little problem with the interaction between php and IE. I have two .php pages. The first contains a form with the standard submit button. However when I come to push the button, I get a ding sound (standard error sound) and it seems like the button is deactivated. However when I try with my firefox browser, everything works fine. I then created a duplicate of the page, with no php and saved it as a .html file. With internet explorer and firefox, everything worked fine. I do not understand how this can be. Is Internet Explorer treated the php differently? Any help would be greatly appreciated. Cheers Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux php editor
On windows platform I use HomeSite 5.5 and I'm more then happy. I was a big proponent of HS for the longest time until I played around with Visual Slickedit. I very quickly switched and never looked back. VS is infinitely more feature rich than is HS. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Of .txt to .zip
That's much clearer than your original question was. Try www.phpclasses.org Good luck. Denyl Meneses Guillén wrote: I do not want to open a ZIP , I want create a ZIP fron TXT . - Original Message - From: Jay Blanchard [EMAIL PROTECTED] To: Denyl Meneses Guillén [EMAIL PROTECTED]; php-general@lists.php.net Sent: Wednesday, June 08, 2005 7:11 AM Subject: RE: [PHP] Of .txt to .zip [snip] I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. [/snip] http://www.php.net/zip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with IE and php
Hey, yeah I do have form tags. They are the following: form name=NAME method=GET action=Secondpage.php input... /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Happy Birthday, PHP!
Ten years ago today, Rasmus announced Personal Home Page Tools (PHP Tools) version 1.0. Today, numerous people contribute to PHP and to the nurturing of its community, but the project has never lost sight of Rasmus's original goal of solving the web problem. Thanks (of course) to Rasmus for getting things started, to Zeev and Andi for their early contributions, and to everyone else who continues to contribute to PHP - whether it's by contributing directly to the language, answering questions on mailing lists like this, or just writing interesting applications in PHP - you are what makes PHP what it is today. Yep, all of the above, Happy Birthday PHP and thank you. -Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.6 - Release Date: 6/8/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Explanation in Shiflett's PHP Security Briefing
Hello afan, Monday, June 6, 2005, 6:39:09 PM, you wrote: aan I was reading PHP Security Briefing from brainbulb.com (Chris Shiflett) aan and didn't get one thing: aan in example: aan ?php aan $clean = array(); aan if (ctype_alnum($_POST['username'])) aan { aan $clean['username'] = $_POST['username']; aan } ? aan why to set the $clean as array? what's wrong if I use: aan ?php aan if (ctype_alnum($_POST['username'])) aan { aan $clean = $_POST['username']; aan } ? In your example $clean will only ever hold one value. In the original the clean array can be used to hold all clean GET/POST values. Not many forms only have one value. The most important thing to remember though is that your array isn't really clean, it's just valid. I believe the original point Chris was making was that you should never trust that $_POST will only contain the values you expect it to - they should be moved out into a clean array first for further inspection and filtering, if anything else lingers in the $_POST array, it's most likely been tainted. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with IE and php
Philippe Reynolds wrote: Hi all, I running two php web page...therefore the page name has the .php on the end. The first page contains a form with a submit button at the botton. That submit button actions the second .php page. When I use my firefox browser everything works fine. When I use Internet Explorer, the submit button does not work. the button is the following: trtd input type=submit name=submit value=Commit /td/tr Could the html be treated differently when there is php around it or maybe when we use .php could the html be treated differently? No. -- 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] Re: string highlight
On 6/8/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] I don't think so. If I'm reading your code correctly you still have the same problem, as I outlined above. There is no simple solution to this. It either involves advanced regex(more advanced than my understanding of it), or a proper parser. ?pseudo_code function highlight_html_string($needle, $haystack); $retval = ; $i = 0; while($i strlen($haystack)){ $str = get_text_between_certain_point_and_first_instance_of_($i); $str = preg_replace(what john said above); $str .= get_tag_text($i); $retval .= $str; $i += strlen($str); } return $retval; ? [/snip] Also it should be noted that the b tag pair has really been depricated in favor of strong tags. Here is another thought, can you ignore your search string where it has tags immediately before and after it, so that body could be ignored? Hmmm, that would solve the above specific mentioned problem. how about something like tag body=whatever or tag whatever=body assuming that body is the word to be highlighted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Of .txt to .zip
[snip] I do not want to open a ZIP , I want create a ZIP fron TXT . [/snip] How far did you read? http://us3.php.net/manual/en/ref.zlib.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Really simple regex
On 6/8/05, Jochem Maas [EMAIL PROTECTED] wrote: Dotan Cohen wrote: On 6/8/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Quoting Dotan Cohen [EMAIL PROTECTED]: $string=I have apples!; $string=preg_replace(/x+/sim,x, $string); print $string; hope it helps.. Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! I searched marc because I know that I've seen this, but I don't know on what keywords to search. I know that php uses perl-compatable regular expressions, but in no tutorial did I find this. I know that * matches any amount of occurances of a string, but formulating it to do it in the middle of a string of text I could not get. Dotan http://lyricslist.com/lyrics/artist_albums/19/adams_bryan.php Bryan Adams Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thanks, that did it. I did not know about the +. And what is the 'sim' its not one thing but 3 things, everything that comes after a regexp closing marker (but inside the string) is treated as a regexp modifier, in this case the modifiers are: modifer - meaning s - PCRE_DOTALL i - PCRE_CASELESS m - PCRE_MULTILINE read more here: http://nl3.php.net/manual/en/reference.pcre.pattern.modifiers.php doing? I can't find any information on that. Dotan http://lyricslist.com/lyrics/artist_albums/64/beatles.php Beatles Lyrics Thank you for that link! I have so much to learn (there is so much to learn). Dotan http://lyricslist.com/forum/index.php Lyrics Forum -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie error message i don't understand....please help
Please help - I got Error message: Your PHP version does not have support for MySQL when I did http://x.x.x.x/install.php on windows 2003 with Php 5.04 and MySQL 5.0. Can anybody tell me what this is all about? Thanks, GMP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: string highlight
Rory Browne wrote: snip Good catch Rory. A regex replace would work better here. $search = body; $find = /\b . $search . \b/; preg_replace ( $find, b . $search . /b, $html ); I don't think so. If I'm reading your code correctly you still have the same problem, as I outlined above. There is no simple solution to this. It either involves advanced regex(more advanced than my understanding of it), or a proper parser. ?pseudo_code function highlight_html_string($needle, $haystack); $retval = ; $i = 0; while($i strlen($haystack)){ $str = get_text_between_certain_point_and_first_instance_of_($i); $str = preg_replace(what john said above); $str .= get_tag_text($i); $retval .= $str; $i += strlen($str); } return $retval; ? won't be picked up as a word boundry (\b). -- 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] Explanation in Shiflett's PHP Security Briefing
Thanks Richard. I got the point Chris was making: never believe _GET/_POST and use ctype_alnum(), mysql_real_escape_string(), htmlentities() - and I already started :) (Thanks Chris that was great for us beginners, already posted on few Bosnian php forums :)) My question though was is the difference in code I mentioned just a habit of writing code or there is some more? Some security issues too? Let's try this way: we have a case of a form for storing registrant info in DB. After submitting we have $_POST['name'] $_POST['address'] $_POST['city'] $_POST['state'] $_POST['zip'] $_POST['email'] $_POST['phone'] To store submitted info to DB I would (now) use following code: $name = mysql_real_escape_string($_POST['name']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $email = mysql_real_escape_string($_POST['email']); $phone = mysql_real_escape_string($_POST['phone']); mysql_query(insert into info values (NULL, '$name', '$address', '$city', '$state', '$email', '$phone')); doing the same using arrays: $submitted = array(); $submitted['name'] = mysql_real_escape_string($_POST['name']); $submitted['address'] = mysql_real_escape_string($_POST['address']); $submitted['city'] = mysql_real_escape_string($_POST['city']); $submitted['state'] = mysql_real_escape_string($_POST['state']); $submitted['zip'] = mysql_real_escape_string($_POST['zip']); $submitted['email'] = mysql_real_escape_string($_POST['email']); $submitted['phone'] = mysql_real_escape_string($_POST['phone']); mysql_query(insert into info values (NULL, $submitted['name']', '$submitted['address']', '$submitted['city']', '$submitted['state']', '$submitted['zip']', '$submitted['email']', '$submitted['phone']')); Is this REALLY the same or there is a difference in security or something else? Thanks :) -afan Richard Davey wrote: Hello afan, Monday, June 6, 2005, 6:39:09 PM, you wrote: aan I was reading PHP Security Briefing from brainbulb.com (Chris Shiflett) aan and didn't get one thing: aan in example: aan ?php aan $clean = array(); aan if (ctype_alnum($_POST['username'])) aan { aan $clean['username'] = $_POST['username']; aan } ? aan why to set the $clean as array? what's wrong if I use: aan ?php aan if (ctype_alnum($_POST['username'])) aan { aan $clean = $_POST['username']; aan } ? In your example $clean will only ever hold one value. In the original the clean array can be used to hold all clean GET/POST values. Not many forms only have one value. The most important thing to remember though is that your array isn't really clean, it's just valid. I believe the original point Chris was making was that you should never trust that $_POST will only contain the values you expect it to - they should be moved out into a clean array first for further inspection and filtering, if anything else lingers in the $_POST array, it's most likely been tainted. Best regards, Richard Davey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux php editor
* [EMAIL PROTECTED] [EMAIL PROTECTED] : On windows platform I use HomeSite 5.5 and I'm more then happy. On Linux platform QuantaPlus For small and fast changes on file vi/vim is the best. You know that vim exists for windows, right? and that it can be used for large changes as well? (I use vim as my primary editor :-) On 6/6/05, Clive Zagno [EMAIL PROTECTED] wrote: what php GUI editors do you recommend. any other recommendations, thanks -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Explanation in Shiflett's PHP Security Briefing
[EMAIL PROTECTED] wrote: I was reading PHP Security Briefing from brainbulb.com (Chris Shiflett) and didn't get one thing: in example: ?php $clean = array(); if (ctype_alnum($_POST['username'])) { $clean['username'] = $_POST['username']; } ? why to set the $clean as array? what's wrong if I use: ?php if (ctype_alnum($_POST['username'])) { $clean = $_POST['username']; } ? Richard already answered this pretty well, but I wanted to mention that this is not the only way to do things - it's just the method that I use. The idea is that I have a single variable ($clean) that I make sure to initialize, and because it's an array, I can store all filtered data (and only filtered data) in it. You could use a naming convention like $clean_username, but then you would have numerous variables to initialize on each page, increasing the chances of you forgetting one (although E_ALL can help you catch these mistakes). I'm just going for the simplest approach - the easier I can make things, the less likely I am to make a mistake. :-) The bottom line is that you need to be able to easily and reliably distinguish between filtered and tainted data. How you do this is up to you. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie error message i don't understand....please help
On 6/8/05, Greg M. Price [EMAIL PROTECTED] wrote: Please help - I got Error message: Your PHP version does not have support for MySQL when I did http://x.x.x.x/install.php on windows 2003 with Php 5.04 and MySQL 5.0. PHP 5 doesn't come with the MySQL client libraries built-in. See: http://uk.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5 for more details. Paul -- Rogue Tory http://www.roguetory.org.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie error message i don't understand....please help
Hello Greg, Wednesday, June 8, 2005, 3:58:03 PM, you wrote: GMP Please help - I got Error message: GMP Your PHP version does not have support for MySQL GMP when I did http://x.x.x.x/install.php on windows 2003 with Php 5.04 and GMP MySQL 5.0. Possibly you don't have MySQL support enabled in PHP? What exactly are you installing? This isn't a standard PHP error message, so it must be coming from that application. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Explanation in Shiflett's PHP Security Briefing
Hello afan, Wednesday, June 8, 2005, 4:33:24 PM, you wrote: aan My question though was is the difference in code I mentioned just aan a habit of writing code or there is some more? Some security aan issues too? It was most likely just a coding habit - there was no discernable difference between having one clean variable for each $_POST value, than having one array holding all values. It was probably just a way to keep things organised so you'd not initialising stacks of variables all over the place. aan To store submitted info to DB I would (now) use following code: aan $name = mysql_real_escape_string($_POST['name']); The sooner you change this practise, the better :) But you know that anyway. aan doing the same using arrays: aan $submitted = array(); aan $submitted['name'] = mysql_real_escape_string($_POST['name']); aan Is this REALLY the same or there is a difference in security or aan something else? You're effectively doing exactly the same thing, the difference being that you may find it quicker / less prone to error to keep things contained in a single clean array. As it stands however your array isn't clean and you really need to start filtering the data first and then putting it into a clean array - hope that makes sense? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Explanation in Shiflett's PHP Security Briefing
* [EMAIL PROTECTED] [EMAIL PROTECTED] : Thanks Richard. I got the point Chris was making: never believe _GET/_POST and use ctype_alnum(), mysql_real_escape_string(), htmlentities() - and I already started :) (Thanks Chris that was great for us beginners, already posted on few Bosnian php forums :)) My question though was is the difference in code I mentioned just a habit of writing code or there is some more? Some security issues too? Let's try this way: we have a case of a form for storing registrant info in DB. After submitting we have $_POST['name'] $_POST['address'] $_POST['city'] $_POST['state'] $_POST['zip'] $_POST['email'] $_POST['phone'] To store submitted info to DB I would (now) use following code: $name = mysql_real_escape_string($_POST['name']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $email = mysql_real_escape_string($_POST['email']); $phone = mysql_real_escape_string($_POST['phone']); mysql_query(insert into info values (NULL, '$name', '$address', '$city', '$state', '$email', '$phone')); doing the same using arrays: $submitted = array(); $submitted['name'] = mysql_real_escape_string($_POST['name']); $submitted['address'] = mysql_real_escape_string($_POST['address']); $submitted['city'] = mysql_real_escape_string($_POST['city']); $submitted['state'] = mysql_real_escape_string($_POST['state']); $submitted['zip'] = mysql_real_escape_string($_POST['zip']); $submitted['email'] = mysql_real_escape_string($_POST['email']); $submitted['phone'] = mysql_real_escape_string($_POST['phone']); mysql_query(insert into info values (NULL, $submitted['name']', '$submitted['address']', '$submitted['city']', '$submitted['state']', '$submitted['zip']', '$submitted['email']', '$submitted['phone']')); Is this REALLY the same or there is a difference in security or something else? Not the same, not necessarily secure, and it could cause issues for your database and/or reporting. What Chris Shifflet is getting at in his security columns is that simply escaping your data before throwing it in the DB is not a good practice. This is true from both a security standpoint as well as a database management standpoint. While the above would prevent most SQL injections, it could still wreak havoc with your database. For instance, what if your 'phone' or 'zip' fields in your database are integer fields, and text gets passed from the form? (answer: a failed DB call) Or you get a string of random characters for the email? do you really want that in your DB? It's easy to get lazy about this stuff, especially when it's just a hobby or for something non-critical, but if you get into bad habits, what happens when you're doing this for a business critical application? (I know this one -- my DBA starts beating me over the head with a bat for f***ing up his data, which will now take him several days to fix; I get fired from my job because a script I wrote allowed a hacker to delete all our customer data; etc.) Regarding your original question, the reason Chris S. keeps things in an array is so that all CLEAN (i.e. valid and/or secure) data is marked as such in a single place. Additionally, it allows you to do things like validating your $_POST array by looping over it: $clean = array(); foreach ($_POST as $key = $val) { $ok = false; switch ($key) { case 'name': if (ctype_alnum($val)) { $ok = true; } break; case 'address': if (preg_match('/^[ a-z0-9.\'\#-]+$/', $val)) { $ok = true; } break; // etc. } if ($ok) { $clean[$key] = $val; } } Richard Davey wrote: Monday, June 6, 2005, 6:39:09 PM, you wrote: aan I was reading PHP Security Briefing from brainbulb.com (Chris Shiflett) aan and didn't get one thing: aan in example: aan ?php aan $clean = array(); aan if (ctype_alnum($_POST['username'])) aan { aan $clean['username'] = $_POST['username']; aan } ? aan why to set the $clean as array? what's wrong if I use: aan ?php aan if (ctype_alnum($_POST['username'])) aan { aan $clean = $_POST['username']; aan } ? In your example $clean will only ever hold one value. In the original the clean array can be used to hold all clean GET/POST values. Not many forms only have one value. The most important thing to remember though is that your array isn't really clean, it's just valid. I believe the original point Chris was making was that you should never trust that $_POST will only contain the values you expect it to - they should be moved out into a clean array first for further inspection and filtering, if anything else lingers in the $_POST array, it's most
Re: [PHP] test
On Tue, 2005-06-07 at 14:46 +0200, Hans J.J. Prins wrote: test Failed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Explanation in Shiflett's PHP Security Briefing
[EMAIL PROTECTED] wrote: I got the point Chris was making: never believe _GET/_POST and use ctype_alnum(), mysql_real_escape_string(), htmlentities() - and I already started :) (Thanks Chris that was great for us beginners, already posted on few Bosnian php forums :)) You're welcome. :-) I must point out that the functions you just mentioned fall into two separate categories. Filtering: ctype_alnum Escaping: htmlentities() mysql_real_escape_string() My question though was is the difference in code I mentioned just a habit of writing code or there is some more? Some security issues too? Well, the discipline of web application security involves both practical and theoretical aspects. For example, the following two code snippets are not equal: ?php if (ctype_alnum($_POST['username']) { $_POST['username'] = htmlentities($_POST['username']); echo pHi, {$_POST['username']}!/p; } ? ?php $clean = array(); $html = array(); if (ctype_alnum($_POST['username'])) { $clean['username'] = $_POST['username']; $html['username'] = htmlentities($clean['username']); echo pHi, {$html['username']}!/p; } ? They both do the exact same thing - they welcome a user according to the username provided in a POST request. The difference is not a technical one - it's a difference in theory. By storing only filtered data in $clean, and by storing only filtered data that has also been escaped for use in HTML in $html, I know that I can safely send the value of any element within the $html array to the client (browser). This difference is hard to appreciate with such a simplistic example, especially when the code is not spread out, but it mitigates the damage that can be done when a developer makes a mistake. The worst-case scenario is that $html['username'] does not exist - this is better than it being tainted (both can be caused by the same mistake). A developer can always output $_POST['username'] raw, but the idea is that you can modify your approach to make things as easy as possible for the security-conscious developers. (This idea is also why I never recommend storing filtered data back into $_POST - you want to foster the natural suspicion that developers have for data stored therein, not deteriorate it.) Let's try this way: we have a case of a form for storing registrant info in DB. After submitting we have $_POST['name'] $_POST['address'] $_POST['city'] $_POST['state'] $_POST['zip'] $_POST['email'] $_POST['phone'] To store submitted info to DB I would (now) use following code: $name = mysql_real_escape_string($_POST['name']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $email = mysql_real_escape_string($_POST['email']); $phone = mysql_real_escape_string($_POST['phone']); mysql_query(insert into info values (NULL, '$name', '$address', '$city', '$state', '$email', '$phone')); You forgot to filter your input. Shame! :-) Escaping alone can save you in many cases, but always filter input and escape output. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie error message i don't understand....please help
The final product here is to install Nucleus blog software (http://nucleuscms.org/) on a windows 2003 servermy IT consultant is having a problem getting PHP to see mysql both of those programs are required to make nucleus work. it's really frustrating for him ( me). Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Greg, Wednesday, June 8, 2005, 3:58:03 PM, you wrote: GMP Please help - I got Error message: GMP Your PHP version does not have support for MySQL GMP when I did http://x.x.x.x/install.php on windows 2003 with Php 5.04 and GMP MySQL 5.0. Possibly you don't have MySQL support enabled in PHP? What exactly are you installing? This isn't a standard PHP error message, so it must be coming from that application. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Explanation in Shiflett's PHP Security Briefing
First, thanks guys for such a fast response :) Matthew Weier O'Phinney wrote: While the above would prevent most SQL injections, it could still wreak havoc with your database. For instance, what if your 'phone' or 'zip' fields in your database are integer fields, and text gets passed from the form? (answer: a failed DB call) Or you get a string of random characters for the email? do you really want that in your DB? I didn't mention anything about validating email address, zip code and such a things, because it is not the issue. but, you are definitlly right about how important are those. Regarding your original question, the reason Chris S. keeps things in an array is so that all CLEAN (i.e. valid and/or secure) data is marked as such in a single place. Additionally, it allows you to do things like validating your $_POST array by looping over it: $clean = array(); foreach ($_POST as $key = $val) { $ok = false; switch ($key) { case 'name': if (ctype_alnum($val)) { $ok = true; } break; case 'address': if (preg_match('/^[ a-z0-9.\'\#-]+$/', $val)) { $ok = true; } break; // etc. } if ($ok) { $clean[$key] = $val; } } I agree with this one. It's definitlly more clean solution. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] newbie error message i don't understand....please help
Hello Greg, Wednesday, June 8, 2005, 4:55:45 PM, you wrote: GMP The final product here is to install Nucleus blog software GMP (http://nucleuscms.org/) on a windows 2003 servermy IT GMP consultant is having a problem getting PHP to see mysql both of GMP those programs are required to make nucleus work. it's really GMP frustrating for him ( me). Time to talk to a PHP consultant instead then? ;) Look in the php.ini file and enable the MySQL extension, the entry will need un-commenting - and the path to the extensions will need setting. Unless nucleaus works with MySQLi you probably need to enable the older version. If PHP isn't running at all, it's most likely not finding the required DLLs. You can either copy them to the Windows directory (php5ts.dll + php.ini + php5apache.dll if using Apache), or configure your paths to pick-up the files where-ever you've unzipped them (C:\php perhaps?). If you are going to just install PHP once and leave it running, there is no reason why copying the DLLs into the windows directory is a bad thing to do, it will work and it's a locked down folder under 2003 Server re: security. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sockets
Hello, Is there a special newsgroup for socket programming? regards Harry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with IE and php
Do you have a doctype as the first line of your web page? Standards and browser behavior have changed over the years and the doctype is how you specify which behavior (and bugs) you want the browser to adhere to. Usually when you see some really wierd behavior, it's because of an incorrect or missing doctype. On Jun 8, 2005, at 10:30 AM, Philippe Reynolds wrote: Hi all, I running two php web page...therefore the page name has the .php on the end. The first page contains a form with a submit button at the botton. That submit button actions the second .php page. When I use my firefox browser everything works fine. When I use Internet Explorer, the submit button does not work. the button is the following: trtd input type=submit name=submit value=Commit /td/tr Could the html be treated differently when there is php around it or maybe when we use .php could the html be treated differently? Oh yeah, I created a duplicate of the pages with no php and had the two pages marked as .html and the button worked fine. Any help would be great. CHeers Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie error message i don't understand....please help
Greg, Have you enabled the MySQL extensions in the php.ini file and made sure the extension path in the php.ini file is correctly pointing to the right directory? eg c:\php\ext or c:\php\extension. I believe phpninfo() has a section for MySQL if it is enabled. hth. Chris. -Original Message- From: Greg M. Price [mailto:[EMAIL PROTECTED] Sent: 08 June 2005 16:56 To: php-general@lists.php.net Subject: Re: [PHP] newbie error message i don't understandplease help * This e-mail has been received by the Revenue Internet e-mail service. * The final product here is to install Nucleus blog software (http://nucleuscms.org/) on a windows 2003 servermy IT consultant is having a problem getting PHP to see mysql both of those programs are required to make nucleus work. it's really frustrating for him ( me). Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Greg, Wednesday, June 8, 2005, 3:58:03 PM, you wrote: GMP Please help - I got Error message: GMP Your PHP version does not have support for MySQL GMP when I did http://x.x.x.x/install.php on windows 2003 with Php 5.04 and GMP MySQL 5.0. Possibly you don't have MySQL support enabled in PHP? What exactly are you installing? This isn't a standard PHP error message, so it must be coming from that application. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- 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] problem with IE and php
Acutally, I have just resolved my problem. I was using method=get in my form (which contains at least a hundred values to be passed back). This overloaded the address length and therefore could not and would not action the second page. I switch to method=post in my form (which does not pass everything to the address line, and therefore allowing the second page to be actionned.. That to all you, who had input in this problem. Cheers Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include (evaluate) PHP/HTML code stored in a variable
eval('? '.$code.' ?php'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Really simple regex
Dotan Cohen wrote: Now, I know that this is easy, but I am embarassed to say that I can't find a regex tutorial that will show me how to match any occurances of x and replace them with one x: x x xx x x x $string=I have apples!; $string=preg_replace(-regex here-,x, $string); print $string; I have x apples! preg_replace ( /x+/, x, $string ); preg_replace ( /x{1,}/, x, $string ); But those will also change a letter 'x' in a word, so you'll probably need to tinker with that part too. -- 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] Re: string highlight
On 6/8/05, John Nichel [EMAIL PROTECTED] wrote: Rory Browne wrote: snip Good catch Rory. A regex replace would work better here. $search = body; $find = /\b . $search . \b/; preg_replace ( $find, b . $search . /b, $html ); I don't think so. If I'm reading your code correctly you still have the same problem, as I outlined above. There is no simple solution to this. It either involves advanced regex(more advanced than my understanding of it), or a proper parser. ?pseudo_code function highlight_html_string($needle, $haystack); $retval = ; $i = 0; while($i strlen($haystack)){ $str = get_text_between_certain_point_and_first_instance_of_($i); $str = preg_replace(what john said above); $str .= get_tag_text($i); $retval .= $str; $i += strlen($str); } return $retval; ? won't be picked up as a word boundry (\b). Aparently it will. [EMAIL PROTECTED] tmp]$ cat /tmp/test.php ?php $str = htmlbodyHighlight the body of the text/body/html; echo preg_replace(/\bbody\b/, bbody/b, $str); ? [EMAIL PROTECTED] tmp]$ php -q /tmp/test.php htmlbbody/bHighlight the bbody/b of the text/bbody/b/html -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: string highlight
Rory Browne wrote: snip won't be picked up as a word boundry (\b). Aparently it will. /snip I stand corrected based on these two rules for \b since and are non-word characters... # Between a word character and a non-word character following right after the word character. # Between a non-word character and a word character following right after the non-word character. -- 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
[PHP] Objects and Performance
Hi, I am creating a small API in PHP, i.e. a collection of reusable functions for other programmers. As it is now, it is just many functions together in the same file. Do you think I should make it object-oriented? What are the pros and cons of this approach in PHP? I am particularly very concerned about performance. Are object methods slower than functions in php? -- NSK http://portal.wikinerds.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Objects and Performance
On 6/8/05, NSK [EMAIL PROTECTED] wrote: Hi, I am creating a small API in PHP, i.e. a collection of reusable functions for other programmers. As it is now, it is just many functions together in the same file. Do you think I should make it object-oriented? What are the pros and cons of this approach in PHP? I am particularly very concerned about performance. Are object methods slower than functions in php? Definitely not scientific but have a look: http://destiney.com/Benchmarks -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to execute local applications on the client
First, thanks to all who replied! and yes I was aware of that kind of security issues and expected no positive results upon my question. But I've forgotten about the wsh. Now I think I would use it in case it is *absolutely* necessary Thanks again Mauricio On Tue, 2005-06-07 at 21:28, Rory Browne wrote: Sort of. There are two ways to do this(that I can think of, and neither of them are too reliable. Consider this: how would you like if any random website, could run any program they liked on your computer? This could range from word/excel, to less amicable programs like ones that control your speakers/microphone, etc. Having that said, you can use nsiProcess(in netscape/gecko based browsers.), or wsh for MSIE. I'm not sure exactly how to do this. I just remember reading some code that needed this. On netscape/mozilla/gecko you'll have to tell the script to override the security preventing this(the user will be shown a dialog box, asking them to confirm this). I'm not sure what the situation is with MSIE, but expect to encounter some security issues. I don't know any examples for nsIProcess off-hand, but you can check out the PHUI Code for an example on doing this on MSIE. On 6/7/05, Mauricio Pellegrini [EMAIL PROTECTED] wrote: Hi, sorry if what I am asking makes no sense, but here it goes.. Some one has asked me to set a web page from within wich users could launch local applications. Those applications are allready installed in the client PC. The link on the web page would act as a simple link to start the application. This page would be something that resembles the windows desktop with all its links on it. My question is would it be possible to start in example word or excel from a link in a web page? Thanks for your answers Mauricio -- 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] problem with IE and php
On Wed, June 8, 2005 11:01 am, Philippe Reynolds said: Acutally, I have just resolved my problem. I was using method=get in my form (which contains at least a hundred values to be passed back). This overloaded the address length and therefore could not and would not action the second page. I switch to method=post in my form (which does not pass everything to the address line, and therefore allowing the second page to be actionned.. That to all you, who had input in this problem. The minimum POST limit, which servers *CAN* impose, if they want, is larger than the minimum GET limit, which servers *CAN* impose. So maybe you fixed it, or maybe you'll just have trouble as soon as you add one more INPUT... You may want to break your form up into smaller forms. Or maybe not, if you can find out the limit imposed by YOUR server, and measure your FORM POST data length, and reassure yourself you'll never cross that line. PS Plan on Evil Person who intentionally tries to overload your POST input. -- 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] problem between IE and PHP
On Wed, June 8, 2005 7:53 am, Philippe Reynolds said: I'm having a little problem with the interaction between php and IE. I have two .php pages. Show us the page. The first contains a form with the standard submit button. However when I come to push the button, I get a ding sound (standard error sound) and it seems like the button is deactivated. However when I try with my firefox browser, everything works fine. I then created a duplicate of the page, with no php and saved it as a .html file. With internet explorer and firefox, everything worked fine. I do not understand how this can be. Is Internet Explorer treated the php differently? IE is really broken, and will do a lot of dumb things based on the URL. But even IE isn't *THAT* broken, last time I checked... -- 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] Add Excel/Word documents to a dynamic pdf.
On Wed, June 8, 2005 5:23 am, Bosky, Dave said: Basically I have a master list of available files in the following formats: text, JPEG images, Excel, Powerpoint, and Word. The user selects all the documents they need from the list and then I need to build a dynamic PDF containing all the selected files. Is this possible? Yes, but... There are commercial $$$ tools to convert Word and Excel (I think) and Powerpoint (well, maybe not) into PDF. You could then pay for the license of libpdf to have PDI which lets you smush a bunch of PDFs into one big monster PDF. This is not gonna be cheap... And I don't promise Excel and Powerpoint. There are some less expensive tools on Windows (and maybe other platforms) that let you Print to PDF and you could maybe get a Windows box to use do those... Well, you could get it to do as well as you can get a Windows box to do anything at all... But the combining part will almost for sure cost you some money. I don't have hard prices to quote you, but you can dig them out. -- 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] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
On Tue, June 7, 2005 3:30 pm, Matt Babineau said: Is there a way to make a JPG? I've looked at a few sites from google..most are activeX...somewhat undersirable. Looking for something I can run on the server to do the convert work. webthumb from the GD guys might do what you want for the JPG thing. It's only been on my list of cool things to check out for, ummm, a year? -- 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] The goto discussion on the Internals List
On Tue, June 7, 2005 10:59 am, Robert Cummings said: PHP has never purported to be an OOP only language. It advocates both procedural and OOP programming methodologies. Just ask Richard Lynch :) Don't bother asking me - Ask Rasmus :-) And, for the record, *I* sure as hell don't want to see a GoTo in PHP. If you're down to the clock cycles where GoTo versus if/else matters, you should be coding that part in C anyway. [He says blithely, not having coded in C in over a decade.] PS I never knew PHP and I shared our birthday! Two reasons to celebrate!!! -- 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
[PHP] Returned mail: Data format error
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] The message was undeliverable due to the following reason(s): Your message was not delivered because the destination computer was not reachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there is a network problem that prevented delivery, but it is also possible that the computer is turned off, or does not have a mail system running right now. Your message could not be delivered within 2 days: Host 123.97.208.227 is not responding. The following recipients could not receive this message: php-general@lists.php.net Please reply to [EMAIL PROTECTED] if you feel this message to be in error. file attachment: mail.zip This e-mail in its original form contained one or more attached files that were infected with the [EMAIL PROTECTED] virus or worm. They have been removed. For more information on Road Runner's virus filtering initiative, visit our Help Member Services pages at http://help.rr.com, or the virus filtering information page directly at http://help.rr.com/faqs/e_mgsp.html. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Telling users and machines apart
On Tue, June 7, 2005 5:39 am, Merlin said: I am getting more and more emails through my webforms submited by bots. It looks like some sites liky yahoo are placing an image into their forms and the human has to enter a code visible on the image to submit the form. After some googling I found captcha, but I do not like the images. Do you know if there is a class available for PHP which does create the image and does parts of the handling? That seems like a common task to me. Maybe someone else already implemented such thing and can recommend. One of my clients was getting a zillion guestbook entries by weblink farm jerks. I could have installed CAPTCHA, I guess, but, honestly, I have a REALLY hard time as a user guessing what all the letters are with all the background noise they use -- I end up having to submit a form 3 times to get a usable image. Ugh. Not a pleasant user experience. Course, I never read the docs, so maybe that's a feature I could turn off... Plus, I couldn't think of the name of CAPTCHA (again) so it would have taken me longer to find that name than to just roll my own... Anyway, I figured I could whip up my own crude not-CAPTCHA, and be able to more easily support it, and so I did. And now I've turned it into an example for you: http://voodookings.net/eyesonly_example.htm NOTE: This wasn't intended to be released code. It's very crude, one-off, for a starving musician client that pays me $35/month, of which $20 goes to hosting fees... Buy his CD if you like old-school bluesy/roots rock, so he can afford to pay me more, and maybe I'll clean up the code :-) http://cdbaby.com/voodookings2 PS Yes, a spammer *COULD* use OCR to read that text in the image to be able to continue spamming our guestbook... Doesn't seem likely, eh? If they do, I'll add noise to the image with GD, or just switch to CAPTCHA. [shrug] -- 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] about the absolutely path
On Mon, June 6, 2005 11:30 pm, Burhan Khalid said: maybe you could use the apache ProxyPass directive? ProxyPass testb.xxx.com/a/ testa.xxx.com or something like that. (I'm just half-remembering a cool post by Rasmus L. so the syntax is probably off) I've been trying to search for that message for a while. It talked about running php4 and php5 in one Apache instance. http://marc.theaimsgroup.com/?l=php-generalm=01114830176w=2 -- 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] Japanese with UTF-8 and mysql
On Mon, June 6, 2005 11:02 pm, Mark Sargent said: The correct way - if one wants utf-8 as charset - is: header(Content-Type: index/html; charset=utf-8); actually, if I add this, header(Content-Type: index/html; charset=utf-8); as suggested, firefox prompts to download the page, instead of just displaying the page. You have chosen to open productdetails.php which is a : PHP file from: http://localhost/ What should firefox do with this file? Open with Browse.. Save to disk Weird, what's with that. Cheers. Sigh. I think they implemented the IE bug that looks at URLs instead of Headers in some cases. Rename your PHP script to be .htm, and then use .htaccess with ForceType to make it really be a PHP script. Files productdetails.htm ForceType application/x-httpd-php /Files Then the browser CAN NOT KNOW you used PHP to generate the file, so cannot possibly screw up... Well, at least it can't screw up in the way it is doing now. :-) -- 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
[PHP] PEAR installation
I'm having problems installing PEAR. When running the go-pear.php installer (version 0.2.2), I get the following message after submitting the form on the 'Configuration' page... Error Downloading package: Pager download of http://pear.php.net/get/Pager failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) I'm running PHP 5.0.3, on Windows 2000, with IIS Thanks Danielle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR installation
Danielle wrote: I'm having problems installing PEAR. When running the go-pear.php installer (version 0.2.2), I get the following message after submitting the form on the 'Configuration' page... Error Downloading package: Pager download of http://pear.php.net/get/Pager failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) You had an internet timeout. Make sure that any proxy configuration is entered, or if you don't use one, try again later and it should work. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Objects and Performance
Greg Donald wrote: On 6/8/05, NSK [EMAIL PROTECTED] wrote: Hi, I am creating a small API in PHP, i.e. a collection of reusable functions for other programmers. As it is now, it is just many functions together in the same file. Do you think I should make it object-oriented? What are the pros and cons of this approach in PHP? I am particularly very concerned about performance. Are object methods slower than functions in php? Definitely not scientific but have a look: http://destiney.com/Benchmarks If you want to compare object methods versus functions, you should compare identical code inside a method to code inside a function. Greg's benchmarks compare two different ideological code structures. Quite honestly, the wrapping of mt_srand() inside a function or method does not satisfy the definition of good coding, object-oriented or otherwise. Functions/methods should be used to abstract common operations. mt_srand() already does this necessary abstraction, and putting a further wrapper around it makes no sense. Nobody can give you a good answer to your question without seeing the specific code. If your code requires a lot of global variables in order to operate, you might consider abstracting this into a class. Also, if you find yourself creating several copies of the same variables, use classes in order to allow two incarnations of the code to exist in the same file as objects. If your code does simple operations on a few operands and returns a value, like our mt_srand() function, there is absolutely no point in making it more complicated. However, you could consider wrapping the functions inside a class and using them as static methods. This would essentially give them a namespace that would allow any conflicts with other programmer's function names to be more easily resolved. In other words, renaming a class is a whole lot simpler than renaming a function (think search-and-replace ClassName:: versus functionprefix_ - the second one might inadvertantly replace variables, etc., but the first is unusual syntax) So, in short, analyze the problems your code solves, and see if they would be better solved by abstracting into classes, or by keeping the code as functions. Forget about minor performance differences from program syntax unless you're writing code for a site with thousands of hits per second. In that case, you'll want to use a profiler like APD to find the real bottlenecks in your code. Otherwise your main inefficiency is going to be programmer time rather than processor time: make the code readable and maintainable and it will cut down on bugs and work better than faster code. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Of .txt to .zip
2005/6/8, Jay Blanchard [EMAIL PROTECTED]: [snip] I want that the file with extension .TXT that this in my server, to keep packed it with extension ZIP. Somebody knows since I can do it. [/snip] http://www.php.net/zip but it says 'Read Only Access' from the document? so,the file (.zip) can read via Zip File Functions , they dont have any method to do compress things. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese with UTF-8 and mysql
Richard Lynch wrote: On Mon, June 6, 2005 11:02 pm, Mark Sargent said: The correct way - if one wants utf-8 as charset - is: header(Content-Type: index/html; charset=utf-8); actually, if I add this, header(Content-Type: index/html; charset=utf-8); as suggested, firefox prompts to download the page, instead of just displaying the page. You have chosen to open productdetails.php which is a : PHP file from: http://localhost/ What should firefox do with this file? Open with Browse.. Save to disk Weird, what's with that. Cheers. Sigh. me too I think they implemented the IE bug that looks at URLs instead of Headers in some cases. actually, get this in both Firefox and Mozilla Rename your PHP script to be .htm, done and then use .htaccess with ForceType to make it really be a PHP script. Files productdetails.htm ForceType application/x-httpd-php /Files just checking; that goes into the .htaccess file, which is placed in the same dir as the files for this site..? Then the browser CAN NOT KNOW you used PHP to generate the file, so cannot possibly screw up... if above is correct, it did, with the renamed productdetails.htm page...this is after restarting the server too..did I misunderstand something.? Well, at least it can't screw up in the way it is doing now. :-) perhaps it's just me..? Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting a query for use in a form
Hi everyone, I hope you can all help me. I want to take the information I get from a query and use it is a form as a dropdown select box. For example I want to pull the colors from a table and list them in a drop down box and then when a user selects a color it will pass the colorID for use in writing to another table. I hope that comes across the way I mean. :-( Anyway, I think I used to use something called wddx with java to do this when I was coding in ColdFusion. Thanks!! Kevin Rose Valley Soaps
Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions!
On 6/7/05, Matt Babineau [EMAIL PROTECTED] wrote: Yeah I was considering that...I'm trying the html2pdf site right now. It seems alright...its choking on my invoice as we speak (lots of html). Is there a way to make a JPG? I've looked at a few sites from google..most are activeX...somewhat undersirable. Looking for something I can run on the server to do the convert work. Thanks, Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] -Original Message- From: Jack Jackson [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 07, 2005 3:21 PM To: php-general@lists.php.net Subject: Re: [PHP] Beautiful HTML Invoice - Prints like crap! I need somesuggestions! Matt Babineau wrote: Hi all - I've got a great html invoice that prints like crap because of my user of background images and foreground images. Does anyone have any good suggestions other than turn on images in IE to get this thing to print the graphics? Is there a good way I could convert the HTML view to a JPG? I'm on a linux box and have php 4.3.10. Thanks for the help! Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] Make it a pdf? Is a simple CSS print stylesheet out of the question? If the site is marked up properly, this should be trivial, and would be much easier/more efficient. IMO the only image that should be on a printed invoice, is the logo (if any). -- Chris Martin Web Developer Open Source Web Standards Advocate http://www.chriscodes.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php