Re: [PHP] anaylyze email
Depending on your mail server, you could possibly get your mail server to run a php script on an incoming email. Clive Yui Hiroaki wrote: Thank you for your response. I try to write a code. I actualy want to do; 1) some body send email to me; for example; to [EMAIL PROTECTED] from [EMAIL PROTECTED] 2)read it's email 3)return to [EMAIL PROTECTED] so I can not do this 2) I try to read pop3. I can not find any example! Regards, Yui -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
Hi - What Al said, but you want to use the url_encode/url_decode functions in php Clive Churchill, Craig wrote: Hello, One of the values I'm passing in a URL string contains multiple spaces. a href=browse.php?DarScientificName=Argononemertes australiensis.../a (The multiple spaces are between Argononemertes and australiensis) However when I retrieve the value using $_GET[DarScientificName] there is only a single space between the two names which I understand is the intended behaviour? Is there a way to preserve the multiple spaces? Thanks Craig. Craig Churchill Collection Systems Specialist Museum Victoria GPO Box 666 Melbourne VIC 3001 Australia Telephone +61 3 8341 7743 Email [EMAIL PROTECTED] museumvictoria.com.au This e-mail is solely for the named addressee and may be confidential.You should only read, disclose, transmit, copy, distribute, act in relianceon or commercialise the contents if you are authorised to do so. If you are not the intended recipient of this e-mail, please notify [EMAIL PROTECTED] by e-mail immediately, or notify the sender and then destroy any copy of this message. Views expressed in this e-mailare those of the individual sender, except where specifically stated to be those of an officer of Museum Victoria. Museum Victoria does not represent,warrant or guarantee that the integrity of this communication has been maintained nor that it is free from errors, virus or interference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
clive schreef: Hi - What Al said, but you want to use the url_encode/url_decode functions in php you don't need to use url_decode() because php will do that automatically for incoming data - the caveat being situations where double urlencoding is being used (anyone playing with multiple redirection and such will feel what I mean), that is not the situation here e.g.: echo 'a href=browse.php?DarScientificName=', urlencode(Argononemertes australiensis), '.../a'; I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Clive Churchill, Craig wrote: Hello, One of the values I'm passing in a URL string contains multiple spaces. a href=browse.php?DarScientificName=Argononemertes australiensis.../a (The multiple spaces are between Argononemertes and australiensis) However when I retrieve the value using $_GET[DarScientificName] there is only a single space between the two names which I understand is the intended behaviour? Is there a way to preserve the multiple spaces? Thanks Craig. Craig Churchill Collection Systems Specialist Museum Victoria GPO Box 666 Melbourne VIC 3001 Australia Telephone +61 3 8341 7743 Email [EMAIL PROTECTED] museumvictoria.com.au This e-mail is solely for the named addressee and may be confidential.You should only read, disclose, transmit, copy, distribute, act in relianceon or commercialise the contents if you are authorised to do so. If you are not the intended recipient of this e-mail, please notify [EMAIL PROTECTED] by e-mail immediately, or notify the sender and then destroy any copy of this message. Views expressed in this e-mailare those of the individual sender, except where specifically stated to be those of an officer of Museum Victoria. Museum Victoria does not represent,warrant or guarantee that the integrity of this communication has been maintained nor that it is free from errors, virus or interference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XAdES in PHP
Hello there, I am looking for an implementation for XAdES signature in PHP. I found nothing on the net for PHP (perhaps I'm a bad researcher! :-) ), but lot of things for Java Does somebody know a package for XAdES in PHP or it's a good idea to begin a new project? Thanks for your response. -- Pierre PINTARIC SICTIAM Porte 15 Space Antipolis 3 2323, chemin Saint Bernard 06225 Vallauris Tel : 04 92 96 80 83 Fax : 04 92 96 92 96 http://www.sictiam.fr/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
On Mon, 14 Jan 2008 10:17:03 +0100, Jochem Maas wrote: clive schreef: Hi - What Al said, but you want to use the url_encode/url_decode functions in php you don't need to use url_decode() because php will do that automatically for incoming data - the caveat being situations where double urlencoding is being used (anyone playing with multiple redirection and such will feel what I mean), that is not the situation here e.g.: echo 'a href=browse.php?DarScientificName=', urlencode(Argononemertes australiensis), '.../a'; I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? If you urlencode() the whole url you'll end up with '%3F' and '%3D' instead of '?' and '=', and you certainly don't want that[1]. The above is fine, but if you don't know for sure that the parameter name is a safe string, you'll need: $name_url = urlencode ($name); $value_url = urlencode ($value); echo a href=\browse.php?$name_url=$value_url\.../a; Or to generalize[2]... $n1_url = urlencode ($name1); /* and so on... */ $c_html = htmlspecialchars ($content); /* or htmlentities() */ echo a href=\browse.php?, $n1_url=$v1_urlamp;$n2_url=$v2_url\$c_html/a; That is, unless I've totally missed the boat here. :-) See also the examples at: http://se.php.net/manual/en/function.urlencode.php /Nisse [1]: The '?' and '=' (and '') characters have special meaning in the url and must retain that meaning for the url to work, so the charcters must only be escaped inside the name and value parts of the url. [2]: Note also that the '' character must, in addition to any url escapes, be escaped as 'amp;' when used in an HTML attribute. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
thanks, Nisse, for clearing up my half-baked-monday-morning answer. AFAICT (now that I have woken up somewhat) you are indeed correct. Nisse Engström schreef: On Mon, 14 Jan 2008 10:17:03 +0100, Jochem Maas wrote: clive schreef: Hi - What Al said, but you want to use the url_encode/url_decode functions in php you don't need to use url_decode() because php will do that automatically for incoming data - the caveat being situations where double urlencoding is being used (anyone playing with multiple redirection and such will feel what I mean), that is not the situation here e.g.: echo 'a href=browse.php?DarScientificName=', urlencode(Argononemertes australiensis), '.../a'; I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? If you urlencode() the whole url you'll end up with '%3F' and '%3D' instead of '?' and '=', and you certainly don't want that[1]. The above is fine, but if you don't know for sure that the parameter name is a safe string, you'll need: $name_url = urlencode ($name); $value_url = urlencode ($value); echo a href=\browse.php?$name_url=$value_url\.../a; Or to generalize[2]... $n1_url = urlencode ($name1); /* and so on... */ $c_html = htmlspecialchars ($content); /* or htmlentities() */ echo a href=\browse.php?, $n1_url=$v1_urlamp;$n2_url=$v2_url\$c_html/a; That is, unless I've totally missed the boat here. :-) See also the examples at: http://se.php.net/manual/en/function.urlencode.php /Nisse [1]: The '?' and '=' (and '') characters have special meaning in the url and must retain that meaning for the url to work, so the charcters must only be escaped inside the name and value parts of the url. [2]: Note also that the '' character must, in addition to any url escapes, be escaped as 'amp;' when used in an HTML attribute. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Data merging
Eric Butera wrote: On 1/12/08, Naz Gassiep [EMAIL PROTECTED] wrote: I'm using simplexml to fetch data from a set of data files. If I have two files, and one is an update to the other, is there an easy way to merge the two files together, rather than having write logic that checks one and then the other? Both files conform to the same DTD and thus the data in the update will perfectly eclipse the data in the main file. If I can do this it would save me writing a whole bunch of logic. Thanks, - Naz diff! Could I trouble you to elaborate? Or at least point to the RTFM url. - Naz. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Data merging
Naz Gassiep wrote: Eric Butera wrote: On 1/12/08, Naz Gassiep [EMAIL PROTECTED] wrote: I'm using simplexml to fetch data from a set of data files. If I have two files, and one is an update to the other, is there an easy way to merge the two files together, rather than having write logic that checks one and then the other? Both files conform to the same DTD and thus the data in the update will perfectly eclipse the data in the main file. If I can do this it would save me writing a whole bunch of logic. Thanks, - Naz diff! Could I trouble you to elaborate? Or at least point to the RTFM url. - Naz. once you have the data from simplexml, use http://us3.php.net/array_diff to get the differences between the two data sets. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to override status code in certain installations..?
Well, just for the sake of anybody in my situation finding this thread in the future -- the workaround is to use this: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ /redirectTest2/verify.php?page=$1%{QUERY_STRING} [L] instead of ErrorDocument 404 /redirectTest2/verify.php It seems to perform the same job, but because it's just mod_rewrite, it won't show up as a 404 whatsoever, which means that even on servers that refuse to let PHP's headers override Apache's error code, you're able to send whatever status header you want. RavenWorks wrote: It's the exact same situation as this bug: http://bugs.php.net/bug.php?id=24177 except, that bug was fixed back in PHP 4... In my case, the server that works is running PHP 5.2.2, and the server that DOESN'T work is running PHP 5.2.3! So either it's a bug that cropped up (again) after 5.2.2, or there's another factor here.. (For instance, the server on which it doesn't work is running Apache 1.3.37, and the server that handles it correctly is running Apache 2.2.4.) At least knowing that it's (likely) a bug, and not an obscure config setting, is something. If no-one else has any other suggestions, I guess I'll submit a bug report? Richard Lynch wrote: On Wed, January 9, 2008 4:35 pm, RavenWorks wrote: I'm currently trying to create a system where a custom 404 ErrorDocument in PHP is able to 301 Redirect the browser in certain cases. This works fine on some servers, however, on some other servers the PHP script seems to be unable to replace the 404 header. Correctly overrides with '200' status: http://fidelfilms.ca/redirectTest/ Unable to override default '404' status: http://fraticelli.info/redirectTest/ Those two pages will look the same in a browser window, but one returns 404 and one returns 200 (as it should, because of the header() call) -- check with whatever browser plugin you prefer for reading HTTP headers, such as Live HTTP Headers for Firefox. Returning the correct status code is important because we're migrating a site from one domain to another, and we don't want to lose ranking in search engines. (In the examples above, I return 200 as a test, but in practice this will be used to 301 all visitors -- and search engines -- to the new domain.) My question is this: What causes PHP to be able to override the ErrorDocument status on some servers and not others? Is it caused by PHP's behavior or Apache? Is this a configurable option, or was the behavior permanently changed in a given version of either? I think you are falling prey to a PHP bug. You should be able to find it in: http://bugs.php.net You could also check the ChangeLogs: http://php.net/ChangeLog-5.php http://php.net/ChangeLog-4.php I could be wrong, as my memory is rather vague on this one, and it's always possible that you have similar/same symptoms with an entirely different issue. -- View this message in context: http://www.nabble.com/Unable-to-override-status-code-in-certain-installations..--tp14723283p14804970.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php developers wanted
hi list, (sorry for being offtopic) the company I work for (international moving/logistics company) is looking for php developers now, for participating in a quite big project. we have a young and brilliant team, working with us is cool :) at least 3 years of PHP/HTML experience, OOP knowledge, some knowledge of JavaScript and CSS is required, experience with symfony is a plus. the job is preferably located in Budapest/Hungary, but there is a possibility to work in another one of our European offices (mainly eastern Europe like Prague, Bratislava, Zagreb, Warszawa, Bucharest, Moscow) if anybody is interested please contact me off list greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XAdES in PHP
On Mon, January 14, 2008 4:10 am, Pierre Pintaric wrote: I am looking for an implementation for XAdES signature in PHP. I found nothing on the net for PHP (perhaps I'm a bad researcher! :-) ), but lot of things for Java Does somebody know a package for XAdES in PHP or it's a good idea to begin a new project? After a quick Google to find out what the Hades is XAdES, I'd suggest you look for a C implementation and link it in as an extension. You'll probably find a C implementation and link it much faster than re-writing in PHP, and a PECL extension would probably be far more useful for this than raw PHP script. H. Check PECL to be sure nobody's already done it... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
On Sun, January 13, 2008 6:04 pm, Churchill, Craig wrote: One of the values I'm passing in a URL string contains multiple spaces. a href=browse.php?DarScientificName=Argononemertes australiensis.../a (The multiple spaces are between Argononemertes and australiensis) *ALL* data passed by URL to GET should be urlencoded: http://php.net/urlencode urlencode will preserve your data. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
On Mon, January 14, 2008 3:17 am, Jochem Maas wrote: I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Actually, after you urlencode() the values, you should htmlentities the whole URL, as it is being passed to HTML as a value to be output to HTML. The whole URL should *NOT* be URL-encoded, however. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DESC order results
On Sun, January 13, 2008 12:54 pm, Danny Brow wrote: Just wondering if anyone could tell me how reliable the DESC order option is going to be when I am parsing thousands of records where they are multiple ChartNo's for the same clientNo. Or is there a better way to grab the most recent ChartNo. This is not actually a PHP question... Assuming ChartNo is some kind of autoincrement field, it HAPPENS to be 100% reliable in current MySQL implementation. Unfortunately, it's also 100% the *WRONG* way to go about this, as the MySQL dev team could change their implementation of autoincrement at any time, for any reason, and you'd be up the creek without a paddle [*]. If you want the most RECENT chart in time, you should time-stamp every chart with a datetime field, and use that in DESC in your query. You should take this discussion to the MySQL list if you wish to understand why. [*] It has just occured to me that being UP the creek with no paddle isn't much of a big deal, as you can just drift back down. Being DOWN the creek with no paddle, however, would be more problematic. English is such a curious language... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Any way to use header() or another function to force user to top level
On Sat, January 12, 2008 9:42 pm, Chuck wrote: I have some code doing some checks that sit inside div tags using href elements: ... div class=pArea a class=panel href=code.php?= target=pframe1 Panel1/a ... In code.php, if various conditions aren't met, this script will do a bunch of house cleaning, logging, then redirect using header(Location: /some_url). My problem is that /some_url comes up inside the div area, instead of causing the browser to load /some_url as if accessed directly. Im just starting to dabble with PHP so I'm sure there is another way of doing this or maybe an argument to header() itself. I'm looking for the same behavior as the HTML snippet a href=/ target=_tophere/a Once I make the call to header(), I no longer care about any state information, session variables, or anything. Basically I am booting the user out of the application and back to the login/splash page. All information I need to retain has already been logged to various mechanisms prior to calling header() which is immediately followed by exit(); I don't think a DIV tag can do what you want... Perhaps you should do your validation checks in the script that writes the DIV tag instead, and bounce the user from there, which would be trivial. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var_dump() results
On Sun, January 13, 2008 11:32 am, Europus wrote: It's pretty much the same. With var_dump(), values from the first row of the table are iterated twice, the script is not looping through and reporting all 2100 rows. Grossly similar behavior was observed with print_r() and echo: while different data was reported by each, the loop wouldn't loop. The first row was reported once (or twice) and that was the end of that. I've tried foreach() also, same-same. It doesn't loop, it just reports the first row. Here's my code: ?php //connect to db $link = mysql_pconnect('$host', '$login', '$passwd'); '$host' is not right. $host is right. Ditto for ALL your values throughout this script. if (!$link) { die('Unable to connect : ' . mysql_error()); Forget the loop, this should have puked right here, or you aren't posting your actual code... } // make $table the current db $db_selected = mysql_select_db('$table', $link); if (!$db_selected) { die ('Unable to select $table : ' . mysql_error()); } //get column data $sql= SELECT column2, column3 FROM $table; $result = mysql_query($sql); $row = mysql_fetch_row($result); //loop through to display results for($i=0; $i count($row); $i++){ The $row only has TWO columns in it: column2, column3 The $result may have many, many, many rows in it. You can find out HOW many by using: http://php.net/mysql_num_rows -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: anaylyze email
On Sun, January 13, 2008 3:46 pm, Yui Hiroaki wrote: Thank you for your response. I try to write a code. I actualy want to do; 1) some body send email to me; for example; to [EMAIL PROTECTED] from [EMAIL PROTECTED] 2)read it's email 3)return to [EMAIL PROTECTED] so I can not do this 2) I try to read pop3. I can not find any example! PHP's IMAP extension can open/read POP3 email boxes just fine. http://php.net/imap Though you are better off using IMAP in your mailboxes in the first place, usually. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anaylyze email
1) some body send email to me; for example; to [EMAIL PROTECTED] from [EMAIL PROTECTED] 2)read it's email The easiest way to do it is to get the emails deposited into a POP3 email account and then read that, possibly with the Net_POP3 code in PEAR. 3)return to [EMAIL PROTECTED] After reading the email you can do pretty much anything. Have a look at the mail() function. I try to read pop3. I can not find any example! Go to http://pear.php.net and get the Net_POP3 class which will allow you to read the contents of POP3 accounts. -- Richard Heyes http://www.websupportsolutions.co.uk Mailing list management, Knowledge Base and HelpDesk software that can increase sales and cut the cost of online support ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start problems with FireFox on Mac
At 3:50 PM +0100 1/13/08, Jochem Maas wrote: to avoid this in future never add the closing php bracket to the end of the php file (unless you explicitly want to output something after the code in question - which is almost never the case), it is not required. e.g. - 8 info.php ?php phpinfo(); - 8 info.php It may be a religious argument, but I always close my scripts and I know where the white space is. Also, most of my code is used by other languages (i.e., html, js) so a closing bracket is always required -- unless it's the last function in a file, but I haven't checked to see if that works in all cases. So, I just always close it correctly. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] searching in multidimensional array for a date
On Sat, January 12, 2008 12:29 pm, [EMAIL PROTECTED] wrote: Hello to everybody, I am using the following function in order to search in multi-dimensional array, as per note added on http://it.php.net/array_search, [code] function array_search_recursive($data0, $FinRecSet, $a=0, $nodes_temp=array()){ global $nodes_found; $a++; foreach ($FinRecSet as $key1=$value1) { $nodes_temp[$a] = $key1; if (is_array($value1)){ array_search_recursive($data0, $value1, $a, $nodes_temp); } else if ($value1 === $data0){ $nodes_found = $nodes_temp[1]; } } return $nodes_found; } [/code] where $data0 is a date (ex:'1-1-2008') and $FinRecSet is an array containing financial entries like this Array ( = Array ( [Id] = 281 [Date] = 01-01-2008 [FCode] = A01 [Descr] = Prova [Debit] = 100.00 [RunDeb] = 2065300.64 [Credit] = 0.00 [RunCre] = 3020765.67 [RunBal] = -955465.03 [Rec] = 0 ) [1] = Array ( [Id] = 282 [Date] = 01-01-2008 [FCode] = A02 [Descr] = Prova [Debit] = 120.00 [RunDeb] = 2065420.64 [Credit] = 0.00 [RunCre] = 3020765.67 [RunBal] = -955345.03 [Rec] = 0 ) ect when I run function I get exactely the last entry with date = '1-1-2008', problem is when I don't have entries on such date, for that I should modify function in order to get entry on older date available before $data0. For example if $date0 = '1-1-2008' and first entry is available only on '30-12-2007', how should I modify function? You should modify this function by getting rid of it entirely, putting your data in an SQL database, and writing an SQL query to do what you want. Other than that, you're on the right track... :-v -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ldap_bind() issue
On Fri, January 11, 2008 3:54 pm, Greg Donald wrote: On 1/11/08, Richard Lynch [EMAIL PROTECTED] wrote: This strikes me as if you've got a Private/Public key issue where you neglected to generate/install a key-pair... Yeah, the certificate error message makes me think something is not right with my PHP install or how it's talking to the OpenLDAP libs.. but what exactly is the mystery. ldap_bind()'s Error unknown message isn't very helpful. Meanwhile another project of mine, on that same server, uses ruby-ldap and works just fine. Perhaps try less restrictive checks on the keys -- E.g., in cURL, you an set it to not check the peer certificate, so it doesn't die on certs issued by less-known CAs. I have no idea if you can DO that in LDAP, but perhaps it will lead somewhere... You could also try contacting the host and see if they could grep their logs for any info that might be of use to you. So long as you give them a time-stamp and some distinctive data that should be there like your IP, you're only asking somebody to spend a couple minutes to help you out. Even large companies occasionally have humans working for them. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 11 January, 2008: php-general@lists.php.net
On Fri, January 11, 2008 3:00 pm, PostTrack [Dan Brown] wrote: Messages| Bytes | Sender +-+-- 226 (100%) 255776 (100%) EVERYONE 81(0.36%) 43996(0.17%) PostTrack [Dan Brown] [EMAIL PROTECTED] I think you've got an extra divide by 100 in there somewhere, as 81/226 is ~ 36% in most countries. php -a Interactive mode enabled ?php echo 81/226, \n\n;? 0.358407079646 Are you archiving and/or graphing the results somewhere? There used to be similar stats up on php.net and/or zend.com that Stas wrote, as I recall... Is the PostTracker itself included in the stats? Should it be? :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 11 January, 2008: php-general@lists.php.net
On Jan 14, 2008 1:12 PM, Richard Lynch [EMAIL PROTECTED] wrote: I think you've got an extra divide by 100 in there somewhere, as 81/226 is ~ 36% in most countries. php -a Interactive mode enabled Yeah, that was something that I forgot to fix in the blast that the script sent out (due to a problem between the chair and the keyboard). Are you archiving and/or graphing the results somewhere? Archiving, yes. Graphing, no. It could be added without much of a problem though. Is the PostTracker itself included in the stats? Should it be? For that week it was, by flawed design. In the future, the single post per week it makes should be ignored. I hadn't realized that Stas had one (or that PHP had one at all, for that matter). I took the idea from a guy on the IETF mailing list that posts similar data. I thought it was pretty interesting (though that list is far lower in traffic than this). -- /Dan Daniel P. Brown Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since Nineteen-Seventy-[mumble]. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 11 January, 2008: php-general@lists.php.net
On Jan 14, 2008 1:12 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, January 11, 2008 3:00 pm, PostTrack [Dan Brown] wrote: Messages| Bytes | Sender +-+-- 226 (100%) 255776 (100%) EVERYONE 81(0.36%) 43996(0.17%) PostTrack [Dan Brown] [EMAIL PROTECTED] I think you've got an extra divide by 100 in there somewhere, as 81/226 is ~ 36% in most countries. php -a Interactive mode enabled ?php echo 81/226, \n\n;? 0.358407079646 Are you archiving and/or graphing the results somewhere? There used to be similar stats up on php.net and/or zend.com that Stas wrote, as I recall... Is the PostTracker itself included in the stats? Should it be? :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Looks like someone else is trying to win this week after weeks of semi-silence. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var_dump() results
Richard Lynch wrote: $link = mysql_pconnect('$host', '$login', '$passwd'); '$host' is not right. $host is right. Ditto for ALL your values throughout this script. I know. I knew. I knew that variables do not need quotes, that single quoted variables get parsed literally. I edited the email to make those changes, the real values were contained in the actual script. See following (earlier than your reply?) emails. So blindfold me and shoot me for not taking the time to edit that bit of punctuation that was sent to the list, I asked for help on the loop and not help on connecting to the db. Oh, so shoot me for posting too much code, basically. I'm guilty as hell on that. In the actual test I tried after sending that email, probably I left a set of quotes in somewhere, I can't find any reserved word conflicts. Other replies indicate that it should work as intended, so probably I'll try it again. if (!$link) { die('Unable to connect : ' . mysql_error()); Forget the loop, this should have puked right here, or you aren't posting your actual code... It was the actual code, edited for certain authentication data that is already identified elsewhere. phpinfo() says PHP v4.3.11 and MySQL v3.23.32 so why didn't it puke right there and why should it have? Please tell me, I need to learn more about these versions I must deal with too. //get column data $sql= SELECT column2, column3 FROM $table; $result = mysql_query($sql); $row = mysql_fetch_row($result); //loop through to display results for($i=0; $i count($row); $i++){ The $row only has TWO columns in it: column2, column3 Right. And? The $result may have many, many, many rows in it. You can find out HOW many by using: http://php.net/mysql_num_rows This has already been resolved, but I'd like to learn what I can from you re: your earlier comments, above. Aside, does everyone else think you are a butthead or are we off to a bad start? Let's fix that, can we? Ulex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SMTP vs mail()
On Fri, January 11, 2008 2:18 pm, Manuel Lemos wrote: on 01/11/2008 06:03 PM Richard Heyes said the following: If you have your sendmail equivalent program properly configured, no SMTP connection is used when queueing messages using the sendmail program. What about when you take into consideration this program could be sending 1000's of emails, say, 100 per SMTP connection? That is even worse. Keep in mind that the SMTP server of sendmail or equivalent MTA, ends up calling the sendmail program for each individual message that it receives. That would be the most brain-dead SMTP server on the planet... Are you talking Windows or something? :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SMTP vs mail()
On Sat, January 12, 2008 4:28 am, Richard Heyes wrote: Assuming you're talking delivery to a local MTA (which will subsequently do the remote delivery), is speed really important? For the amount of email I'm looking at (1000s, growing), yes. Hmm, that's not quite what I was thinking of. The amount of emails to be delivered does not in my opinion affect how fast it needs to happen. Your local MTA will take a while to deliver those emails anyway, so the time from script to user is mostly dependent on that, which means you're left with reducing the time from script to MTA. If you need to finish the script fast (in order for some user-intercation to continue perhaps), I would would just detach the script and carry on. Sorry, yes the time of delivery is not so important as the time to pump the messages to the MTA. As long as the MTA has them and they get delivered in a reasonable time frame I'm happy. The application is all about mail delivery and the script has to return immediately, so I'll be launching a separate process to insert the addresses into a minimal mail_queue table in my db, and then a 5 minutely cron script which will pass them to the MTA. If there's any way to re-configure the MTA to queue the messages for later sending, that would save you a lot of overhead on the PHP end... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_GET and multiple spaces.
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 2:11 PM To: Jochem Maas Cc: clive; Churchill, Craig; php-general@lists.php.net Subject: Re: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 3:17 am, Jochem Maas wrote: I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Actually, after you urlencode() the values, you should htmlentities the whole URL, as it is being passed to HTML as a value to be output to HTML. The whole URL should *NOT* be URL-encoded, however. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Like this? $url = htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value)); Regards, Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why is some_function()[some_index] invalid syntax?
On Thu, January 10, 2008 10:00 pm, Arlen Christian Mart Cuss wrote: Why is it that if I try to evaluate an index of an array returned by a function immediately, a syntax error is produced? (unexpected '[', expecting ',' or ';') Because PHP is not C. It's language-design was chosen to not let you write complicated expressions that only confuse beginners. There was talk of letting this work on php-internals, but it was shot down, as I recall... Or perhaps not, but nobody actually submitted a patch to make it work, so it's one of those someday features... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /etc/php.init changes not honored
In phpinfo() output, PHP tells you where it is looking for its php.ini file. If you aren't changing a php.ini file in that location, then PHP isn't going to see it... On Thu, January 10, 2008 4:59 pm, Ryan H. Madison wrote: Hello, I am trying to increase upload_max_filesize beyond the 2M limit. I've set this in my /etc/php.ini file, but every time I look at the output of phpinfo(); the changes I make in /etc/php.init don't seem to be honored. This isn't limited to upload_max_filesize, I've changed the Engine safe_mode values, but these don't seem to make any difference either. I've looked in the /etc/php.d directory, and those files only reference other libraries. I've even removed the /etc/php.ini file which doesn't seem to make a difference. What am I missing? -Thanks, RYAN I'm running a default installation of CentOS 5. [EMAIL PROTECTED] etc]$ cat /etc/redhat-release CentOS release 5 (Final) [EMAIL PROTECTED] etc]$ rpm -qa | grep php php-5.1.6-5.el5 php-pdo-5.1.6-5.el5 php-pear-1.4.9-4 php-common-5.1.6-5.el5 php-cli-5.1.6-5.el5 php-mysql-5.1.6-5.el5 [EMAIL PROTECTED] etc]$ rpm -qa | grep httpd httpd-2.2.3-6.el5.centos.1 httpd-manual-2.2.3-6.el5.centos.1 [EMAIL PROTECTED] etc]$ Ryan Madison Senior Systems Administrator, UNIX Services Internet Services and Servers Department of Information Technology State of Nevada p. 775.684.4313 f. 775.684.4324 e. [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] w. http://sug.state.nv.us http://sug.state.nv.us/ P Please consider the environment before printing this email. This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to it is addressed. Any review, dissemination or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-Mail and delete all copies of the original message. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dependant listboxes
On Thu, January 10, 2008 10:43 am, Humani Power wrote: Hi everybody. I have a page with 3 combo box that contains rows from an oracle database. What I want to do, is to make those list dependant one from another. Let say that I have the combo boxes on a page1.php, then on change the first list box, reload the page1.php and make the selection of the second listbox, on change on the second box, the third listbox will be filled. Then, pressing the submit button, I want to go to the page2.php I dont want to use javascript. Does anyone knows where can I find an example to implement the dependant lists? If you are willing to have them push the submit button and get a new page for each listbox, then you have a straight-forward PHP application. If not, then you HAVE to use JavaScript, and PHP is not in the picture at all. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP shell commands
On Thu, January 10, 2008 9:15 pm, Lucas Prado Melo wrote: Some php applications store database passwords into files which can be read by the user www-data. So, a malicious user which can write php scripts could read those passwords. What should I do to prevent users from viewing those passwords? Get a dedicated box and don't have any untrusted users on it. There really is no other solution: If PHP can read the password to use it, then PHP can read the password to use it, and the other user that can run PHP can do that. Actually, somebody COULD set up a shared server with enough un-shared resources, including a different set of HTTP children for each user, and make this work, but it's a lot easier to find an affordable dedicated server host than to dig into the details of every webhost package. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser cache setting
All the browsers cache unless the end user works at it to change that, or you force it to not cache by giving it a different URL each time. Playing games with no-cache headers (et al) will only give you a bug-list of arcane browwses that don't honor those headers. YMMV On Fri, January 11, 2008 4:20 am, Richard Heyes wrote: Hi, What's the default setting for caching in browsers? With IE is it Automatically as I think it is? And what about other browsers? Some equivalent? Thanks. -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Determine which are user defined keys?
On Fri, January 11, 2008 7:12 am, Christoph Boget wrote: Given the following array: ?php $myArr = array( 'joe' = 'bob', 0 = 'briggs', 'whatever', 'whereever'); echo 'pre' . print_r( $myArr, TRUE ) . '/pre'; ? Array ( [joe] = bob [0] = briggs [1] = whatever [2] = whereever ) joe and 0 are keys that I created whereas the key 1 and 2 are keys assigned by PHP when the array was created. When iterating through an array, is there a way to determine which were generated by PHP? I can't rely on whether or not the key is an integer because it's quite possible that such a key was user generated. I've gone through the docs and based on what I've read, I don't think something like this is possible but I'm hoping that's not the case. I doubt that even down in the guts of PHP there's any record of which kind of key it was, so I doubt that you can do that without hacking PHP scource in a big way... WHY would you want to do this anyway? Give us the Big Picture, and maybe you'll get some ideas for another approach. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Closures in PHP
On Thu, January 10, 2008 4:22 am, John Papas wrote: Is there any functionality in PHP similar to closures? Sort of. There is a create_function: http://php.net/create_function Are there any plans to add it..? There was discussion on the php-internals list last week about replacing create_function or, rather, adding a new way to create a closure-like thingie. It would not have the full-blown closure behaviour you may be used to from other languages. And, actually, the implementation that seemed to get the most approbation was a simple way to create a function as a kind of a resource (like a MySQL connection resource) and then you could pass it around and use it. It still didn't have a full-blown closure behaviour, as I recall, of keeping the entire environment at the time of the function defintion. If you want something that esoteric, go use Lisp. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XAdES in PHP
On Mon, 2008-01-14 at 10:59 -0600, Richard Lynch wrote: After a quick Google to find out what the Hades is XAdES, I'd suggest you look for a C implementation and link it in as an extension. There are a couple of implementations of XMLDSIG in PHP that I have seen, although none really up to scratch IMO. You could try one of those (I think there is a pretty decent Python implementation as a starting point) and fix it up and extend that. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var_dump() results
Europus schreef: Richard Lynch wrote: ... Aside, does everyone else think you are a butthead or are we off to a bad start? Let's fix that, can we? there is no 'we' in 'you'. Richard's posted more answers to more posts on this list than you have written line of code in your life ...probably. regardless of that when your the muppet asking the noobie questions, *and* your replies seem to indicate a certain lack of study when it comes to trying to understand the information freely available at php.net (e.g. regarding proper use of mysql_fetch*() functions) then it's probably best to not be calling anyone a butthead. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php developers wanted
Hello, on 01/14/2008 02:16 PM Zoltán Németh said the following: hi list, (sorry for being offtopic) the company I work for (international moving/logistics company) is looking for php developers now, for participating in a quite big project. we have a young and brilliant team, working with us is cool :) at least 3 years of PHP/HTML experience, OOP knowledge, some knowledge of JavaScript and CSS is required, experience with symfony is a plus. the job is preferably located in Budapest/Hungary, but there is a possibility to work in another one of our European offices (mainly eastern Europe like Prague, Bratislava, Zagreb, Warszawa, Bucharest, Moscow) if anybody is interested please contact me off list Here you can find at least one available PHP developer from Hungary: http://www.phpclasses.org/professionals/country/hu/ Here you can find much more from other countries: http://www.phpclasses.org/professionals/ -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DESC order results
Richard Lynch schreef: On Sun, January 13, 2008 12:54 pm, Danny Brow wrote: Just wondering if anyone could tell me how reliable the DESC order option is going to be when I am parsing thousands of records where they are multiple ChartNo's for the same clientNo. Or is there a better way to grab the most recent ChartNo. This is not actually a PHP question... Assuming ChartNo is some kind of autoincrement field, it HAPPENS to be 100% reliable in current MySQL implementation. Unfortunately, it's also 100% the *WRONG* way to go about this, as the MySQL dev team could change their implementation of autoincrement at any time, for any reason, and you'd be up the creek without a paddle [*]. If you want the most RECENT chart in time, you should time-stamp every chart with a datetime field, and use that in DESC in your query. You should take this discussion to the MySQL list if you wish to understand why. [*] It has just occured to me that being UP the creek with no paddle isn't much of a big deal, as you can just drift back down. Being DOWN the creek with no paddle, however, would be more problematic. English is such a curious language... I think it assumes that you want to be down (where shit creek meets fresh water) and, although the flow will take you there, shit flows so slowly that your stuck with a decision of straving to death waiting for the drift or using you hands as paddles ... but indeed curiouser and curiouser it is :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A good book for a perspective programer.
Yes, you are 100% correct David Powers, I did not include enough information to get the advice I was asking for. I really need to learn to ask better questions, so I can get the help I seek... there a book for that lol No really, I would like to take the time to clarify my question as you suggested. I am rather new to php, I'm learning the basics from the php manual, as well as the tutorials at the w3schools web site and whatever I can find online. I am capable of writing w3c valid xhtml and css ducumants. My goals is to become php certified threw the zend program, most importantly I wish to use php as my primary server scripting language to use in all web sites I design, storing and managing data with MySQL and flat files where required. It's my goal to get certified for both php and MySQL. I am in the process of learning web design on my own, that is with use of online tutorials and books as I mentioned. To make this my profession, and have a type of paper declaring that I'm not just a hack ; ). Your books also look very good, I will probably be a future costumer! Thanks, once again! Sean-Michael David Powers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sean-Michael wrote: What I want to ask is if anyone can recommend a good/best text book to learn from, I like to have a good book on hand! It's very difficult to recommend the best book to learn from (although I'm tempted to suggest my own). Different people learn in different ways. Also, people want to use PHP in different ways, not to mention the fact that you don't say what your current skill level is. My advice would be to go to Amazon, and browse the books on PHP. Read the reviews. See which are the best sellers. I have a lot of PHP books on my shelf. The two that are the most well-thumbed as PHP Programming by Rasmus Lerdorf and Kevin Tatroe, and Upgrading to PHP 5 by Adam Trachtenberg. The book by Matt Zandstra that you mention is very good, but it's very specialized. If you're already at an intermediate-advanced level, and want to learn about design patterns with PHP, it might be a good choice. If you're at a less advanced level, maybe not. -- David Powers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_GET and multiple spaces.
-Original Message- From: Andrés Robinet [mailto:[EMAIL PROTECTED] Sent: Tuesday, 15 January 2008 6:33 AM To: php-general@lists.php.net Subject: RE: [PHP] $_GET and multiple spaces. Like this? $url = htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value)); Regards, Rob I'm now using urlencode on the values and htmlspecialchars on the entire url and it's working nicely. Thanks to everyone who helped. Craig. museumvictoria.com.au This e-mail is solely for the named addressee and may be confidential.You should only read, disclose, transmit, copy, distribute, act in relianceon or commercialise the contents if you are authorised to do so. If you are not the intended recipient of this e-mail, please notify [EMAIL PROTECTED] by e-mail immediately, or notify the sender and then destroy any copy of this message. Views expressed in this e-mailare those of the individual sender, except where specifically stated to be those of an officer of Museum Victoria. Museum Victoria does not represent,warrant or guarantee that the integrity of this communication has been maintained nor that it is free from errors, virus or interference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SMTP vs mail()
Hello, on 01/14/2008 04:15 PM Richard Lynch said the following: If you have your sendmail equivalent program properly configured, no SMTP connection is used when queueing messages using the sendmail program. What about when you take into consideration this program could be sending 1000's of emails, say, 100 per SMTP connection? That is even worse. Keep in mind that the SMTP server of sendmail or equivalent MTA, ends up calling the sendmail program for each individual message that it receives. That would be the most brain-dead SMTP server on the planet... Are you talking Windows or something? :-) On the contrary, you may be surprised, but this is precisely inline with Unix/Linux spirit. Small programs communicating through pipes that execute individual tasks each and then exit. Unlike Windows, forking new programs is not so expensive. Anyway, you may want to check these diagrams to learn the architecture or sendmail and qmail and verify what I am saying: http://www.sendmail.org/~ca/email/sm-X/design-2005-05-05/main/node3.html#SECTION0031 http://www.nrg4u.com/qmail/the-big-qmail-picture-103-p1.gif -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_GET and multiple spaces.
On Mon, January 14, 2008 1:33 pm, Andrés Robinet wrote: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 2:11 PM To: Jochem Maas Cc: clive; Churchill, Craig; php-general@lists.php.net Subject: Re: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 3:17 am, Jochem Maas wrote: I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Actually, after you urlencode() the values, you should htmlentities the whole URL, as it is being passed to HTML as a value to be output to HTML. The whole URL should *NOT* be URL-encoded, however. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Like this? $url = htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value)); Yes, but if your $name is weird enough to need to be urlencoded, you probably are doing something Wrong from a stylistic programming stand-point... I'm not even sure of the rules for what can be in a $name, come to think of it... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Posting Summary for Week Ending 11 January, 2008: php-general@lists.php.net
On Mon, January 14, 2008 12:22 pm, Eric Butera wrote: Looks like someone else is trying to win this week after weeks of semi-silence. :) Not really. Just happened to need a break from hacking. Besides, if you run the numbers for all time going back to when there was only one (1) PHP mailing list, I think I'm gonna be near the top anyway :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Freebsd 6.2 amd64 PHP 5.2.5 Internal Server Error
Hello, I have a freebsd 6.2 server running amd64 version with php 5.2.5. The web server is Apache 1.3.39. The following bit of code works on the 32 bit version of php running on Freebsd 6.2 (32 bit), Apache 1.3.39 build but causes a 500 internal server error when run on the amd64 bit version. The amd64 bit version has the web application mounted as a nfs mount. $file_name = MOUNT_DIR . /test.txt; if (!$write_handle = fopen($file_name, 'w')) { return false; } //set conforming strings to true $ins_fields_sql = SET standard_conforming_strings to TRUE;; fwrite($write_handle, $text_to_write . \n); THIS WRITE HAPPENS TO THE FILE foreach ($ar_orders as $key = $value) { ### INTERNAL SERVER ERROR } Has anyone come across this? Any insight would be greatly appreciated. -- Regards, Anjan Upadhya V.P. of Software Development [EMAIL PROTECTED] ph: 954.332.7875 == www.sproutloud.com SproutLoud Media Networks, LLC. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP SOAP Client formats
On Wed, January 9, 2008 9:45 pm, Tim Traver wrote: Thank you for answering, but the issue is that the PHP SOAPClient classes actually create that xml to send, so I have no control over the xml that is sent with a call command to the SOAP object... I just wondered if there was any flags that I am missing that might bring the php stuff in line with what the server expects. If there are any such flags, they'd be documented in the manual. If there aren't, perhaps you can find another SOAP constructor tool in PHP. I know there have been at least 3 or 4 popular ones over the years. And while the built-in one in PHP 5 is by far the best/easiest to use generally, you might be better off using nuSoap or somesuch even if it's a PITA, because it might construct the kind of SOAP envelope the other server is expecting. I would definitely recommend abstracting it as much as possible, though, so you can upgrade easily to a better SOAP implementation if the other end changes their software. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var_dump() results
On Mon, January 14, 2008 12:21 pm, Europus wrote: Richard Lynch wrote: $link = mysql_pconnect('$host', '$login', '$passwd'); '$host' is not right. $host is right. Ditto for ALL your values throughout this script. I know. I knew. I knew that variables do not need quotes, that single quoted variables get parsed literally. I edited the email to make those changes, the real values were contained in the actual script. See following (earlier than your reply?) emails. So blindfold me and shoot me for not taking the time to edit that bit of punctuation that was sent to the list, I asked for help on the loop and not help on connecting to the db. Oh, so shoot me for posting too much code, basically. I'm guilty as hell on that. In the actual test I tried after sending that email, probably I left a set of quotes in somewhere, I can't find any reserved word conflicts. Other replies indicate that it should work as intended, so probably I'll try it again. if (!$link) { die('Unable to connect : ' . mysql_error()); Forget the loop, this should have puked right here, or you aren't posting your actual code... It was the actual code, edited for certain authentication data that is already identified elsewhere. phpinfo() says PHP v4.3.11 and MySQL v3.23.32 so why didn't it puke right there and why should it have? Please tell me, I need to learn more about these versions I must deal with too. It should have puked because you couldn't have connected to a host named '$host' is all. //get column data $sql= SELECT column2, column3 FROM $table; $result = mysql_query($sql); $row = mysql_fetch_row($result); //loop through to display results for($i=0; $i count($row); $i++){ The $row only has TWO columns in it: column2, column3 Right. And? And you are using count($row) which is always TWO (2) so you will always show the same first row, twice over. The $result may have many, many, many rows in it. You can find out HOW many by using: http://php.net/mysql_num_rows This has already been resolved, but I'd like to learn what I can from you re: your earlier comments, above. Your take-home should not be that switching from mysql_fetch_row to mysql_fetch_array somehow magically fixed it. It should be that iterating over the result set with any mysql_fetch_* function instead of iterating over the columns within a single row was what you wanted to do. A closer match of your original post would include: $num_rows = mysql_num_rows($result); //Call function only once for loop: for ($i = 0; $i $num_rows; $i++){ //Iterate through all rows Aside, does everyone else think you are a butthead or are we off to a bad start? Let's fix that, can we? If you want to take a poll and find out who thinks I'm a butthead, feel free. If you expect me to care if you think I'm a butthead or not, you're out of luck. :-) :-) :-) You may want to look through the PHP-General archives for posts and see if I appear to be a butthead in general, or if you just mistook my ATTEMPT TO HELP YOU for being a butthead. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
Sancar Saran schreef: On Sunday 13 January 2008 21:42:28 Jochem Maas wrote: no race conditions occur in code written in php? true that there is no direct race conditions that can occur as a direct result of running code but obviously you've never dealt with multi-user systems using a databse backend, or file-writing based tools used in a web-environment (e.g. template output caching) or anything that uses shared memory or trying to guanrantee that a command-line script runs as a singleton. to name but a few examples that can most definitely be prone to race-conditions. Hmmm interesting so you mean $GLOBALS['language'] = memcached-get('language'); race condition prone than function hede() { global $language $language = memcached-get('language'); } no not in the slightest. both those bits of code are identical for one (apart from the fact that neither are valid syntax). and whatever your trying to point out it's beside the point (I think). any possible race condition will be occuring with the code that *sets* data into memcache (or whatever). I don't claim to know everything there is no know about race-conditions but you can very easily program them into a php app that's for sure. please do some reading on the matter (e.g. google 'memcache+race+condition') - I'm quite sure you'll find some interesting material - I know I did (just now) Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scratch that
On Wed, January 9, 2008 9:54 pm, Liam wrote: How can I display the returned HTML contents of a cgi (Perl) script, without get parameters? The same way you would do it WITH the parameters, as outlined by several people in this (previous) thread already. You are actually reading the answers, right?... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
Hello Jochem, no not in the slightest. both those bits of code are identical for one (apart from the fact that neither are valid syntax). and whatever your trying to point out it's beside the point (I think). any possible race condition will be occuring with the code that *sets* data into memcache (or whatever). I don't claim to know everything there is no know about race-conditions but you can very easily program them into a php app that's for sure. please do some reading on the matter (e.g. google 'memcache+race+condition') - I'm quite sure you'll find some interesting material - I know I did (just now) Of course, my recent project uses heavly on memcached and race conditions are blown. So I have to implement some kind flag system to avoid race conditions. And in same project I use $GLOBALS-['mc'] for storing memcached resource object. and if I was use to store some kind of data in $GLOBALS i use $GLOBALS['data'][] = $some_data; And of course without proper handling. You can blow yourself... Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_GET and multiple spaces.
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 7:08 PM To: Andrés Robinet Cc: php-general@lists.php.net Subject: RE: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 1:33 pm, Andrés Robinet wrote: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 2:11 PM To: Jochem Maas Cc: clive; Churchill, Craig; php-general@lists.php.net Subject: Re: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 3:17 am, Jochem Maas wrote: I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Actually, after you urlencode() the values, you should htmlentities the whole URL, as it is being passed to HTML as a value to be output to HTML. The whole URL should *NOT* be URL-encoded, however. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Like this? $url = htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value) ); Yes, but if your $name is weird enough to need to be urlencoded, you probably are doing something Wrong from a stylistic programming stand-point... I'm not even sure of the rules for what can be in a $name, come to think of it... I think I can tell you what... it has just came to my mind (nirvana moment)... how about this? $name = 'mylist[myindex]'; -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Scratch that
On Wed, January 9, 2008 10:39 pm, Liam wrote: 2) Not count as though the user manually navigated to that page (for my sanity when checking the site statistics!) and Configure statistics package to not count your own server hits. Problem solved. If no allow_url_fopen, then use curl. If no allow_url_fopen AND no curl, then find a better host. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Freebsd 6.2 amd64 PHP 5.2.5 Internal Server Error
-Original Message- From: Anjan Upadhya [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 7:18 PM To: php-general@lists.php.net Subject: [PHP] Freebsd 6.2 amd64 PHP 5.2.5 Internal Server Error Hello, I have a freebsd 6.2 server running amd64 version with php 5.2.5. The web server is Apache 1.3.39. The following bit of code works on the 32 bit version of php running on Freebsd 6.2 (32 bit), Apache 1.3.39 build but causes a 500 internal server error when run on the amd64 bit version. The amd64 bit version has the web application mounted as a nfs mount. $file_name = MOUNT_DIR . /test.txt; if (!$write_handle = fopen($file_name, 'w')) { return false; } //set conforming strings to true $ins_fields_sql = SET standard_conforming_strings to TRUE;; fwrite($write_handle, $text_to_write . \n); THIS WRITE HAPPENS TO THE FILE foreach ($ar_orders as $key = $value) { ### INTERNAL SERVER ERROR } Has anyone come across this? Any insight would be greatly appreciated. -- Regards, Anjan Upadhya V.P. of Software Development [EMAIL PROTECTED] ph: 954.332.7875 == www.sproutloud.com SproutLoud Media Networks, LLC. This is weird, and it's a bit odd that the code is causing a #500 error after you have successfully written the file. I would do the following: 1 - Check the apache logs (the overall error_log, and the specific domain's error log). What do they say about the error? 2 - If you are using mod_rewrite, that could be the cause (it's a good source for # 500 errors, and you can enable rewrite.log for debugging, if that's the case) 3 - If you can test it with several browsers do it (IE has caused me trouble at least on my development box, it was kind of throwing a GET request twice, and one of the times without the last part of the URL path... weird). Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
Andrés Robinet schreef: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 7:08 PM To: Andrés Robinet Cc: php-general@lists.php.net Subject: RE: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 1:33 pm, Andrés Robinet wrote: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 2:11 PM To: Jochem Maas Cc: clive; Churchill, Craig; php-general@lists.php.net Subject: Re: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 3:17 am, Jochem Maas wrote: I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Actually, after you urlencode() the values, you should htmlentities the whole URL, as it is being passed to HTML as a value to be output to HTML. The whole URL should *NOT* be URL-encoded, however. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Like this? $url = htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value) ); Yes, but if your $name is weird enough to need to be urlencoded, you probably are doing something Wrong from a stylistic programming stand-point... I'm not even sure of the rules for what can be in a $name, come to think of it... I think I can tell you what... it has just came to my mind (nirvana moment)... how about this? $name = 'mylist[myindex]'; this is almost an invite to moan about how http_build_query() was 'fixed' in 5.1.3 to escape square brackets ... which makes php nolonger do one of the coolest, imho, with regard to incoming GET/POST values - namely auto-convert bracketed request var names into native arrays. at least if those strings are used in anything other than a URL context (form inputs anyone). I would have been nice to have the encoding as an optional switch/argument. /* since php5.1.3 http_build_query() urlencodes square brackets - this does not please us at all, * this function fixes the problem the encoding causes us when using http_build_query() output * in hidden INPUT field names. */ function inputPostQueryUnBorker($s) { // first version - slower? more code! /* return preg_replace('#(\?|(?:amp;)?)([^=]*)=#eU', '\\1'.str_replace(array('%5B','%5D'), array('[',']'), '\\2').'=', $s); //*/ // second version - faster? more compact! (should work identically to the above statement. return preg_replace('#%5[bd](?=[^]*=)#ei', 'urldecode(\\0)', $s); } -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_GET and multiple spaces.
-Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 8:34 PM To: Andrés Robinet Cc: php-general@lists.php.net Subject: Re: [PHP] $_GET and multiple spaces. Andrés Robinet schreef: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 7:08 PM To: Andrés Robinet Cc: php-general@lists.php.net Subject: RE: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 1:33 pm, Andrés Robinet wrote: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 2:11 PM To: Jochem Maas Cc: clive; Churchill, Craig; php-general@lists.php.net Subject: Re: [PHP] $_GET and multiple spaces. On Mon, January 14, 2008 3:17 am, Jochem Maas wrote: I think actually the whole url should be urlencoded as a matter of course, not 100% sure about this (and it's way to early on a monday to bother checking up ;-) ... maybe someone else can chime in? Actually, after you urlencode() the values, you should htmlentities the whole URL, as it is being passed to HTML as a value to be output to HTML. The whole URL should *NOT* be URL-encoded, however. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? Like this? $url = htmlspecialchars('whatever.php?'.urlencode($name).'='.urlencode($value) ); Yes, but if your $name is weird enough to need to be urlencoded, you probably are doing something Wrong from a stylistic programming stand-point... I'm not even sure of the rules for what can be in a $name, come to think of it... I think I can tell you what... it has just came to my mind (nirvana moment)... how about this? $name = 'mylist[myindex]'; this is almost an invite to moan about how http_build_query() was 'fixed' in 5.1.3 to escape square brackets ... which makes php nolonger do one of the coolest, imho, with regard to incoming GET/POST values - namely auto-convert bracketed request var names into native arrays. at least if those strings are used in anything other than a URL context (form inputs anyone). I would have been nice to have the encoding as an optional switch/argument. Well, almost... the other part of the world that arguably wanted square brackets escaped in http_build_query will be very pleased (let me tell you I don't use http_build_query, but have my own as sometimes PHP 5 is not an option...). I guess they thought http_build_query would always be used in an URL context. But yes... escaping square brackets could be made optional and we get the best of both worlds. Anyway... my point was that names may need escaping, at least in some contexts. But let me ask you because maybe I'm wrong: a href=index.php?list%5Bindex%5D=valueClick/a Wouldn't this be translating into $_GET['list']['index'] == 'value'? As far as I've tested, it is... Also, it seems that [ and ] are unsafe characters according to http://www.ietf.org/rfc/rfc1738.txt Unsafe: Characters can be unsafe for a number of reasons. The space character is unsafe because significant spaces may disappear and insignificant spaces may be introduced when URLs are transcribed or typeset or subjected to the treatment of word-processing programs. The characters and are unsafe because they are used as the delimiters around URLs in free text; the quote mark () is used to delimit URLs in some systems. The character # is unsafe and should always be encoded because it is used in World Wide Web and in other systems to delimit a URL from a fragment/anchor identifier that might follow it. The character % is unsafe because it is used for encodings of other characters. Other characters are unsafe because gateways and other transport agents are known to sometimes modify such characters. These characters are {, }, |, \, ^, ~, [, ], and `. All unsafe characters must always be encoded within a URL Maybe that's why they chose to escape square brackets. I'm not a standards freak, but rather a pragmatic man. Just trying to prove a point. /* since php5.1.3 http_build_query() urlencodes square brackets - this does not please us at all, * this function fixes the problem the encoding causes us when using http_build_query() output * in hidden INPUT field names. */ function inputPostQueryUnBorker($s) { // first version - slower? more code! /* return preg_replace('#(\?|(?:amp;)?)([^=]*)=#eU', '\\1'.str_replace(array('%5B','%5D'), array('[',']'), '\\2').'=', $s); //*/ // second version - faster? more compact! (should work identically to the above statement. return preg_replace('#%5[bd](?=[^]*=)#ei', 'urldecode(\\0)',
RE: [PHP] PHP SOAP Client formats
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, January 14, 2008 7:21 PM To: Tim Traver Cc: Bastien Koert; PHP General List Subject: Re: [PHP] PHP SOAP Client formats On Wed, January 9, 2008 9:45 pm, Tim Traver wrote: Thank you for answering, but the issue is that the PHP SOAPClient classes actually create that xml to send, so I have no control over the xml that is sent with a call command to the SOAP object... I just wondered if there was any flags that I am missing that might bring the php stuff in line with what the server expects. If there are any such flags, they'd be documented in the manual. If there aren't, perhaps you can find another SOAP constructor tool in PHP. I know there have been at least 3 or 4 popular ones over the years. And while the built-in one in PHP 5 is by far the best/easiest to use generally, you might be better off using nuSoap or somesuch even if it's a PITA, because it might construct the kind of SOAP envelope the other server is expecting. I would definitely recommend abstracting it as much as possible, though, so you can upgrade easily to a better SOAP implementation if the other end changes their software. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? The only problem I had with nuSOAP was a name clash with the PHP 5 native extension. But they fixed it in November (there was a previous non-official fix also.. but can't remember the link right now). nuSOAP has been around for several years and it's working for PHP 4 or PHP 5. So far it's doing the job pretty well (what's more, for a SOAP API, chances are that nuSOAP is included along with the code samples). Though I didn't run any benchmarks, its speed is more than enough for my taste, when caching the WSDL object (in fact, most of the time will be spent in the server to server roundtrip). So... my vote for nuSOAP. However, if you are using the native extension and have specific needs for the XML request, you can override the __doRequest() method http://php.net/manual/en/function.soap-soapclient-dorequest.php (there's an example in the manual notes). Regards, Rob Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: http://www.bestplace.biz | Web: http://www.seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET and multiple spaces.
Andrés Robinet schreef: -Original Message- ... $name = 'mylist[myindex]'; this is almost an invite to moan about how http_build_query() was 'fixed' in 5.1.3 to escape square brackets ... which makes php nolonger do one of the coolest, imho, with regard to incoming GET/POST values - namely auto-convert bracketed request var names into native arrays. at least if those strings are used in anything other than a URL context (form inputs anyone). I would have been nice to have the encoding as an optional switch/argument. Well, almost... the other part of the world that arguably wanted square brackets escaped in http_build_query will be very pleased (let me tell you I don't use http_build_query, but have my own as sometimes PHP 5 is not an option...). I guess they thought http_build_query would always be used in an URL context. But yes... escaping square brackets could be made optional and we get the best of both worlds. Anyway... my point was that names may need escaping, at least in some contexts. But let me ask you because maybe I'm wrong: a href=index.php?list%5Bindex%5D=valueClick/a Wouldn't this be translating into $_GET['list']['index'] == 'value'? As far as I've tested, it is... Also, it seems that [ and ] are unsafe characters according to http://www.ietf.org/rfc/rfc1738.txt ... Maybe that's why they chose to escape square brackets. I'm not a standards freak, but rather a pragmatic man. Just trying to prove a point. you are completely correct, and I agree. I am also pragmatic - it was pragmatism that got me using http_build_query in a non-url context ... I have a ORM-like tool with a generic frontend that creates very complex POST/GET values/strings that describe what I like to call a 'data path' .. which allows you to specify stuff like 'the list [or details] of all subitems belonging to the 3 selected subitems of the item with keyfield values ,Y and Z'. this is done using a structure which is a nested array that translates accross requests nicely using http_build_query() - but it means the resulting request parameters names are used in a GET context and in POST context which means using the parameter names in the context of INPUT tag names, and in such cases the encoding is not wanted - it maybe the that encoding is required by certain standards in such a context BUT php doesn't recognise urlencoded square brackets in the way one wants ... namely one doesn't get a neat nesed array in $_POST but rather stuff like: $_POST[e[f][n]] = entityname (as opposed to:) $_POST[e[f][n] = entityname (which is what my ORM-like generic thingy was expecting.) the function I showed isn't name 'inputPost*' for nothing :-) it was specifically written for the task of making request parameter names as generated by http_build_query() usable in the name attribute of input tags and have them behave as they would if found in a GET query string. the only reason I remember all this about http_build_query() is because it: a) totally broke my app/tool at a time when I didn't have control of the php version and didn't have time to actually fix (well I had to make time :-) b) it was quite a headache getting the regexp in question to do exactly what I wanted (e.g. that only square brackets encountered in request variable names should be decoded and those found in request variable values should be left encoded, etc, etc). sometimes it's fun to reminisce :-P /* since php5.1.3 http_build_query() urlencodes square brackets - this does not please us at all, * this function fixes the problem the encoding causes us when using http_build_query() output * in hidden INPUT field names. */ function inputPostQueryUnBorker($s) { // first version - slower? more code! /* return preg_replace('#(\?|(?:amp;)?)([^=]*)=#eU', '\\1'.str_replace(array('%5B','%5D'), array('[',']'), '\\2').'=', $s); //*/ // second version - faster? more compact! (should work identically to the above statement. return preg_replace('#%5[bd](?=[^]*=)#ei', 'urldecode(\\0)', $s); } ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A good book for a perspective programer.
Sean-Michael schreef: Yes, you are 100% correct David Powers, I did not include enough information to get the advice I was asking for. I really need to learn to ask better questions, so I can get the help I seek... there a book for that lol No really, I would like to take the time to clarify my question as you suggested. I am rather new to php, I'm learning the basics from the php manual, as well as the tutorials at the w3schools web site and whatever I can find online. I am capable of writing w3c valid xhtml and css ducumants. My goals is to become php certified threw the zend program, most importantly I wish to use php as my primary server scripting language to use in all web sites I design, storing and managing data with MySQL and flat files where required. It's my goal to get certified for both php and MySQL. I am in the process of learning web design on my own, that is with use of online tutorials and books as I mentioned. To make this my profession, and have a type of paper declaring that I'm not just a hack ; ). read, read, read and read some more - anything and everything you can get your hands on - mostly you won't really be able to tell how good a book is/was until you completely understand and master the concepts enclosed. also I have found almost every php book has weakness and strengths and that, often, comparing differing point of view actually is one of the best ways of grasping concepts. and get practical - try stuff out and get your hair wet (i.e. don't be afraid of getting out of your depth) lastly. there is a big difference between web-designer and web-developer - designers make things look good/great/sexy, and work on stuff like UI visualisation, etc, etc. developers design and build the applications/system that make the pretty stuff 'work'. one isn't much without the other but they are 2 different things and I don't think there are many people that can claim to be very good at both - although in my mind a decent developer should be able to a bit of [visual] design and vice-versa. humour type=lame whatever you do don't aspire to be a web-programmer - unless you have no self esteem, no talent, no problem-solving skills and no analytical capabilities whatsoever ... in fact if thats the case I recommend nipping down to your local BK ;-) /humour ah and grow thick skin, very very thick skin. :-P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Closures in PHP
On Monday 14 January 2008, Richard Lynch wrote: And, actually, the implementation that seemed to get the most approbation was a simple way to create a function as a kind of a resource (like a MySQL connection resource) and then you could pass it around and use it. It still didn't have a full-blown closure behaviour, as I recall, of keeping the entire environment at the time of the function defintion. The better version, I thought, had the lexical keyword so you could keep around those variables you actually want. Not sure what the status of it is. If you want something that esoteric, go use Lisp. :-) You are aware that of the modern web languages (PHP, Javascript, Python, Ruby, etc.) PHP is the only one that doesn't have at least partial closures and dynamic functions, right? -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var_dump() results
Jochem Maas wrote: there is no 'we' in 'you'. There's no Jochem in there either. No offense taken, btw. Richard's posted more answers to more posts on this list than you have written line of code in your life ...probably. And yet. No, I'm not going to say what happened elsewhere, to you. It would disrespect Lynch and me, both. I offered an olive branch, albeit a very small one. Probably, Richard doesn't even realize the slight he made and why I retorted. Certainly, he doesn't need you or anyone else to swat it away before he's seen it and had a chance to decide for himself. Except for my forthcoming reply to Richard, this is my last reply on this sub-topic to anyone who isn't Richard. As has been pointed out, admitted to by me before it was pointed out, I have lots of reading to do. I thought I was at the point where I should begin my transition from the written word to the typed script. Well, maybe I'm a little slow but I'm certainly not going to give up just because you think you need to defend someone else. Contemplate your own zen garden, I have work to do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] var_dump() results
Richard Lynch wrote: The $result may have many, many, many rows in it. You can find out HOW many by using: http://php.net/mysql_num_rows This has already been resolved, but I'd like to learn what I can from you re: your earlier comments, above. Your take-home should not be that switching from mysql_fetch_row to mysql_fetch_array somehow magically fixed it. It wasn't. I thought it was that I was invoking var_dump(), print_r() and echo at the wrong point to see what the output was. Also that echo was an improper command to invoke. It should be that iterating over the result set with any mysql_fetch_* function instead of iterating over the columns within a single row was what you wanted to do. Well said, the point is driven home. If you want to take a poll and find out who thinks I'm a butthead, feel free. No bet, I couldn't resist yanking on your chain a little is all. If you expect me to care if you think I'm a butthead or not, you're out of luck. :-) :-) :-) If you expect my feelings to be hurt as a result, you're in a similar situation. :) You may want to look through the PHP-General archives for posts and see if I appear to be a butthead in general, or if you just mistook my ATTEMPT TO HELP YOU for being a butthead. Nope, that's not why. I mistook you for a butthead for your complete failure to reply to other things, as backdrop for the presumptive tone you took while addressing matters you would know had been resolved already had you read through. But maybe that's my fault. I appreciate the value you added to my take-home lesson. Really and sincerely, I do. Looping over the columns instead of the rows? That was stupid of me, your post helped me see that error, thank you. You could have limited your reply to that and we'd be two posts forward from where we are now. Ulex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Closures in PHP
On Mon, January 14, 2008 8:13 pm, Larry Garfield wrote: On Monday 14 January 2008, Richard Lynch wrote: If you want something that esoteric, go use Lisp. :-) You are aware that of the modern web languages (PHP, Javascript, Python, Ruby, etc.) PHP is the only one that doesn't have at least partial closures and dynamic functions, right? PHP has create_function, which is a (very) partial closure. And, really, I don't see it as a big lack either... I've needed a stupid one-liner un-named function in PHP, and create_function is awkward as [bleep] but it does work... I've never felt the need for a full-blown closure, in over a decade. But maybe that's just because I like to keep things simple. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML addChild() namespace problem
This is problematic code, even though it works, because it auto-generates an unnecessary xmlns: attribute: $item-addChild('itunes:subtitle', $mySubTitle,itunes); It generates the following XML: itunes:subtitle xmlns:itunes=itunesMusical Mockery/itunes:subtitle When really all we want is this: itunes:subtitleMusical Mockery/itunes:subtitle Furthermore, dumping it into a DomDocument and attempting to use removeAttributeNS() to remove the spurious attribute removes the entire kit and kaboodle, leaving only: subtitleMusical Mockery/subtitle How can one get the desired result, short of using a regexp? (I have done this, and it works, but is a silly hack because it doesn't use XML parsing to address an XML problem). Thanks, Carole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uh oh, I defined a resoruce
On Jan 14, 2008 6:11 PM, Sancar Saran [EMAIL PROTECTED] wrote: Hello Jochem, no not in the slightest. both those bits of code are identical for one (apart from the fact that neither are valid syntax). and whatever your trying to point out it's beside the point (I think). any possible race condition will be occuring with the code that *sets* data into memcache (or whatever). I don't claim to know everything there is no know about race-conditions but you can very easily program them into a php app that's for sure. please do some reading on the matter (e.g. google 'memcache+race+condition') - I'm quite sure you'll find some interesting material - I know I did (just now) Of course, my recent project uses heavly on memcached and race conditions are blown. So I have to implement some kind flag system to avoid race conditions. And in same project I use $GLOBALS-['mc'] for storing memcached resource object. and if I was use to store some kind of data in $GLOBALS i use $GLOBALS['data'][] = $some_data; And of course without proper handling. You can blow yourself... wow, we really are drifting on the initial topic of this thread here, but im going to chime in again. i think that php does not offer much in the way of managing synchronization of code that could potentially enter a race condition. the best thing youll see in the documentation (from what ive read of it) is file locks. and there is a good example of how to use them that someone has posted. but file locking for mutual exclusion is slow. ive implemented some synchronization code using the sysv sempaphores which is much faster than file locking, however not portable (though i wont be needing to port it to windows anyway ;)) java has a very nice construct, the synchronize keyword, which in my opinion is quite elegant. it is not the most performant, but i imagine it beats file locking and the best part is, its a native mechanism. facilitating mutual exclusion is a sore spot for me with php anyway. -nathan
Re: [PHP] PHP SOAP Client formats
On Jan 14, 2008 8:48 PM, Andrés Robinet [EMAIL PROTECTED] wrote: The only problem I had with nuSOAP was a name clash with the PHP 5 native extension. But they fixed it in November (there was a previous non-official fix also.. but can't remember the link right now). nuSOAP has been around for several years and it's working for PHP 4 or PHP 5. So far it's doing the job pretty well (what's more, for a SOAP API, chances are that nuSOAP is included along with the code samples). Though I didn't run any benchmarks, its speed is more than enough for my taste, when caching the WSDL object (in fact, most of the time will be spent in the server to server roundtrip). So... my vote for nuSOAP. i understand what youre saying, that the network i/o will typically constitute the most time in a SOAP request. i would imagine however that the php5 extension is much faster at building the request and parsing the response since nuSOAP is written entirely in php. i had to use it once and found the lack of documentation appalling. although, to be fair, id also say for anything beyond simple requests the documentation on the php site for the SOAPClient and related classes, could be more descriptive. i would label this thread as a case-in-point. -nathan
Re: [PHP] Closures in PHP
when it comes to create_function(), id say its just as painful as building functions with html or writing queries by hand. namely, its prone to a lot of string escaping which produces awful hard to read code. i mean, the kind of code you write yourself and then look at a week later and say 'what a mess'... anyway, it occurs to me that the closest thing php has to functional languages, thats readily usable is the variable function mechanism http://www.php.net/manual/en/functions.variable-functions.php theres been discussion about it on the list in the past, though often it is spoken of as a ghost feature. its quite nice. as an example, suppose you have a string $blah = 'myFunc'; then if myFunc is defined as a function, it can be invoked per $blah(/* params */); it creates the ability to do all sorts of powerful things, such as delegation whereby switch statements can be eliminated, callbacks, whereby a formal parameter could be a string that refers to a method name, and they work on object references as well. so you can get away w/ $this-$dynamicFuncName(/* params*/); in some sense you are passing around a function, but in reality there is no preservation of context at all. whats worse, the function that gets invoked had better be loaded into the interpreter or youll encounter a runtime error. but i do enjoy this feature. honestly im still struggling with closures as i continue to grow my skills with javascript, but at least the concepts are starting to sink in. being able to create anonymous functions on the fly would be a welcome feature in my book; and hey, how about anonymous objects while were at it ;) -nathan
Re: [PHP] SimpleXML addChild() namespace problem
On Jan 14, 2008 10:22 PM, Carole E. Mah [EMAIL PROTECTED] wrote: This is problematic code, even though it works, because it auto-generates an unnecessary xmlns: attribute: $item-addChild('itunes:subtitle', $mySubTitle,itunes); It generates the following XML: itunes:subtitle xmlns:itunes=itunesMusical Mockery/itunes:subtitle When really all we want is this: itunes:subtitleMusical Mockery/itunes:subtitle Furthermore, dumping it into a DomDocument and attempting to use removeAttributeNS() to remove the spurious attribute removes the entire kit and kaboodle, leaving only: subtitleMusical Mockery/subtitle How can one get the desired result, short of using a regexp? (I have done this, and it works, but is a silly hack because it doesn't use XML parsing to address an XML problem). have you considered appending the child w/ w/e the DOM extension has, just to see if the namespace specification is unintentionally added by it as well? -nathan
Re: [PHP] SimpleXML addChild() namespace problem
Yes, I tried the following: http://us3.php.net/manual/en/function.dom-domdocument-createelementns.php Same results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A good book for a perspective programer.
Sean-Michael wrote: I really need to learn to ask better questions, so I can get the help I seek... there a book for that lol http://catb.org/~esr/faqs/smart-questions.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML Bug question
What's the current status on this bug: http://bugs.php.net/bug.php?id=39164 Regardless of what the PHP developers say in those comments, the modification of data when it is read is not correct. If it is intended behavior, then the developer/s who intend it to be that way are wrong. Under no circumstances can it be considered appropriate for any read operation to write anything. Some clarity on this matter would be great. Regards, - Naz. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about $_POST ['something'] array
Hi, I have one question about $_POST ['something'] array... I am trying to use a form and php in a same file and when I am using the form for the first time, Any $_POST index which I use in the form is not defined (which is logical)...how can I remove any warning about undefined index of $_POST array... Example Script.php form action=script.php method=post input type=text name=anythingVariable input type=submit value=SUBMIT /form ?php $anything=$_POST ['anything']; Echo $anything; ? Thank you Lukas
Re: [PHP] question about $_POST ['something'] array
On Jan 14, 2008, at 1127PM, Lukáš Moravec wrote: I have one question about $_POST ['something'] array... I am trying to use a form and php in a same file and when I am using the form for the first time, Any $_POST index which I use in the form is not defined (which is logical)...how can I remove any warning about undefined index of $_POST array... Check if it is set before using it: ?php if(isset($_POST['anything']) { $anything = $_POST['anything']; } ? Be sure to validate and filter all input before using it! http://devzone.zend.com/article/1793-PHP-Security-Tip-8 http://www.sitepoint.com/article/php-security-blunders http://phpsecurity.org/ Brady