php-general Digest 1 Aug 2004 12:40:31 -0000 Issue 2911
php-general Digest 1 Aug 2004 12:40:31 - Issue 2911 Topics (messages 192423 through 192433): Re: function similar to to sizeof 192423 by: raditha dissanayake 192424 by: bruce 192432 by: Justin Patrin Another problem with grids and checkboxes 192425 by: Henri Marc 192426 by: John Holmes Re: Invisible watermarking / GD2 192427 by: Jason Wong Re: php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with no hits/errors logged by apache 192428 by: John Nichel Re: php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with 192429 by: ADFH 192433 by: John Nichel Re: SPAMCEASE ??? 192430 by: ADFH Re: Still need help with regex function 192431 by: Justin Patrin 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: [EMAIL PROTECTED] -- ---BeginMessage--- bruce wrote: does php have a function similar to the 'C' sizeof function... yep in PHP 5 but it's just an alias for count. i'm looking to copy an object, and i'd like to be able to copy it at the binary level So how about using the clone feature of PHP5 instead of doing this manually. but i need to be able to determine the size of the object... not sure why you want to do that. any thoughts/comments..??? quick and dirty way to copy and object serialize it into a string and deserialize it back again. thanks -bruce -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. ---End Message--- ---BeginMessage--- specifically, i'm looking to return an object using the socket_write(). this requires that i be able to give it the size of the object being passed... if you know of another approach, i'm more than interested... -thanks -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Saturday, July 31, 2004 6:16 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] function similar to to sizeof bruce wrote: does php have a function similar to the 'C' sizeof function... yep in PHP 5 but it's just an alias for count. i'm looking to copy an object, and i'd like to be able to copy it at the binary level So how about using the clone feature of PHP5 instead of doing this manually. but i need to be able to determine the size of the object... not sure why you want to do that. any thoughts/comments..??? quick and dirty way to copy and object serialize it into a string and deserialize it back again. thanks -bruce -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- On Sat, 31 Jul 2004 18:24:06 -0700, bruce [EMAIL PROTECTED] wrote: specifically, i'm looking to return an object using the socket_write(). this requires that i be able to give it the size of the object being passed... if you know of another approach, i'm more than interested... -thanks serialize() it, then get the size of the string, send it, and deserialize() it on the other side. -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Saturday, July 31, 2004 6:16 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] function similar to to sizeof bruce wrote: does php have a function similar to the 'C' sizeof function... yep in PHP 5 but it's just an alias for count. i'm looking to copy an object, and i'd like to be able to copy it at the binary level So how about using the clone feature of PHP5 instead of doing this manually. but i need to be able to determine the size of the object... not sure why you want to do that. any thoughts/comments..??? quick and dirty way to copy and object serialize it into a string and deserialize it back again. thanks -bruce -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- 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:
php-general Digest 2 Aug 2004 01:04:38 -0000 Issue 2912
php-general Digest 2 Aug 2004 01:04:38 - Issue 2912 Topics (messages 192434 through 192451): regex help 192434 by: Kathleen Ballard 192435 by: Jim Grill 192447 by: Justin Patrin 192448 by: Justin Patrin Re: php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with 192436 by: ADFH 192450 by: John Nichel Re: php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies 192437 by: ADFH Should I wait for PHP 5.1? 192438 by: Randall Perry 192439 by: Matthew Sims 192444 by: Gerard Samuel regex help needed 192440 by: Kathleen Ballard 192441 by: M. Sokolewicz 192442 by: Fabrice Lezoray PHP5 + OpenSSL extension appears to ignore extension sections in configarg array 192443 by: User1001 Cannot compile 192445 by: Andrew W Re: regex help needed -- Solved! Thanks! 192446 by: Kathleen Ballard upload changes accented character 192449 by: Lowell Allen Upgrade PHP? 192451 by: Will Collins 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: [EMAIL PROTECTED] -- ---BeginMessage--- I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. Kathleen ---End Message--- ---BeginMessage--- Can you post a little sample of the data and your current code? thanks. Jim Grill Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Kathleen Ballard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 01, 2004 8:27 AM Subject: [PHP] regex help I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard [EMAIL PROTECTED] wrote: I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. $text = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); You may also have to do this several times as this will only get one br per h tag. $newText = $text; do { $text = $newText; $newText = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); } while($text != $newText); Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- ---End Message--- ---BeginMessage--- Forget my first attempt, using the e modifier and another preg_replace is much better. $return = preg_replace('!h(\d)(.*?)/h\1!ie', 'preg_replace(!br[^]*!i, , $1)', $originalText); On Sun, 1 Aug 2004 13:39:49 -0700, Justin Patrin [EMAIL PROTECTED] wrote: On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard [EMAIL PROTECTED] wrote: I am at the tailend of a project that involves
[PHP] Re: SPAMCEASE ???
I got the following e-mail from this list. Is this legit? I'm skeptical because the URL it tells me to click on leads to what looks like a SPAM site to me. Here's the full e-mail I received with headers: ... Received: from tgpnexus.com ([66.17.150.83]) by mc3-f36.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Thu, 22 Jul 2004 04:21:34 -0700 Received: (from [EMAIL PROTECTED])by tgpnexus.com (8.11.6/8.11.6) id i6MB4jg26425; Thu, 22 Jul 2004 07:04:45 -0400 Looks like a spam to me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still need help with regex function
On Sat, 31 Jul 2004 18:07:07 -0600, C.F. Scheidecker Antunes [EMAIL PROTECTED] wrote: Hello, In order to get the filenames from the output below I have tried the following: preg_match_all('/inflating:(.*?)/', $stdout, $matches); Why do you have around the (.*?)? The sample text below doesn't have . Also, you can use ^ for the beginning of the line and $ for the end if you use the m modifier. preg_match_all('/^inflating:(.*)$/m', $stdout, $matches); print_r($matches); return $matches[1]; But I only get empty arrays with it. I need to fix that so I can have the filenames stored on arrays and also evaluate the type of output according to the situations ilustrated bellow. Contents of $stdout: unzip test.zip Archive: test.zip inflating: arch1.txt inflating: arch2.txt inflating: arch3.txt inflating: arch4.txt inflating: arch5.txt inflating: arch6.txt The same I have from a pkware execution : pkunzip teste.zip PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86 Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745 Extracting files from .ZIP: teste.zip Inflating: arch1.txt Inflating: arch2.txt Inflating: arch3.txt Inflating: arch4.txt Inflating: arch5.txt So, I need some help on how to write a regexp to get the values after inflating, that is the filenames, and put them in an array. Both outputs above are stored on a $stdout php variable. Also, I need to be able to indentify errors with the unzip utility that does not support some types of zip file, the output is like this: unzip test1.zip Archive: test1.zip skipping: test1.txt `shrink' method not supported There's a skipping instead of a inflating or Inflating in pkware. The third situation is an error on the zip file itself : unzip test2.zip Archive: test2.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of test2.zip or test2.zip.zip, and cannot find test2.zip.ZIP, period. or pkunzip test2.zip PKZIP(R) Version 6.0 FAST! Compression Utility for Linux X86 Copyright 1989-2002 PKWARE Inc. All Rights Reserved. Evaluation Version PKZIP Reg. U.S. Pat. and Tm. Off. Patent No. 5,051,745 Extracting files from .ZIP: test2.zip Errors were found in .ZIP file, attempt to fix (Yes/No)? N PKZIP: (Z152) No CE signature found Help is much appreacited. Thanks in advance to all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:410c3369274921203516279! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function similar to to sizeof
On Sat, 31 Jul 2004 18:24:06 -0700, bruce [EMAIL PROTECTED] wrote: specifically, i'm looking to return an object using the socket_write(). this requires that i be able to give it the size of the object being passed... if you know of another approach, i'm more than interested... -thanks serialize() it, then get the size of the string, send it, and deserialize() it on the other side. -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Saturday, July 31, 2004 6:16 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] function similar to to sizeof bruce wrote: does php have a function similar to the 'C' sizeof function... yep in PHP 5 but it's just an alias for count. i'm looking to copy an object, and i'd like to be able to copy it at the binary level So how about using the clone feature of PHP5 instead of doing this manually. but i need to be able to determine the size of the object... not sure why you want to do that. any thoughts/comments..??? quick and dirty way to copy and object serialize it into a string and deserialize it back again. thanks -bruce -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- 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 -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with
ADFH wrote: How are you trying to import it? Command line MySQL? PHPMyAdmin? Something else? command line (have SSH/SCP/SFTP access) mysql dbname dumpname.sql (u/p in ~/.my.cnf, 0600) How big is the dump file? Greater than two megs? 11M Jul 28 12:57 200405009-025130.sql 21M Jul 29 23:19 20040509-clean.sql 30K Jul 29 12:10 freshdb.sql 11MB for the initial dump 21MB for non-optimised dump from same DB tested as working, redumped from other system Ie. I imported it into another system, fixed a few things like missing themes, and re-dumped it. Well, that eliminates the first thought I had. Things like phpMyAdmin have problems with dump files greater than 2mb's (sometimes even if you set the file upload size and timeout higher on PHP). Can you verify that the data is actually in the db? Also, you may want to try importing the dump and not relying on your MySQL configuration file mysql --user=username -p dbname dumpname.sql -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regex help
I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Can you post a little sample of the data and your current code? thanks. Jim Grill Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Kathleen Ballard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 01, 2004 8:27 AM Subject: [PHP] regex help I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. Kathleen -- 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] php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with
Can you verify that the data is actually in the db? I'll attempt to reverify by dumping data back out again and comparing size. I suspect it is, however. Ie. The login succeeds because a cookie is set, and I can go to some scripts, but not others. Even if it isn't, how could this stop Apache from logging even an error? Also, you may want to try importing the dump and not relying on your MySQL configuration file mysql --user=username -p dbname dumpname.sql Have done this too in initial tests, I just got sick of typing password all the time :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies
Can you verify that the data is actually in the db? I'll attempt to reverify by dumping data back out again and comparing size. I suspect it is, however. 21M Jul 29 23:19 20040509-clean.sql -- Before 21M Aug 1 12:03 redump.sql -- After Yeah.. all the data's in the DB. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Should I wait for PHP 5.1?
Any major gotchas going from 4 to 5? Any problems with PostgreSQL connectivity? Will I have to scour and rewrite current scripts? -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Design/Development WebObjects Hosting Mac Consulting/Sales http://www.systame.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Should I wait for PHP 5.1?
Any major gotchas going from 4 to 5? Any problems with PostgreSQL connectivity? Will I have to scour and rewrite current scripts? -- Randall Perry Suppoedly, all code from PHP4 is backwards compatible with PHP5. I think the only major re-vamp was its Object Oriented Model. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regex help needed
Sorry, Here is the code I am using to match the h* tags: h([1-9]){1}.*/h([1-9]){1} I have removed all the NL and CR chars from the string I am matching to make things easier. Also, I have run tidy on the code so the tags are all uniform. The above string seems to match the tag well now, but I still need to remove the br tags from the tag contents (.*). The strings I will be matching are html formatted text. Sample h* tags with content are below: h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary/h4 h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary br / Wins New Jersey/h4 h4Ex-Secretary Reich Loses Mass. Primary/h4 Again, any help is appreciated. Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex help needed
You could try something like: $return = preg_replace('#h[1-9](.*)/h[1-9]#Uie', 'str_replace(br /, , $1)'); - Tul Kathleen Ballard wrote: Sorry, Here is the code I am using to match the h* tags: h([1-9]){1}.*/h([1-9]){1} I have removed all the NL and CR chars from the string I am matching to make things easier. Also, I have run tidy on the code so the tags are all uniform. The above string seems to match the tag well now, but I still need to remove the br tags from the tag contents (.*). The strings I will be matching are html formatted text. Sample h* tags with content are below: h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary/h4 h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary br / Wins New Jersey/h4 h4Ex-Secretary Reich Loses Mass. Primary/h4 Again, any help is appreciated. Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex help needed
hi M. Sokolewicz a écrit : You could try something like: $return = preg_replace('#h[1-9](.*)/h[1-9]#Uie', 'str_replace(br /, , $1)'); - Tul Kathleen Ballard wrote: Sorry, Here is the code I am using to match the h* tags: h([1-9]){1}.*/h([1-9]){1} I think this mask is better : `h([1-6]).*?/h\1)`sie I have removed all the NL and CR chars from the string I am matching to make things easier. Also, I have run tidy on the code so the tags are all uniform. The above string seems to match the tag well now, but I still need to remove the br tags from the tag contents (.*). To remove the br / tags, you need to call preg_replace_callback() : ?php $str = 'h1hi br / ../h1 bla bla h5 br / ../h5 ...br /'; function cbk_br($match) { return 'h' . $match[1] . '' . str_replace('br /', '', $match[2]) . '/h' . $match[1] . ''; } $return = preg_replace_callback('`h([1-6])(.*?)/h\1`si', 'cbk_br', $str); echo $return; ? The strings I will be matching are html formatted text. Sample h* tags with content are below: h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary/h4 h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary br / Wins New Jersey/h4 h4Ex-Secretary Reich Loses Mass. Primary/h4 Again, any help is appreciated. Kathleen -- Fabrice Lezoray http://classes.scriptsphp.fr - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 + OpenSSL extension appears to ignore extension sections in configarg array
Using PHP-5.0 + OpenSSL-0.9.7c + PHP5-Openssl extension, trying to use a specific extension section within the openssl.cnf file appears to not work, or fail without any returned error, when specifying either/both of x509_extensions and req_extensions in the configarg array. Only sections defined to x509_extensions and req_extensions assigned in the openssl.cnf file appear to be used. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Should I wait for PHP 5.1?
On Sunday 01 August 2004 12:19 pm, Randall Perry wrote: Any major gotchas going from 4 to 5? Any problems with PostgreSQL connectivity? Will I have to scour and rewrite current scripts? My opininon would be to wait on maybe 5.0.1, especially if its on a production box. Im not having an absolute blast with it on my dev boxes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cannot compile
I've compiled installed software from source before but PHP 5 is proving a challenge. I've decompressed the tarball and cd into the directory. Run ./configure which seems to work ok but then when I do make I get the following error: No targets specified and no makefile found Sure enough there is no makefile in the directory so for some reason ./configure isn't creating one. Can anyone offer any help? Thanks AW -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: regex help needed -- Solved! Thanks!
Thanks! Works like a charm! I am the very lowest of newbies when it comes to regex and working through your solutions has been very educational. I have one question about something I couldn't figure out: #h[1-9](.*)/h[1-9]#Uie `h([1-6]).*?/h\1)`sie What is the purpose of the back-ticks and the '#'? What are 'Uie' and 'sie'? Thanks again! Kathleen -Original Message- From: Fabrice Lezoray [mailto:[EMAIL PROTECTED] Sent: Sunday, August 01, 2004 2:52 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: regex help needed hi M. Sokolewicz a écrit : You could try something like: $return = preg_replace('#h[1-9](.*)/h[1-9]#Uie', 'str_replace(br /, , $1)'); - Tul Kathleen Ballard wrote: Sorry, Here is the code I am using to match the h* tags: h([1-9]){1}.*/h([1-9]){1} I think this mask is better : `h([1-6]).*?/h\1)`sie I have removed all the NL and CR chars from the string I am matching to make things easier. Also, I have run tidy on the code so the tags are all uniform. The above string seems to match the tag well now, but I still need to remove the br tags from the tag contents (.*). To remove the br / tags, you need to call preg_replace_callback() : ?php $str = 'h1hi br / ../h1 bla bla h5 br / ../h5 ...br /'; function cbk_br($match) { return 'h' . $match[1] . '' . str_replace('br /', '', $match[2]) . '/h' . $match[1] . ''; } $return = preg_replace_callback('`h([1-6])(.*?)/h\1`si', 'cbk_br', $str); echo $return; ? The strings I will be matching are html formatted text. Sample h* tags with content are below: h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary/h4 h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary br / Wins New Jersey/h4 h4Ex-Secretary Reich Loses Mass. Primary/h4 Again, any help is appreciated. Kathleen -- Fabrice Lezoray http://classes.scriptsphp.fr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard [EMAIL PROTECTED] wrote: I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. $text = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); You may also have to do this several times as this will only get one br per h tag. $newText = $text; do { $text = $newText; $newText = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); } while($text != $newText); Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
Forget my first attempt, using the e modifier and another preg_replace is much better. $return = preg_replace('!h(\d)(.*?)/h\1!ie', 'preg_replace(!br[^]*!i, , $1)', $originalText); On Sun, 1 Aug 2004 13:39:49 -0700, Justin Patrin [EMAIL PROTECTED] wrote: On Sun, 1 Aug 2004 06:27:51 -0700 (PDT), Kathleen Ballard [EMAIL PROTECTED] wrote: I am at the tailend of a project that involves moving legacy data from one dbms to another. The client has added a new requirement to the data manipulation that is required. I need to remove all br / tags (there may be more that one) that appear within all h* tags. I am not very familiar with building regular expressions, but I see this as a 2 part process. First, to grab h* tags, and second, to strip the br's. I can grab the beginning of the tag easily, but my expressions grab too much. Also, I am not sure how to remove the br's. Any help would be appreciated. I have tried to find similar examples, but without any luck. Also, php5 is not an option at this point. $text = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); You may also have to do this several times as this will only get one br per h tag. $newText = $text; do { $text = $newText; $newText = preg_replace('!(h\d[^]*.*?)br/(.*?/h\d)!is', '\1\2', $text); } while($text != $newText); Kathleen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upload changes accented character
I've built a system which uploads a tab-delimited text file saved from Excel, then uses the text file to update a MySQL database. But when the text file contains an é character (confirmed by viewing in a text editor before uploading), the character is converted to some other weird character -- a capital Z with what looks like an inverted circumflex accent above it. This replacement character is stored in the database and output to HTML pages. It doesn't matter if I use htmlentites() on the data before storing in MySQL, the weird Z character is still what's written to the database. And I'm not able to do a string replacement to make it é again (or eacute;), because when I paste the weird accented Z character into a PHP file and save, the character is converted into } (a space and closing bracket). Perhaps this isn't a PHP problem, but can anyone point me towards a solution? Setup is PHP 4.3.2 on FreeBSD 4.10, Apache 1.3.27. TIA -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with
ADFH wrote: Can you verify that the data is actually in the db? I'll attempt to reverify by dumping data back out again and comparing size. I suspect it is, however. Ie. The login succeeds because a cookie is set, and I can go to some scripts, but not others. Even if it isn't, how could this stop Apache from logging even an error? Why would Apache log an error on a db dump? Or are you talking about the execution of the scripts after you import the data? If the latter try setting your php error reporting to E_ALL in a .htaccess file (or in the php.ini if you have access to that). For .htaccess : php_value error_reporting E_ALL If you set it in the php.ini, make sure to restart your web server. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upgrade PHP?
I'm having problems upgrading PHP from 4.2.2 to 4.3.8 on RedHat 9. I've tried simply making the 4.3.8 from source, but RedHat didn't use the default PHP folder structure is seems, since there has been no change in my PHP version. I also tried the ./configure string returned by 'phpinfo()' (assuming that the correct path info was included) with no luck. Does anyone have any tips on an easier way to upgrade? Thanks, Will
RE: [PHP] Upgrade PHP?
i've successfully built php5 on rh8 with no issues... if you search through the achives of this mailing list you'll see what i did. look for mysqli/php. what issues are you haveing when you build from source...??? let us know, and i'm sure someone can help -Original Message- From: Will Collins [mailto:[EMAIL PROTECTED] Sent: Sunday, August 01, 2004 6:03 PM To: [EMAIL PROTECTED] Subject: [PHP] Upgrade PHP? I'm having problems upgrading PHP from 4.2.2 to 4.3.8 on RedHat 9. I've tried simply making the 4.3.8 from source, but RedHat didn't use the default PHP folder structure is seems, since there has been no change in my PHP version. I also tried the ./configure string returned by 'phpinfo()' (assuming that the correct path info was included) with no luck. Does anyone have any tips on an easier way to upgrade? Thanks, Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade PHP?
* Thus wrote Will Collins: I'm having problems upgrading PHP from 4.2.2 to 4.3.8 on RedHat 9. I've tried simply making the 4.3.8 from source, but RedHat didn't use the default PHP folder structure is seems, since there has been no change in my PHP version. I also tried the ./configure string returned by 'phpinfo()' (assuming that the correct path info was included) with no luck. Does anyone have any tips on an easier way to upgrade? I'm assuming that the 4.2.2 was installed from an rpm. If you notice, the 4.2.2 configure string probably has like 3000 different options set. The problem is that when the rpm was built and bundled, it was on a system that had all the 'devel' rpm's installed. The 'devel' rpm's usually contain's all the files needed to detect and compile with php. One option is to install all the devel rpms that are dependent on php to be configured with all those options. The other option would involve bringing your system out of the dependency of RPM's, I wouldn't suggest that unless your very comfortable with RH's system. The last one, and perhaps the best solution, is to scratch that system and build a new one with a more current OS. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4.3.7 + phpBB 2.0.10 + Apache - zero sized replies with
On Sunday 01 August 2004 23:38, ADFH wrote: Even if it isn't, how could this stop Apache from logging even an error? If you're positive that none of the Apache logs shows anything (but that seems *very* unlikely) then I suggest you taking this up with phpBB support. Another thing you could do is check the MySQL logs. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Beware of self-styled experts: an ex is a has-been, and a spurt is a drip under pressure. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgrade PHP?
I've dealt with a similar problem with Mandrake. Some distros have their own idea of where things should go. I prefer to install major applications like apache, perl, mysql, php myself and never install from rpm or accept default distro packages when installing an os from scratch. IMHO: Although handy for some things, I still can't figure out why people put up with rpms. :-) What I finally did is use rpm to uninstall php, apache, and mysql. I also followed dependencies and deleted them as well. This approach is not really a great idea if you're not used to building from source, but I have my own idea of where I like things to go so this works for me. Usually /usr/local is a good choice for installing. Since mysql and apache both come with their own start up scripts using chckconfig to add them to the system is about as easy as it gets. Jim Grill Web-1 Hosting http://www.web-1hosting.net - Original Message - From: Will Collins [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, August 01, 2004 8:03 PM Subject: [PHP] Upgrade PHP? I'm having problems upgrading PHP from 4.2.2 to 4.3.8 on RedHat 9. I've tried simply making the 4.3.8 from source, but RedHat didn't use the default PHP folder structure is seems, since there has been no change in my PHP version. I also tried the ./configure string returned by 'phpinfo()' (assuming that the correct path info was included) with no luck. Does anyone have any tips on an easier way to upgrade? Thanks, Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help needed
On Sun, 1 Aug 2004 10:38:06 -0700 (PDT) Kathleen Ballard [EMAIL PROTECTED] wrote: Sorry, Here is the code I am using to match the h* tags: h([1-9]){1}.*/h([1-9]){1} I have removed all the NL and CR chars from the string I am matching to make things easier. Also, I have run tidy on the code so the tags are all uniform. The above string seems to match the tag well now, but I still need to remove the br tags from the tag contents (.*). The strings I will be matching are html formatted text. Sample h* tags with content are below: h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary/h4 h4Ex-Secretary Mickey Mouse br /Loses Mass. Primary br / Wins New Jersey/h4 h4Ex-Secretary Reich Loses Mass. Primary/h4 Again, any help is appreciated. Kathleen Simple: while (preg_match(/(h\d)(.*)(br \/)(.*)(\/h\d)/is, $str)) { $str = preg_replace(/(h\d)(.*)(br \/)(.*)(\/h\d)/is, $1$2$4$5, $str); } $str = preg_replace(/(h\d)(.*)(\/h\d)/is, $2, $str); Recommended: $str = preg_replace(/(h\d)([^]*)()(.*)(\/h\d)/eis, remove_br('$4'), $str); function remove_br($str){ return preg_replace(/(br)([^]*)()/i, , $str); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Newbie Guide] For the benefit of new members
=== Please feel free to add more points and send to the list. === 1. If you have any queries/problems about PHP try http://www.php.net/manual/en first. You can download a copy and use it offline also. Please also try http://www.php.net/manual/faq.php for answers to frequently answered questions about PHP (added by Christophe Chisogne). 2. Try http://www.google.com next. Searching for php YOUR QUERY may fetch you relevant information within the first 10 results. 3. There is a searchable archive of the mailing list discussion at http://phparch.com/mailinglists. Many of the common topics are discussed repeatedly, and you may get answer to your query from the earlier discussions. For example: One of the repeatedly discussed question in the list is Best PHP editor. Everyone has his/her favourite editor. You can get all the opinions by going through the list archives. If you want a chosen list try this link : http://www.thelinuxconsultancy.co.uk/phpeditors/ (contributed by Christophe Chisogne). 4. Not sure if PHP is working or you want find out what extensions are available to you? Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); ? If PHP is installed you will see a page with a lot of information on it. If PHP is not installed (or not working correctly) your browser will try to download the file. (contributed by Teren and reworded by Chris W Parker) 5. If you are stuck with a script and do not understand what is wrong, instead of posting the whole script, try doing some research yourself. One useful trick is to print the variable/sql query using print or echo command and check whether you get what you expected. After diagnosing the problem, send the details of your efforts (following steps 1, 2 3) and ask for help. 6. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access users' computer related information (OS, screen size etc) using PHP. Nor can you modify any the user side settings. You need to go for JavaScript and ask the question in a JavaScript list. On the other hand, you can access the information that is SENT by the user's browser when a client requests a page from your server. You can find details about browser, OS etc as reported by this request. - contributed by Wouter van Vliet and reworded by Chris W Parker. 7. Provide a clear descriptive subject line. Avoid general subjects like Help!!, A Question etc. Especially avoid blank subjects. 8. When you want to start a new topic, open a new mail composer and enter the mailing list address [EMAIL PROTECTED] instead of replying to an existing thread and replacing the subject and body with your message. 9. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. [contribued by Chris W Parker] 10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html [contributed by Jay Blanchard) 11. Do not send your email to the list with attachments. If you don't have a place to upload your code, try the many pastebin websites (such as www.pastebin.com). [contributed by Burhan Khalid] Hope you have a good time programming with PHP. -- Integrated Management Tools for leather industry -- http://www.leatherlink.net Ma Siva Kumar, BSG LeatherLink (P) Ltd, Chennai - 600106 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php