[PHP] Re: Greetings
Dear Pop Mihai Sergiu, By sending this email you (again) posted to a public mailing list which is archived at multiple places, of which really few are under our control. There would be no point in removing your message from our archives, as it is also posted to an unknown number of other archives around the internet. Also there is no point in attaching a signature below your message which prohibits the review of the contents, as the signature is only read after the message is alread read. Regards, Gabor Hojtsy Pop Mihai Sergiu wrote: Greetings, The scope of this document is to file a complain related to privacy of our offices e-mail address published all over the internet. If you would care to query google for the e-mail : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] you would easily see what im talking about ! A while ago i`we send one or two emails to PHP.NET, requesting some info related to capturing the CPU / Storage ID using php, info which would have helped me in finishing a php web application at that time. Since then my e-mail address and comments were posted through the internet, making my e-mail public to all sorts of SPAMMERS. I understand that maybe this action was to keep the Question/Answer for others to see, but i do intend to kindly ask you [if possible] to hide my e-mail address from all the web posts. Since my e-mail appeared online, my Inbox is constantly flooded with unneccessary documents that stall my timeline. Maybe it is to already too late to change anything, but if anything can be done, please support me in any way you can to get rid of this issue. Sincerely, Pop Mihai Sergiu SOFTWARE POP SERVICE ELECTRONIC Research Developement department A : Str. Calea Severilului, Bl 317 a.b. 200233, DOLJ, Craiova, Romania E : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] W : Http://www.popservice.ro http://www.popservice.ro P : +(40) - 251 483 627 F : +(40) - 251 418 773 M : +(40) - 744 507 700 Y : res3arch ymsgr:sendIm?res3arch *This mail is scanned and proven not to contain any virus.* *CONFIDENTIALITY NOTICE: *This communication and any accompanying document(s) contains information from the offices of SOFTWARE POP SERVICE ELECTRONIC and may be confidential or privileged. The information is intended for the personal and confidential sole use of the individual or entity named above. If you receive this transmission in error, you are advised that any review, disclosure, copying, distribution, or the taking of any action in reliance upon the communication is strictly prohibited. If you have received this communication in error, please contact us immediately by e-mail at [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]_ or by telephone at _(+40) 744507700_. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP for Mac
Richard, Caveat: I'm not a OS X user, so this information may not help you. Richard Correia wrote: I want to install PHP5 on Mac powerbook G4. Can someone please let me know where I can find it and it's related module? The installation instructions for OS X on PHP.net[1] points to this[2] resource for installing a portfile. It appears to come with GD compiled in already, but you'll have to look a bit further for Ming. I am mainly looking for GD and mingswf module on Mac. 1. http://www.php.net/manual/en/install.macosx.php 2. http://php5.darwinports.com/ David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I have stange problem
Hi, I'm trying to install winxp\apache2\php5.1.2\MySql. The installation was good i have apache recognized php ( Apache/2.0.55 (Win32) PHP/5.1.2 Server at localhost Port 8080 ) so i wrote test script (? phpinfo();?) and sometimes the script is working and i got the data and some time i got Cannot find server or DNS Error or 404 error can you tell me what is wrong? Thnaks in advenced
[PHP] Regex help
I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 I've been testing with: http://www.quanetic.com/regex.php and have been somewhat successful. Using this pattern: /[0-9]{2,}( X| x|x )/ I have: 102-90 E [!MATCH!] [!MATCH!] 70 3/8 Ideally what I want to do is update the db table that holds these records. ID: 1 Unit: 102-90 E 42 X 42 X 70 3/8 Panel: 42 Width: 42 Height: 70 3/8 $pattern1 = '/[0-9]{2,}( X| x|x )/'; $units = array of units above foreach($units AS $unit){ preg_match($pattern1,$unit[1],$match); print_r($match); echo Panel: .$match[0]; } The $match array is empty. Actually looking at the data there are so many typos (imported from Excel) that I will probably have to update by hand, but out of curiosity now what would be a good regex for the info given? Thanks, Mike Smith -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regex help
Mike Smith wrote: I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 If this string is always in this format xxx E panel X width X height then you could try something like: // Very much untested $unit = '102-90 E 42 X 42 X 70 3/8'; $split1 = explode('E', $unit); list($panel, $width, $height) = explode('X', $split1[1]); Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.17/228 - Release Date: 2006/01/12 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
This should do the trick: /(\d+) ?X ?(\d+) ?X ?(\d+ [\d\/]+)/i (at least it would in Perl) Le 13 Janvier 2006 08:25, Mike Smith a écrit : I'm trying to save myself some time by extracting certain variables from a string: 102-90 E 42 X 42 X 70 3/8 I've been testing with: http://www.quanetic.com/regex.php and have been somewhat successful. Using this pattern: /[0-9]{2,}( X| x|x )/ I have: 102-90 E [!MATCH!] [!MATCH!] 70 3/8 Ideally what I want to do is update the db table that holds these records. ID: 1 Unit: 102-90 E 42 X 42 X 70 3/8 Panel: 42 Width: 42 Height: 70 3/8 $pattern1 = '/[0-9]{2,}( X| x|x )/'; $units = array of units above foreach($units AS $unit){ preg_match($pattern1,$unit[1],$match); print_r($match); echo Panel: .$match[0]; } The $match array is empty. Actually looking at the data there are so many typos (imported from Excel) that I will probably have to update by hand, but out of curiosity now what would be a good regex for the info given? Thanks, Mike Smith -- Eric Martel Sainte-Foy (Québec) Canada Ce courriel est signé numériquement avec la clef suivante: This e-mail is digitally signed with the following key: ED3F191C (key://pgp.mit.edu, http://key.ericmartel.net/) Empreinte/fingerprint: 023D EFB7 8957 CBC0 C4E7 243D F01E D8A8 ED3F 191C Pour plus d'information: http://gpg.ericmartel.net/ For more info: http://kmself.home.netcom.com/Rants/gpg-signed-mail.html There are flaws in Windows so great that they would threaten national security if the Windows source code were to be disclosed. --Microsoft VP Jim Allchin, under oath The intrinsic parallelism and free idea exchange in open source software has benefits that are not replicable with our current licensing model. --Microsoft Read more on http://opensource.org/halloween/ Read between lines: get Linux! It's free, open source, more secure, more reliable and more performant than Window$. http://www.linuxiso.org/ pgpL8YrMZ420Z.pgp Description: PGP signature
[PHP] Parsing a large file
I have large log files from a web server (about a gig in size) and need to parse each line looking for a string, and when encountered push that line to a new file. I was thinking I could have PHP read in the whole file, but thinking it could be a major pain since I have about 20 log files to read through. Anyone have some suggestions? Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.4.2 released!
Hello! The PHP Development Team would like to announce the immediate release of PHP 4.4.2. This is a maintenance release that addresses a number of minor security problems and fixes a few regressions that shown up in PHP 4.4.1. All users of PHP 4 are recommended to upgrade to PHP 4.4.2. A separate release announcement is also available. For changes in PHP 4.4.2 since PHP 4.4.1, please consult the PHP 4 ChangeLog. Release Announcement: http://www.php.net/release_4_4_2.php Downloads:http://www.php.net/downloads.php#v4 Changelog:http://www.php.net/ChangeLog-4.php#4.4.2 regards, Derick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing a large file
Wolf wrote: I have large log files from a web server (about a gig in size) and need to parse each line looking for a string, and when encountered push that line to a new file. I was thinking I could have PHP read in the whole file, but thinking it could be a major pain since I have about 20 log files to read through. Anyone have some suggestions? Is this on a Linux server? Why don’t you use grep? cat filename | grep string newfile see man grep for detail on grep. (It uses regular expressions) Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.17/228 - Release Date: 2006/01/12 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a large file
Windows server, though I may dump it to linux to get my smaller file, however not sure my admin would like that. :) Albert wrote: Wolf wrote: I have large log files from a web server (about a gig in size) and need to parse each line looking for a string, and when encountered push that line to a new file. I was thinking I could have PHP read in the whole file, but thinking it could be a major pain since I have about 20 log files to read through. Anyone have some suggestions? Is this on a Linux server? Why don’t you use grep? cat filename | grep string newfile see man grep for detail on grep. (It uses regular expressions) Albert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regex help
Eric, thanks for replying. I couldn't quite get that to work. Albert, I'm currently working with what you suggested, though the unit names are not that consistent: $vals = preg_split(' ?X? ',$unit[1]); echo strong.$unit[1]./strongbr /\n; echo Panel: .$vals[0].br /Width: .$vals[1].br /Height: .$vals[2].br /\n; 202-90B 48 X 48 X 69 1/4 Panel: 202-90B 48 Width: 48 Height: 69 1/4 Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a large file
Wolf wrote: Windows server, though I may dump it to linux to get my smaller file, however not sure my admin would like that. :) Get a Windows build of grep (and other useful stuff) here: http://unxutils.sourceforge.net/ Albert wrote: cat filename | grep string newfile Why cat? Sorry, but this is one of my pet hates! The following does the same but in one process instead of two. grep [string] [filename] [newfile] -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.4.2 released!
Derick, Derick Rethans wrote: The PHP Development Team would like to announce the immediate release of PHP 4.4.2. This is a maintenance release that addresses a number of minor security problems and fixes a few regressions that shown up in PHP 4.4.1. All users of PHP 4 are recommended to upgrade to PHP 4.4.2. Any indication as to when the Windows binaries will become available? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp_nlist problem
I have a script using some ftp functions that runs just fine on various server I have tested. Now that I've installed it om a customer's server, it ( obviously ) stopped working. claning the script to isolate the problem, I've discovered that the problem is on the ftp_nlist command that freezes the script execution for a lot ( and the machine too, like doing an heavy work ) and then returns an error ( false ). ftp_rawlist has the same problems. all the previous operations ( connect, login and chdir ) work without problems. any idea on where could I check for a solution? thank you, Giulio Cantoberon Multimedia srl http://www.cantoberon.it Tel. 06 39737052 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a large file
best way I think is nohup grep -i string log1 log2 log3 ...logx newfile This will run this command in background and you can work on other meanwhile. Thanks Richard On 1/13/06, Wolf [EMAIL PROTECTED] wrote: I have large log files from a web server (about a gig in size) and need to parse each line looking for a string, and when encountered push that line to a new file. I was thinking I could have PHP read in the whole file, but thinking it could be a major pain since I have about 20 log files to read through. Anyone have some suggestions? Thanks, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Greetings
Gabor Hojtsy wrote: Dear Pop Mihai Sergiu, By sending this email you (again) posted to a public mailing list which is archived at multiple places, of which really few are under our control. There would be no point in removing your message from our archives, as it is also posted to an unknown number of other archives around the internet. Also there is no point in attaching a signature below your message which prohibits the review of the contents, as the signature is only read after the message is alread read. It should also be noted that simply saying something is confidential is not enough. The sender has to exercise a level of care to prevent private and confidential information and communications from becoming public. Obviously posting any such information to a fundamentally public forum negates any such expectations. It is like screaming, at the top of your lungs, in a public venue, a secret. You would not have any reasonable expectation of privacy even if you screamed don't tell anyone. However, his rant does present a real issue. Forcing people to use real email addresses exposes them to SPAM and abuse. I would suggest, if possible and resources permit, that some sort of aliasing/registration system be deployed where every post is may by [EMAIL PROTECTED] and every ABCDEFGH is a registered user who's email address is known. Regards, Gabor Hojtsy Pop Mihai Sergiu wrote: Greetings, The scope of this document is to file a complain related to privacy of our offices e-mail address published all over the internet. If you would care to query google for the e-mail : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] you would easily see what im talking about ! A while ago i`we send one or two emails to PHP.NET, requesting some info related to capturing the CPU / Storage ID using php, info which would have helped me in finishing a php web application at that time. Since then my e-mail address and comments were posted through the internet, making my e-mail public to all sorts of SPAMMERS. I understand that maybe this action was to keep the Question/Answer for others to see, but i do intend to kindly ask you [if possible] to hide my e-mail address from all the web posts. Since my e-mail appeared online, my Inbox is constantly flooded with unneccessary documents that stall my timeline. Maybe it is to already too late to change anything, but if anything can be done, please support me in any way you can to get rid of this issue. Sincerely, Pop Mihai Sergiu SOFTWARE POP SERVICE ELECTRONIC Research Developement department A : Str. Calea Severilului, Bl 317 a.b. 200233, DOLJ, Craiova, Romania E : [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] W : Http://www.popservice.ro http://www.popservice.ro P : +(40) - 251 483 627 F : +(40) - 251 418 773 M : +(40) - 744 507 700 Y : res3arch ymsgr:sendIm?res3arch *This mail is scanned and proven not to contain any virus.* *CONFIDENTIALITY NOTICE: *This communication and any accompanying document(s) contains information from the offices of SOFTWARE POP SERVICE ELECTRONIC and may be confidential or privileged. The information is intended for the personal and confidential sole use of the individual or entity named above. If you receive this transmission in error, you are advised that any review, disclosure, copying, distribution, or the taking of any action in reliance upon the communication is strictly prohibited. If you have received this communication in error, please contact us immediately by e-mail at [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]_ or by telephone at _(+40) 744507700_. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Greetings
Mark wrote: Gabor Hojtsy wrote: Dear Pop Mihai Sergiu, By sending this email you (again) posted to a public mailing list which is archived at multiple places, of which really few are under our control. There would be no point in removing your message from our archives, as it is also posted to an unknown number of other archives around the internet. Also there is no point in attaching a signature below your message which prohibits the review of the contents, as the signature is only read after the message is alread read. It should also be noted that simply saying something is confidential is not enough. The sender has to exercise a level of care to prevent private and confidential information and communications from becoming public. Obviously posting any such information to a fundamentally public forum negates any such expectations. It is like screaming, at the top of your lungs, in a public venue, a secret. You would not have any reasonable expectation of privacy even if you screamed don't tell anyone. Nice analogy. However, his rant does present a real issue. Forcing people to use real email addresses exposes them to SPAM and abuse. I would suggest, if possible and resources permit, that some sort of aliasing/registration system be deployed where every post is may by [EMAIL PROTECTED] and every ABCDEFGH is a registered user who's email address is known. I would have to disagree with this. I've been on lots of 'public' mailing lists for quite a while and this is the first time I've ever seen a complaint of this nature. I really think the OP should have taken more care to read the mailing lists page on php.net before signing up. It clearly states that there are archives and that they are searchable. If privacy was a concern then these archives should have been checked to make sure they obscure email addresses. If there is any issue I think it's that the above mentioned web page does not make it clear that there are lots of archives in addition to those mentioned that php.net does not control. At any rate I don't see any need for php.net to implement a system for anonymising posts - that would be a huge waste of resources as a result of a single complaint out of what is probably many thousands of list members. Hmm, must be Friday! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Greetings
Stut wrote: Mark wrote: ! -- SNIpped for brevity -- OK, here's the deal. Even if every email address was randomized (stupid) it still does not sole the issue of someone sending it to lists. Even randomized anonymous email addresses wind up going back to you, however it puts more load on a server in the process. RTM before signing up for a list. Inability to understand and read all information does not constitute a you have to fix it on the owner's part. Use a robust email program to read and filter your email. At work I get over 1000 emails a day, about 15 of which are not spam. I see MAYBE 30 in a day total, but my junk box fills up nicely. I use Thunderbird and have it reading and learning. For domains which host spammers ispsimple and ispmyway then my filter is set to check the email From line for *.isp*.* and not only delete it but mark it as junk and learn from it. You signed up for the list, be responsible for your own actions. Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Lions and tigers and slashes, oh my!
I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Jay Blanchard wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! http://php.net/urlencode -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
On 1/13/06, Jay Blanchard [EMAIL PROTECTED] wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Call it Oil and Gas? Dotan Cohen http://technology-sleuth.com/long_answer/what_is_hdtv.html 345
Re: [PHP] Lions and tigers and slashes, oh my!
Jay, Jay Blanchard wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! Probably not the answer you're looking for, and somewhat site-stepping the issue, but can't you use the category key instead of its title? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Jay Blanchard wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! Are the categories stored in the db with a unique (numeric?) id? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
On 1/13/06, Jay Blanchard [EMAIL PROTECTED] wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! Have you tried \? Dotan Cohen http://technology-sleuth.com/technical_answer/how_much_memory_will_i_need_for_my_digital_camera.html 232
Re: [PHP] Lions and tigers and slashes, oh my!
Jay Blanchard wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. 'problem' 1 is the form in which you store the string in the DB. 'amp; is html encoding - your DB is not a webpage ergo it doesn't need to contain html entities! that is to say - only make html entities of characters when you need to (i.e. after you have extracted the data from the db but before you send it to the browser) 'problem' 2 is that you need to urlencode the string 'Oil Gas' when you want it to be the value of a url parameter; I have a sneaking suspcision that urlencoding the string 'Oil amp; Gas' will not do what you want exactly. you might consider using a different url parameter seperator character than the ampersand for this particular app. - the semicolon is often mentioned as a good alternative (it's even mentioned in the std php.ini) Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! hope the kick didn't break anything. :-) have a nice weekend regardless! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Lions and tigers and slashes, oh my!
[snip] hope the kick didn't break anything. :-) [/snip] Nah, just having a senior moment. Since it is a query string issue I converted the database (even though it is strictly a web database in this case) to 'Oil Gas'. The query string sees the ampersand and doesn't show anything past that in the condirion. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
I think right you need to check urlencode. You can check a nice example at following php mysql resource site http://www.weberdev.com/get_example-481.html Thanks Richard Correia On 1/13/06, Jay Blanchard [EMAIL PROTECTED] wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Jay, Jay Blanchard wrote: [snip] hope the kick didn't break anything. :-) [/snip] Nah, just having a senior moment. Since it is a query string issue I converted the database (even though it is strictly a web database in this case) to 'Oil Gas'. The query string sees the ampersand and doesn't show anything past that in the condirion. URL encoding the category ought to convert the text to Oil%20%26%20Gas, which ought to work without any problems. Have you tried this? David -- David Grant http://www.grant.org.uk/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Jay Blanchard wrote: [snip] hope the kick didn't break anything. :-) [/snip] Nah, just having a senior moment. Since it is a query string issue I converted the database (even though it is strictly a web database in this case) to 'Oil Gas'. The query string sees the ampersand and doesn't show so the DB is 'correct'. NOw it's just a case or urlencoding the value before sticking it in the URL - that will protect the server from breaking off the query condition/parameter at the point of the '' in 'Oil Gas' and just in case your forced to do the urlencoding of the value on the client side, here is one I stole earlier: // // URLEncode and URLDecode functions // // Copyright Albion Research Ltd. 2002 // http://www.albionresearch.com/ // // The Javascript escape and unescape functions do not correspond // with what browsers actually do... // // You may copy these functions providing that // (a) you leave this copyright notice intact, and // (b) if you use these functions on a publicly accessible // web site you include a credit somewhere on the web site // with a link back to http://www.albionresarch.com/ // // If you find or fix any bugs, please let us know at albionresearch.com // // SpecialThanks to Neelesh Thakur for being the first to // report a bug in URLDecode() - now fixed 2003-02-19. // function URLEncode(plaintext) { if (!plaintext || !plaintext.length) { return plaintext; } var SAFECHARS = 0123456789 + // Numeric ABCDEFGHIJKLMNOPQRSTUVWXYZ + // Alphabetic abcdefghijklmnopqrstuvwxyz + -_.!~*'();// RFC2396 Mark characters var HEX = 0123456789ABCDEF; var encoded = ; for (var i = 0; i plaintext.length; i++ ) { var ch = plaintext.charAt(i); if (ch == ) { encoded += +; // x-www-urlencoded, rather than %20 } else if (SAFECHARS.indexOf(ch) != -1) { encoded += ch; } else { var charCode = ch.charCodeAt(0); if (charCode 255) { /* alert( Unicode Character ' + ch + ' cannot be encoded using standard URL encoding.\n + (URL encoding only supports 8-bit characters.)\n + A space (+) will be substituted. ); */ encoded += +; } else { encoded += %; encoded += HEX.charAt((charCode 4) 0xF); encoded += HEX.charAt(charCode 0xF); } } } // for return encoded; }; function URLDecode(encoded) { if (!encoded || !encoded.length) { return encoded; } // Replace + with ' ' // Replace %xx with equivalent character // Put [ERROR] in output if %xx is invalid. var HEXCHARS = 0123456789ABCDEFabcdef; var plaintext = ; var i = 0; while (i encoded.length) { var ch = encoded.charAt(i); if (ch == +) { plaintext += ; i++; } else if (ch == %) { if (i (encoded.length-2) HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) { plaintext += unescape(encoded.substr(i,3)); i += 3; } else { /* alert( 'Bad escape combination near ...' + encoded.substr(i) ); */ plaintext += %[ERROR]; i++; } } else { plaintext += ch; i++; } } // while return plaintext; }; anything past that in the condirion. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt
Trying to encrypt then decrypt text with php using mcrypt. The encrypt seems to work but when I decrypt it with a different script I get most of it but some garbage. Using blowfish. So to test. Encrypt.php $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . \n; $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); echo $crypttext. \n; decrypt.php $server = $_SERVER['SERVER_NAME']; $url = 'http://'.$server.'/encrypt.php'; $fh = fopen($url,'r') or die (cant open: $php_errormsg); $new_string=; while (! feof($fh)) { $new_string = $new_string.rtrim(fgets($fh,4096)); } $enc=$newstring; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $enc=$_POST['text']; $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . br; $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttextbr; I get from decrypt Meet me at 11 o'clock behind the monumen3ýÚ·nÃtbr Is it doing some padding or something? When I encrypt/decrypt same script it works fine. Maybe something to do with these? $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); Thanks, Scott Duffy
Re: [PHP] mcrypt
Duffy, Scott E wrote: Trying to encrypt then decrypt text with php using mcrypt. The encrypt seems to work but when I decrypt it with a different script I get most of it but some garbage. Using blowfish. So to test. Encrypt.php $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . \n; $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); echo $crypttext. \n; decrypt.php $server = $_SERVER['SERVER_NAME']; $url = 'http://'.$server.'/encrypt.php'; $fh = fopen($url,'r') or die (cant open: $php_errormsg); $new_string=; while (! feof($fh)) { $new_string = $new_string.rtrim(fgets($fh,4096)); } $enc=$newstring; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $enc=$_POST['text']; $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . br; $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttextbr; I get from decrypt Meet me at 11 o'clock behind the monumen3ýÚ·nÃtbr Is it doing some padding or something? When I encrypt/decrypt same script it works fine. Maybe something to do with these? $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); Thanks, Scott Duffy Look at trim(). And your right it does have to do with using ECB. -- Jason Gerfen The charge that he had insulted Turkey's armed forces was dropped, but he still faces the charge that he insulted Turkishness, lawyers said. ~ BBC News Article -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP for Mac
Go here: http://www.entropy.ch/home/ Download the installer you want and run it. Easy and works great for me. GD is included I believe. Ted zeng On 1/12/06 10:29 PM, Richard Correia [EMAIL PROTECTED] wrote: Hi, I want to install PHP5 on Mac powerbook G4. Can someone please let me know where I can find it and it's related module? I am mainly looking for GD and mingswf module on Mac. Thanks Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Greetings
Stut wrote: Mark wrote: Gabor Hojtsy wrote: Dear Pop Mihai Sergiu, By sending this email you (again) posted to a public mailing list which is archived at multiple places, of which really few are under our control. There would be no point in removing your message from our archives, as it is also posted to an unknown number of other archives around the internet. Also there is no point in attaching a signature below your message which prohibits the review of the contents, as the signature is only read after the message is alread read. It should also be noted that simply saying something is confidential is not enough. The sender has to exercise a level of care to prevent private and confidential information and communications from becoming public. Obviously posting any such information to a fundamentally public forum negates any such expectations. It is like screaming, at the top of your lungs, in a public venue, a secret. You would not have any reasonable expectation of privacy even if you screamed don't tell anyone. Nice analogy. However, his rant does present a real issue. Forcing people to use real email addresses exposes them to SPAM and abuse. I would suggest, if possible and resources permit, that some sort of aliasing/registration system be deployed where every post is may by [EMAIL PROTECTED] and every ABCDEFGH is a registered user who's email address is known. I would have to disagree with this. I've been on lots of 'public' mailing lists for quite a while and this is the first time I've ever seen a complaint of this nature. I really think the OP should have taken more care to read the mailing lists page on php.net before signing up. It clearly states that there are archives and that they are searchable. If privacy was a concern then these archives should have been checked to make sure they obscure email addresses. If there is any issue I think it's that the above mentioned web page does not make it clear that there are lots of archives in addition to those mentioned that php.net does not control. At any rate I don't see any need for php.net to implement a system for anonymising posts - that would be a huge waste of resources as a result of a single complaint out of what is probably many thousands of list members. Well, I'm pretty sure that for every *one* verbal gripe there are hundreds or thousands of unspoken gripes. I was reluctant to post to this news group for the reasons of spam and abuse. I upgraded my spamassasin and went for it. I have a long dead PHP account from when I originally contributed msession to PHP (about 5 or 6 years ago) and I STILL get spam!! I think to say it isn't an issue is a level of denial. I suspect there are many people who just won't post because of the restriction. Anyway, RANT I have long since learned that the PHP group does not like change of any kind except that suggested from within a small group of core people, and despite any reasoned argument will resort to denial, ignorance, and/or ad homonym to refuse or belittle any such suggestion./RANT it is just a suggestion, do with it as you please. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: mcrypt
Doh! Nm. _ From: Duffy, Scott E Sent: Friday, January 13, 2006 11:47 AM To: 'php-general@lists.php.net' Subject: mcrypt Trying to encrypt then decrypt text with php using mcrypt. The encrypt seems to work but when I decrypt it with a different script I get most of it but some garbage. Using blowfish. So to test. Encrypt.php $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . \n; $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); echo $crypttext. \n; decrypt.php $server = $_SERVER['SERVER_NAME']; $url = 'http://'.$server.'/encrypt.php'; $fh = fopen($url,'r') or die (cant open: $php_errormsg); $new_string=; while (! feof($fh)) { $new_string = $new_string.rtrim(fgets($fh,4096)); } $enc=$newstring; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $enc=$_POST['text']; $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . br; $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttextbr; I get from decrypt Meet me at 11 o'clock behind the monumen3ýÚ·n_Ãtbr Is it doing some padding or something? When I encrypt/decrypt same script it works fine. Maybe something to do with these? $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); Thanks, Scott Duffy
Re: [PHP] ftp_nlist problem
When you do FTP its actually two TCP connections, a outgoing to port 21, and then a incoming. The most common problem with FTP is that the incoming connection gets blocked by a firewall or NAT. So most people use passive FTP where instead it makes two outgoing TCP connections. I think the directory listings are sent over this 2nd connection, so I would suggest your problem is that the incoming data connection is being blocked by a firewall on your server. Try to either use passive FTP or to change your firewall rules. Andrew - Original Message - From: Giulio [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, January 13, 2006 3:43 PM Subject: [PHP] ftp_nlist problem I have a script using some ftp functions that runs just fine on various server I have tested. Now that I've installed it om a customer's server, it ( obviously ) stopped working. claning the script to isolate the problem, I've discovered that the problem is on the ftp_nlist command that freezes the script execution for a lot ( and the machine too, like doing an heavy work ) and then returns an error ( false ). ftp_rawlist has the same problems. all the previous operations ( connect, login and chdir ) work without problems. any idea on where could I check for a solution? thank you, Giulio Cantoberon Multimedia srl http://www.cantoberon.it Tel. 06 39737052 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a large file
I have large log files from a web server (about a gig in size) and need to parse each line looking for a string, and when encountered push that line to a new file. I was thinking I could have PHP read in the whole file, but thinking it could be a major pain since I have about 20 log files to read through. Anyone have some suggestions? Thanks, Robert I'm actually in the process of doing the exact same thing! If you search on the list you'll see some of my emails. But to help you out here's what I've got so far. :) Since you are dealing with such huge files you'll want to read them a little at a time as to not to use too much system memory all at once. The fgets() reads a file line by line. So you read a few lines and then process those lines and then move on. :) Hope this helps get you started! // open log file for reading if (!$fhandle = fopen($path.$log_file_name, r)) { echo couldn't open $file_name for writing!; die; } $i = 0; $buf = ; while (!feof($fhandle)) { $buf[] = fgets($fhandle); if ($i++ % 10 == 0) { // process buff here do all the regex and what not // and get the line for // the new text file to be loaded into the database // haven't written this yet // write to a file in the directory this runs in. // this file will be used to load data into a mysql // database to run queries on. // empty buff out to remove it from system memory unset($buf); } } fclose($fhandle); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
On Fri, January 13, 2006 10:55 am, Jay Blanchard wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. Don't. The DATA to be stored in the database is 'Oil Gas' When it's time to present it in a browser, and ONLY when it's time to present it in a browser, use: htmlentities('Oil Gas') to make it suitable for HTML transport to the browser. Here's why: Suppose tomorrow you decide to do an RSS Feed, or export to another database, or send that data somewhere OTHER than your browser. Your amp; is *NOT* the raw data, and it's *NOT* what that other technology might *want* for the encoding of That other technology might not even WANT encoded in the first place. Now, RSS might want - amp; for its encoding But can you guarantee that tomorrow's technology will want that? No. Maybe tomorrow's next big thing will want - or perhaps it will want - %#26 or maybe it will want - 'fnord-26' or maybe it won't even need encoded, but it will need the character sequence 'fnord' encoded. The DATA is 'Oil Gas' 'Oil amp; Gas' is merely a presentation / encoding of that data for one (or more) particular (currently popular) transport mechanisms. Encoding the data for today's usage in your orginal source data is sheer folly, of the same magnitude that gave us Y2K. You're making trouble for yourself long-term, and probably confusing yourself short-term. RAW data goes in your database: 'Oil Gas' When the category is clicked the query string shows just an ampersand, i.e. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. Shows where? Until you tell us what showed you where, we can't even begin to guess what is going on -- because WHERE you saw it changes everything. There are all manner of potential sources of your vision here. What you see in the browser, and what you see in View Source and what you see when your mouse goes over a link are all different, and probably all different from what you would see in the 'mysql' monitor program. If View Source showed you that, then it's probably a problem. If you saw it printed out to your browser, it may or may not be a problem. If it's in the ToolTip from mouse-over of the link, it's may or may not be a problem. The browsers try to hide icky details from normal users, and that means the the amp; will often get converted before you see it. The fact that the link doesn't work means that it obviously *IS* a problem, of course, so exactly where you saw it is somewhat moot, since you shouldn't have put amp; in your database, and after you fix that, the solution will probably entail fixing whatever is causing the amp; to get lost anyway. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Ah. An even MORE important reason for not doing what you did. Part of your PROBLEM is you've put amp; in the database instead of So you think it's escaped already. Well, it is... For HTML display, it is escaped. It is *NOT* escaped for a URL. urlencode() is for URL-escaping. htmlentities() is for HTML-escaping. You've done htmlentities() on your data, not urlencode() on your output of your data. What *SHOULD* be done is this: 1. Get the original, un-corrupted (un-escaped) data: 'Oil Gas' $value = 'Oil Gas'; // from db. Note lack of amp; here! Your database has no business [*] keeping the HTML-encoding of its data internally. 2. Since that datum is being passed as an argument in a URL, urlencode() it: $value_url = urlencode($value); //prepare for use in URL $value_url will now most likely contain %26, and the whole - amp; problem will be MOOT. But you never know for sure WHAT data will be in there, so... 3. Make the URL: $url = Filter= . urlencode('Process') . FilterKey=$value_urlOrder= . urlencode('Application') . order= . urlencode('ASC'); NOTE: Just to be pedantic, and to drive the point home, I've urlencode()d every other data element in the URL, even though the output of urlencode() in all these cases *happens*, by sheer luck, to be the same as the input, so you don't need to encode the data. I am as guilty as the next guy of taking shortcuts and not URLencode()ing anything that is 'hard-wired' in PHP source. But if it's coming from your database, or worse, the user, you'd damn well better urlencode() each value element you are putting into the URL. 4. *NOW* you are about to dump that URL into your HTML as the HREF= of a link. At *THAT* point, and *ONLY* at that point, you want to escape it for HTML usage: $url_html = htmlentities($url); //escape for HTML Your URL now has amp; for each separating the key/value pairs in the GET args. That's what HTML *wants* though. Any 'weird' data, where 'weird' is defined by what HTML likes, after
Re: [PHP] mysqli bind_param and store_result don't work well together
On 1/5/06, Curt Zirzow [EMAIL PROTECTED] wrote: On Wed, Jan 04, 2006 at 12:31:02AM +0530, anirudh dutt wrote: hi the subject is pretty much what the problem is. if i use $st1 = $sql-stmt_init(); // $sql is a mysqli obj/conn $st1-prepare(select `num` from `activity` where `id` = ?); $st1-bind_param('s', $myid); $myid = '3f6d017d3e728b057bcc082a7db75a57'; // forcing value to check ... gives rows: 0, num: 0 ... also, if i use an sql var in the prepare/bind case as $st1-prepare(select @ck_num:=`num` from `activity` where `id` = ?); var_dump($rz) is NULL; otherwise it's int(7) What version of php and mysql do you have? Curt. php 5.0.3 mysql 4.1.14-nt Apache/2.0.50 (Win32) anirudh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Lions and tigers and slashes, oh my!
[snip] [/snip] Well said Richard, well said. That is ultimately what I went and did. I am just operating on too little sleep right now, and a couple of times today the simplest things eluded me. I made sure that all of the amp;'s were change to in the database (one I inherited, not an excuse, just a point). I have decided that I am going to walk out of this beast in just a few minutes, go srink a couple of brews with da' boys, get some food, and hopefullt stay up long enough to catch battlestar Gallactica. If I don't make it that far the TIVO will catch it. I may even leave my laptop locked up all weekend. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: preg_replace - I don't have a clue
Is this the wrong forum for this question - or does no-one else have a clue about this either? At 09:43 AM 1/12/06, Frank Bax wrote: As I understand the docs for preg_replace(), I can enclose an PCRE expression in parenthesis and use a backreference in the replace string; but it's not working! Data coming from another system contains a lot of data in one text record which I must parse. Individual elements in the record are separated by $. I want to fix elements that contain dollar-alpha-space-space-digits-dollar and replace the second space (between word and number) with a plus character to end up with dollar-alpha-space-plus-digits-dollar An example of input string: $prop = '$Fencing 11$Lumber 17$Weight: 317 Stones$Energy Resist 2%$'; Notice that Fencing and Lumber have two spaces. I want to end up with: $prop = '$Fencing +11$Lumber +17$Weight: 317 Stones$Energy Resist 2%$'; Notice that original and final strings are the same length. preg_replace( ' (\d+\$)', '+$1', $prop ); /* results in dollar-alpha-space-space-plus, why have digits-dollar have disappeared? */ $Fencing +Lumber +Weight: 317 Stones$Energy Resist 2%$ Although the docs say that $0 should backreference the whole pattern, instead it seems to match the pattern in parenthesis, but this code : preg_replace( ' (\d+\$)', '+$0', $prop ); /* results in dollar-alpha-space-space-plus-digits-dollar */ $Fencing +11$Lumber +17$Weight: 317 Stones$Energy Resist 2%$ Still contains the two blanks!! In neither of my test cases is the result string the same length as original. I'm running PHP 4.4.0 on OpenBSD 3.7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace - I don't have a clue
On 1/12/06, Frank Bax [EMAIL PROTECTED] wrote: reg_replace( ' (\d+\$)', '+$0', $prop ); /* results in dollar-alpha-space-space-plus-digits-dollar */ $Fencing +11$Lumber +17$Weight: 317 Stones$Energy Resist 2%$ Try: preg_replace( '/ (\d+\$)/', '+$1', $prop ); -- Anthony Best
RE: [PHP] Parsing a large file
On Fri, January 13, 2006 8:37 am, Albert wrote: Wolf wrote: I have large log files from a web server (about a gig in size) and need to parse each line looking for a string, and when encountered push that line to a new file. I was thinking I could have PHP read in the whole file, but thinking it could be a major pain since I have about 20 log files to read through. Anyone have some suggestions? Is this on a Linux server? Why dont you use grep? cat filename | grep string newfile If you DO use grep, don't cat the whole file out to grep it... grep __filename__ __newfile__ cat on a 1 GIG file is probably a bit wasteful, I suspect... -- 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] Parsing a large file
On Fri, January 13, 2006 3:33 pm, Jay Paulson wrote: $buf = ; Probably better to initialize it to an empty array();... while (!feof($fhandle)) { $buf[] = fgets($fhandle); ... since you are going to initialize it to an array here anyway. if ($i++ % 10 == 0) { Buffering 10 lines of text in PHP is probably not going to make a significant difference... You'll have to test on your hardware to confirm, but between: 1. Low-level disk IDE buffer 2. Operating System disk cache buffers 3. C code of PHP source disk cache buffers your PHP 10-line buffer in an array is probably more overhead, and much more complicted code to maintain, with no significant benefit. -- 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] preg_replace - I don't have a clue
At 05:15 PM 1/13/06, Anthony Best wrote: On 1/12/06, Frank Bax [EMAIL PROTECTED] wrote: reg_replace( ' (\d+\$)', '+$0', $prop ); /* results in dollar-alpha-space-space-plus-digits-dollar */ $Fencing +11$Lumber +17$Weight: 317 Stones$Energy Resist 2%$ Try: preg_replace( '/ (\d+\$)/', '+$1', $prop ); Thanks!! That did it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Greetings
On Fri, January 13, 2006 10:32 am, Stut wrote: However, his rant does present a real issue. Forcing people to use real email addresses exposes them to SPAM and abuse. I would suggest, if possible and resources permit, that some sort of aliasing/registration system be deployed where every post is may by [EMAIL PROTECTED] and every ABCDEFGH is a registered user who's email address is known. I would have to disagree with this. I've been on lots of 'public' mailing lists for quite a while and this is the first time I've ever seen a complaint of this nature. I really think the OP should have taken more care to read the mailing lists page on php.net before signing up. It clearly states that there are archives and that they are searchable. If privacy was a concern then these archives should have been checked to make sure they obscure email addresses. I think the anon-XXX solution presented is far too complex / overhead. The problem, however, is real. At last count, over a year ago, pre-spam-filter, I'm getting 10,000 emails PER DAY. ~9,900 of them are spam. I daresay somebody like Rasmus gets WAY more than that, though he may never have bothered to check the pre-spam-filter number :-) I am confident that all the PHP net archives listing my email about 50,000 times are a source of a not insignificant portion of these. And this is certainly not the first time this issue has come up, not even the first on this list, much less on all the lists I'm on. Would it really be that hard for the PHP team to push archivists to use PHP to obfuscate email addresses? Something as simple as: $html = str_replace('@', '#64;', $html); should not be too onerous to request of archivists. Last I checked, the spammers had enough harvest yield from un-obfustcated email addresses that even THAT admittedly simplistic stupid obfuscation was, in reality, effective. [Google for, errrm, Netscape email obfuscation trials or similar and you'll find the study, probably] Obviously, not EVERY archive is going to get obfuscated overnight. Obviously, the PHP Team cannot be held responsible for irresponsible archivists. Obviously, the savvy user will subscribe with a throw-away address or have significant filtering in-place with the address they subscribe with. But, really, do you want to side with the spammer or the victim? Just how tricky would it be to publish an archivists' Standard that recommends, perhaps even requires someday, a reasonable attempt at email obfuscation given current technology? This is not about privacy per se -- It's about reducing the sheer amount of automated CRAP flooding our networks / Inboxes. If some random real person out there gets my email and sends me something, and I objected on the grounds of privacy, that would be silly. But I don't think it's unreasonable to complain, and I hereby add my voice to that complaint, that the PHP archives *ARE* being harvested by spammers, and simple effective solutions are available, yet are not implemented, and probably should be, to the degree that readers of this post are capable of influencing such decisions. If you are a PHP mailing list archivist, *PLEASE* obfuscate my email address! Thank you. PS 100% agree the legalese sig is ridiculous. That's probably not his fault, anyway. -- 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] Parsing a large file
On Fri, January 13, 2006 3:33 pm, Jay Paulson wrote: $buf = ; Probably better to initialize it to an empty array();... Yep right. while (!feof($fhandle)) { $buf[] = fgets($fhandle); ... since you are going to initialize it to an array here anyway. if ($i++ % 10 == 0) { Buffering 10 lines of text in PHP is probably not going to make a significant difference... This is true. It's what I have written to start with. Basically I'm just trying to make sure that I'm not hogging system memory with a huge file b/c there are other apps running at the same time that need system resources as well. That's the main reason why I'm using a buffer to read the file in and parse it a little at a time. By all means test it out on your hardware and see what that buffer needs to be. You'll have to test on your hardware to confirm, but between: 1. Low-level disk IDE buffer 2. Operating System disk cache buffers 3. C code of PHP source disk cache buffers your PHP 10-line buffer in an array is probably more overhead, and much more complicted code to maintain, with no significant benefit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I have stange problem
On Thu, January 12, 2006 5:55 pm, sufinoon wrote: I'm trying to install winxp\apache2\php5.1.2\MySql. The installation was good i have apache recognized php ( Apache/2.0.55 (Win32) PHP/5.1.2 Server at localhost Port 8080 ) so i wrote test script (? phpinfo();?) and sometimes the script is working and i got the data and some time i got Cannot find server or DNS Error or 404 error can you tell me what is wrong? The most likely culprit is PROBABLY not PHP. Take PHP out of the equation, and surf to a static HTML page -- Making *SURE* that PHP is not configured to parse all HTML pages. This (static HTML == NO PHP) is the default install, but not the way may users configure PHP, so double-check. Perhaps even go so far as to temporarily dis-able the LoadModule/AddModule of PHP in httpd.conf... Be sure to RE-START APACHE after changes to httpd.conf or php.ini, or the changes will NOT take effect. To be 100% certain PHP is not in, use a file named, say, phpinfo.htm and put ?php phpinfo();? in it. If you see all the PHP output with blue/white tables, then you're still using PHP. If you see nothing but View Source shows: ?php phpinfo();? then you are not using PHP, and can safely test non-PHP problems. Whew. Now, with no PHP, Hit re-load a lot, really fast. Do you get the same error? If so, PHP can't really be the culprit, almost for sure. [Though with Windows, you never know for certain... :-)] If it *IS* PHP, and only happens with PHP, I'd suspect that... 1) PHP is not exiting cleanly, so is tying up your Apache threads / processes, so after MaxChildren page-loads in a short period of time, there are no HTTP processes left to process your request. This is my #1 first guess. 2) PHP is somehow messing up Apache in random weird ways. This is harder to imagine how, but would PROBABLY be tied to some not-so-common DLL you have enabled in php.ini Take out the various extensions and re-start Apache and re-test to eliminate extension DLLs. 3) Something else. This falls into the category of VooDoo Debugging and you're on your own... :-^ -- 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] most reliable way to test if using https
What is the most reliable way to test if a connection is already using the https protocol, is their a PHP constant or something builtin already? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] most reliable way to test if using https
if( !preg_match(/HTTPS/, $_SERVER['SERVER_PROTOCOL']) ){ } That's what I have been using. HTH -- Ray Hauge Programmer/Systems Administrator American Student Loan Services http://www.americanstudentloan.com 1.800.575.1099 On Friday 13 January 2006 04:05 pm, James Benson wrote: What is the most reliable way to test if a connection is already using the https protocol, is their a PHP constant or something builtin already? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about compositing objects
On Thu, January 12, 2006 4:13 pm, jonathan wrote: I have a class which creates another class within it such as: class Loc{ public function outputInfo() { $map=new Map(); $map-setKey(); } } In my main page can I access the $map object like this: $loc=new Loc(); $loc-map-publicMapFunction(); I thought I would be able to but it doesn't seem like it. As others have noted, you probably want to initialize $loc-map to $map inside the function. However, you should also consider what happens if... ?php //Assume classes are defined, but NOTHING else. $loc = new Loc(); $loc-map-publicMapFunction(); ? At this point, $loc-map has *** NO VALUE *** because you didn't call outputInfo() yet. So you will get a NOTICE (if you have E_ALL cranked up, as you should, though it's not the default) and then an ERROR about calling a member function on a non-object, and your whole project/script/page comes crashing down around your ears. You should *PROBABLY* design your code in such a way that this can NEVER happen. If this is a throw-away one-day hack, then ignore me. If this code is expected to live longer than a week, pay attention :-) One solution is to initialize the -map in the constructor, so that if you get a valid Loc object, you have a valid map object. /* PHP4 */ class Loc(){ var $map = null; function Loc(){ $this-map = new Map(); } } /* PHP5 */ class Loc(){ var $map = null; function __construct(){ $this-map = new Map(); } } /* Portable? for both 45 ??? */ class Loc(){ var $map = null; function init(){ $this-map = new Map(); } function Loc(){ $this-init();} function __construct(){ $this-init();} } Disclaimer: I never use objects at all in PHP, so am not 100% certain of this last example... If you simply cannot make a valid Map() object in the constructor, because there are other complex dependencies that cannot be resolved, you should probably make the $loc-map attribute a PRIVATE variable, and create a map() function to read that, so that you have to do: $map = $loc-map(); $map-privateMapFunction(); The reason for the extra layer of the function is that you can include error-checking in the Loc::map() function to: 1) Error out if $loc-map is NULL/invalid 2) Automagically create a Map() if $loc-map is NULL/invalid 3) Control the number of Map objects created, so you only have *ONE* per Loc, and don't waste RAM by endlessly re-creating Map objects . . . The Loc::map() function will create a check-point for you to write gate-keeper code to ensure that everything is kosher to to provide a more robust body of code. The down-side is, more code to maintain and an additional layer of complexity for the end user. So, if you CAN make a Map() in the Loc constructor, that's easier/simpler. If not, a public Map function for a private attribute is clean. Just tossing Map objects into the map attribute willy-nilly is fine for quickie hacks, but little else. The fact that there is a *TON* of badly-written code out there, all over the 'net, and in steady heavy use today, that does exactly what I'm telling you not to do, does not invalidate this post. :-) -- 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] Parsing a large file
On Fri, January 13, 2006 4:47 pm, Jay Paulson wrote: Buffering 10 lines of text in PHP is probably not going to make a significant difference... This is true. It's what I have written to start with. Basically I'm just trying to make sure that I'm not hogging system memory with a huge file b/c there are other apps running at the same time that need system resources as well. That's the main reason why I'm using a buffer to read the file in and parse it a little at a time. By all means test it out on your hardware and see what that buffer needs to be. I'm not saying not to read it a little at a time. I'm saying 1 line at a time, using the most natural code, is PROBABLY at least as fast as, if not faster than, the 10-line buffer version posted. And the 1-line buffer of PHP fgets() is far easier to maintain. So unless you've got test data to prove the 10-line buffer helps, throw it out, and just use fgets() 1-line buffer. :-) -- 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] Help for ISPs rolling out PHP
On Thu, January 12, 2006 1:51 pm, Ben Rockwood wrote: I'm working with a medium sized ISP to start rolling out PHP and MySQL services to customers. I've been looking around for best practices or help with such a roll out but not found anything. I'm confident I can roll out the services but with so many other ISPs currently running PHP it seems like I could save my self a lot of mistakes and grief if I could learn from admins that have already done it. Is anyone aware of a resource specifically about rolling out PHP to a large number of users in an ISP setting? Specifically dealing with security issues like a user doing an unlink(../otheruser/index.html); ? Any pointers and experience are appreciated. Thank You. While not directly addressing your question... I think you'd be remiss if you haven't perused: http://phpsec.org/ You'll have to infer and connect the dots a bit to make that immediately applicable to your needs, and that may take some time, but it will probably save you a lot in the long run. -- 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] input validation?
input type=text maxlength=300 I think the attribute is called maxlength but i'm not sure, oh well add the maxlength attribute to your input tag to have a quick, clean non-javascript-realiant solution On 1/12/06, John Meyer [EMAIL PROTECTED] wrote: Stut wrote: Ok, you're clearly missing my point and while I don't want this to degrade into the usual pissing contest I do feel I need to clarify what I was saying. I completely agree that in this case Javascript should be used to provide the user with feedback as to how close to the limit they are. However, in your post you described the solution as either Javascript *or* PHP when the best solution is both. What I was pointing out is that while Javascript is a better solution from a usability point of view, not doing the validation with PHP is dangerous regardless of whether the length is validated using Javascript or not. I certainly don't believe that PHP is the total solution for most situations, but when it comes to input validation you *need* to do validation on the server-side regardless of what validation you do with Javascript since you have no control over whether the Javascript gets executed. This sounds almost like the old DB vs. Application logic debate I see on several mailing lists; whether you should store more logic in the DB Server through triggers or through application logic. My point on this is that it boils down to how important that data is. If it's somebody's comments on their blog or on a post, I'd just leave it on the application _or_ trim it down to the 300 characters and input it in. bank transactions, I'd have so many triggers going it would be unreal. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!
Re: [PHP] most reliable way to test if using https
James Benson wrote: What is the most reliable way to test if a connection is already using the https protocol, is their a PHP constant or something builtin already? Thanks, James Something like? if (isset($_SERVER[HTTPS]) 'on' == $_SERVER[HTTPS]) {// ssl } else { // non-ssl } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli bind_param and store_result don't work well together
On Sat, Jan 14, 2006 at 03:18:55AM +0530, anirudh dutt wrote: On 1/5/06, Curt Zirzow [EMAIL PROTECTED] wrote: On Wed, Jan 04, 2006 at 12:31:02AM +0530, anirudh dutt wrote: hi the subject is pretty much what the problem is. if i use $st1 = $sql-stmt_init(); // $sql is a mysqli obj/conn $st1-prepare(select `num` from `activity` where `id` = ?); $st1-bind_param('s', $myid); $myid = '3f6d017d3e728b057bcc082a7db75a57'; // forcing value to check ... gives rows: 0, num: 0 ... also, if i use an sql var in the prepare/bind case as $st1-prepare(select @ck_num:=`num` from `activity` where `id` = ?); var_dump($rz) is NULL; otherwise it's int(7) What version of php and mysql do you have? Curt. php 5.0.3 I would take in consideration that: - 5.0.3 was realease prior to March 31, 2005 - 5.0.4 was realease on March 31, 2005 - 5.0.5 was released on Sep 06, 2005. - 5.1.0 was release on Nov, 24, 2005 - 5.1.1 was release on Nov, 28, 2005 - 5.1.2 was release on Jan 12, 2006 And considering that any new release of any new version is prone to serveral bugs; toward a more stable system as time passes. The version you have is almost a year old. Not to mention the stable releases are being issued on 5.1.x now. wow, with that timetable, i just have to say.. happy new year to everyone!! time goes by so fast. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] most reliable way to test if using https
On Fri, Jan 13, 2006 at 04:12:08PM -0700, Ray Hauge wrote: if( !preg_match(/HTTPS/, $_SERVER['SERVER_PROTOCOL']) ){ } That's what I have been using. Thats odd cause all my servers report this as SERVER_PROTOCOL via https: $_SERVER[SERVER_PROTOCOL] == HTTP/1.1 Thats odd cause all my servers report this as SERVER_PROTOCOL via http: $_SERVER[SERVER_PROTOCOL] == HTTP/1.1 Protocol doesn't have to do with how it is being transferred. The protocol is based on the request being givin: GET / HTTP/1.1 Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] most reliable way to test if using https
On Sat, Jan 14, 2006 at 04:20:27AM +, Matt wrote: James Benson wrote: What is the most reliable way to test if a connection is already using the https protocol, is their a PHP constant or something builtin already? Thanks, James Something like? if (isset($_SERVER[HTTPS]) 'on' == $_SERVER[HTTPS]) {// ssl } else { // non-ssl } To be safe about this is to ensure that the var HTTPS is compare in a caseless manner like: 'on' == strtolower($_SERVER[HTTPS]) Most webservers report it in lower case but some say 'On' Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lions and tigers and slashes, oh my!
Bear (pun intened) with me on this one i havn't read the whole thread, so you may get a repeat answer. On Fri, Jan 13, 2006 at 10:55:00AM -0600, Jay Blanchard wrote: I am having a problem with a an ampersand sign. I have a list of things on a page, in which one category is 'Oil Gas'. I store it in the database as 'Oil amp; Gas'. When the category is clicked the query string shows just an ampersand, i.e. The database should really hold text/plain, not text/html. If you take the string 'Oil amp; Gas' out side of the context of html that amp; is a rather strange sequence of characters. Filter=ProcessFilterKey=Oil%20%20GasOrder=ApplicationDirection=ASCcomm ents= and therefore just shows as an '' and the query only sees 'Oil'. You forgot to urlencode() each value that is passed. And say you did urlencode the data you would have: Filter=ProcessFilterKey=Oil+%26+Gas Now the $_GET['FilterKey'] is 'Oil Gas' If you do a search on the db for this value with something like: $cat = mysql_real_escape_string($_GET['FilterKey']); $sql = select * from table where cat = '$cat'; You will come back with 0 results since you really have in that cat field 'Oil amp; Gas'. I guess that I am too tired to deal with this or the answer would come to mind immediately. Can someone drop kick me in the right direction? Thanks! Remember: characters only have meaning in the context they are used If I want to use 'Oil Gas' in: html: i need to html_entity_docode()/htmlentities() it sql: i need to ensure it is escaped *_escape_string(); url: i need to urlencode() it. plain/text: just an echo/print store on a main frame: ASCII2EBCDIC() it Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a large file
On Fri, Jan 13, 2006 at 04:21:10PM -0600, Richard Lynch wrote: If you DO use grep, don't cat the whole file out to grep it... grep __filename__ __newfile__ oops, forgot the expression :) grep findthis __filename__ __newfile__ -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing a large file
On Fri, Jan 13, 2006 at 04:47:11PM -0600, Jay Paulson wrote: On Fri, January 13, 2006 3:33 pm, Jay Paulson wrote: $buf = ; Probably better to initialize it to an empty array();... Yep right. while (!feof($fhandle)) { $buf[] = fgets($fhandle); ... since you are going to initialize it to an array here anyway. if ($i++ % 10 == 0) { Buffering 10 lines of text in PHP is probably not going to make a significant difference... This is true. It's what I have written to start with. Basically I'm just trying to make sure that I'm not hogging system memory with a huge file b/c there are other apps running at the same time that need system resources as well. That's the main reason why I'm using a buffer to read the file in and parse it a little at a time. By all means test it out on your hardware and see what that buffer needs to be. I'd tend to go with Richard's suggestion. You say you are worried about resources and memory? well when you load those 10 lines of code where do they go? memory. if resource and memory is an issue, there are a couple of options i would suggest, being that the bottleneck is really disk I/O and cpu usage. 1) inside the loop (while reading one line at a time) do a usleep(), this will prevent heavy disk access and let the cpu catchup with processing 2) 'nice' the application. run php under nice and give its cpu usage a lower priority of cpu processing time. If you want to test how usleep and the 'nice' thing works here are some sample scripts to benchmark with: // cpu usage try with and without nice while (1) {} vs. while(1) { usleep(500); } //diskio, try with and without nice $fp = fopen('/var/log/messages', 'r') or die('boo'); while(1) { $line = fgets($fp); fseek($fp, 0, SEEK_SET); } vs. $fp = fopen('/var/log/messages', 'r') or die('boo'); while(1) { $line = fgets($fp); fseek($fp, 0, SEEK_SET); usleep(500); } Like Richard said, there are much easier ways to make the app less resource intensive instead of trying to battle io between memory and cpu, within php. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php