Re: [PHP] php with threaded MPM problem ?
Hi, Thank you all for your response. But turns out that the problem I am facing is caused by something else and unrelated to MPMs being threaded. The test case details gave me a clue. The test was trying to load mod_php between graceful restarts, i.e start apache without mod_php, then modify the config file to load it and do a graceful restart. This clearly fails because mod_php loads only on the second load within apache. It does this by setting some pool user data in the beginning of sapi_apache2.c:php_apache_server_startup(). So I'd have to do two graceful restarts for it to take effect. Now, I want to know if I can comment out this piece of code where it checks/sets the user data and make it load every time. This will help me enable the module between restarts too. Will this break something ? Do I need to post this query on a different mailing list to get a response from the PHP dev team ? Rgds, Rashmi On Dec 14, 2007 10:34 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, December 13, 2007 11:38 pm, Rashmi Badan wrote: I'm using php 5.2.1 with apache 2.2.6 and while running certain tests I see a segmentation fault - the relevant stack is given below. My php configure line is as follows configure '--prefix=/my/php/installdir' *'--with-tsrm-pthreads' *'--with-ldap' *'--enable-maintainer-zts'* '--enable-sigchild' '--enable-so' '--with-apxs2=/my/apache2/bin/apxs' '--without-sqlite' '--without-pdo-sqlite' '--with-oci8=/my/oracle/installdir' '--enable-mbstring' I'm running apache with a threaded MPM. Is that a probem as I remember reading somewhere that php does not quite work well with threaded MPMs. Would appreciate any help/pointers on this. PHP itself works fine with MPM, as far as anybody knows. But one of your --enable-xyz may NOT work fine with MPM! PDO is new and suspect. mbstring is on the way out in favor of PHP 6 Unicode, and I think it's also suspect. OCI8, well, I dunno... You'd think enough folks would be using that to get rid of all the thread-bugs, but... --- #0 0x007937a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x007d7c96 in kill () from /lib/tls/libc.so.6 #2 0x08070da8 in sig_coredump () #3 signal handler called #4 0x00a00d24 in pthread_mutex_lock () from /lib/tls/libpthread.so.0 *#5 0xb461d9f5 in tsrm_mutex_lock (mutexp=0x0) at /ade/rbadan_gollum/oracle/apache_modules/mod_php/php-5.2.1 /TSRM/TSRM.c:660 #6 0xb461d071 in ts_resource_ex (id=0, th_id=0x0)* at /ade/rbadan_gollum/oracle/apache_modules/mod_php/php- 5.2.1 /TSRM/TSRM.c:345 #7 0xb472dcb5 in php_handler (r=0x85c65b0) at /ade/rbadan_gollum/oracle/apache_modules/mod_php/php-5.2.1 /sapi/apache2handler/sapi_apache2.c:500 #8 0x080829af in ap_run_handler () #9 0x08082807 in ap_invoke_handler () #10 0x080976d5 in async_run_handlers () #11 0x080975f3 in async_process_connection () #12 0x08097346 in process_socket () #13 0x08096e97 in worker_thread () #14 0xb7f83e33 in dummy_worker (opaque=0x85bf438) at threadproc/unix/thread.c:142 #15 0x009ff371 in start_thread () from /lib/tls/libpthread.so.0 #16 0x008779be in clone () from /lib/tls/libc.so.6 You probably should post this into: http://bugs.php.net It is a pretty cogent error report. If you can provide source code for the tests that make this segfault, then odds are extremely good that somebody on the PHP Dev Team can reproduce it and fix 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?
Re: [PHP] php with threaded MPM problem ?
Rashmi Badan schreef: Hi, Thank you all for your response. But turns out that the problem I am facing is caused by something else and unrelated to MPMs being threaded. The test case details gave me a clue. The test was trying to load mod_php between graceful restarts, i.e start apache without mod_php, then modify the config file to load it and do a graceful restart. This clearly fails because mod_php loads only on the second load within apache. It does this by setting some pool user data in the beginning of sapi_apache2.c:php_apache_server_startup(). So I'd have to do two graceful restarts for it to take effect. Now, I want to know if I can comment out this piece of code where it checks/sets the user data and make it load every time. This will help me enable the module between restarts too. Will this break something ? Do I need to post this query on a different mailing list to get a response from the PHP dev team ? yes - your better off posting this to [EMAIL PROTECTED], that's where the devs hang out and one of them should be able to offer you some knowledge advice on the matter. as a sidenote: there is a not so small chance this will not be the only segfault you run into (assuming you get this fixed) depending on which php extensions you are using. regardless please do post a progress report to this list if you make any headway ... I'm sure Im not the only one interesed to here how you get on. rgds, Jochem Rgds, Rashmi On Dec 14, 2007 10:34 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, December 13, 2007 11:38 pm, Rashmi Badan wrote: I'm using php 5.2.1 with apache 2.2.6 and while running certain tests I see a segmentation fault - the relevant stack is given below. My php configure line is as follows configure '--prefix=/my/php/installdir' *'--with-tsrm-pthreads' *'--with-ldap' *'--enable-maintainer-zts'* '--enable-sigchild' '--enable-so' '--with-apxs2=/my/apache2/bin/apxs' '--without-sqlite' '--without-pdo-sqlite' '--with-oci8=/my/oracle/installdir' '--enable-mbstring' I'm running apache with a threaded MPM. Is that a probem as I remember reading somewhere that php does not quite work well with threaded MPMs. Would appreciate any help/pointers on this. PHP itself works fine with MPM, as far as anybody knows. But one of your --enable-xyz may NOT work fine with MPM! PDO is new and suspect. mbstring is on the way out in favor of PHP 6 Unicode, and I think it's also suspect. OCI8, well, I dunno... You'd think enough folks would be using that to get rid of all the thread-bugs, but... --- #0 0x007937a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 #1 0x007d7c96 in kill () from /lib/tls/libc.so.6 #2 0x08070da8 in sig_coredump () #3 signal handler called #4 0x00a00d24 in pthread_mutex_lock () from /lib/tls/libpthread.so.0 *#5 0xb461d9f5 in tsrm_mutex_lock (mutexp=0x0) at /ade/rbadan_gollum/oracle/apache_modules/mod_php/php-5.2.1 /TSRM/TSRM.c:660 #6 0xb461d071 in ts_resource_ex (id=0, th_id=0x0)* at /ade/rbadan_gollum/oracle/apache_modules/mod_php/php- 5.2.1 /TSRM/TSRM.c:345 #7 0xb472dcb5 in php_handler (r=0x85c65b0) at /ade/rbadan_gollum/oracle/apache_modules/mod_php/php-5.2.1 /sapi/apache2handler/sapi_apache2.c:500 #8 0x080829af in ap_run_handler () #9 0x08082807 in ap_invoke_handler () #10 0x080976d5 in async_run_handlers () #11 0x080975f3 in async_process_connection () #12 0x08097346 in process_socket () #13 0x08096e97 in worker_thread () #14 0xb7f83e33 in dummy_worker (opaque=0x85bf438) at threadproc/unix/thread.c:142 #15 0x009ff371 in start_thread () from /lib/tls/libpthread.so.0 #16 0x008779be in clone () from /lib/tls/libc.so.6 You probably should post this into: http://bugs.php.net It is a pretty cogent error report. If you can provide source code for the tests that make this segfault, then odds are extremely good that somebody on the PHP Dev Team can reproduce it and fix 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
[PHP] Opinion about the using $GLOBALS directly
Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing text into images, and setting text size [SOLVED]
Rob, Thank you for helping me through this. '--enable-gd-native-ttf' '--with-ttf' This was the key information. I thought that having the GD modules installed meant I had TTF support. But after I saw that, I realized that TTF support was a separate module within the GD library. On my home Ubuntu environment, placing TTF support simply meant installing the right package from the repository (which I found in Synaptic by searching for PHP TTF). I'm hoping that TTF support is reasonably common on web hosting services, since I'm aspiring for my code to be portable. In any case, you've helped me get to the point that I needed to get to, so I am very grateful for your support. Thanks. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
On Wed, 2007-12-19 at 12:13 +0200, Sancar Saran wrote: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; It can avoid problems sometimes (files included via functions) and it's obvious from reading the code exactly where the variable is being set. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
Sancar Saran schreef: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and VB.NET communication
Hi, I know this isn't purely php question but if you know please reply. I have a server with a PHP script on it. I need to write an app(VB.NET) that will connect to a server and request a script to process some info, and the php script will return XML data, in which I need to process that data with VB.net I'm currently using httpWebRequestMethod but no luck... Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating Random Numbers with Normal Distribution
On Dec 19, 2007, at 1:51 AM, Robert Cummings wrote: On Tue, 2007-12-18 at 16:26 -0500, Daniel Brown wrote: On Dec 18, 2007 4:24 PM, Travis L. Font [EMAIL PROTECTED] wrote: Here's random! I'm going to close my eyes think of some drinking water and running AT the same time and just start pushing numbers on the pad however way my fingers desire while not thinking about it! Here: 7914718845748671454531587148354531452141857 Good enough? No. * Must resist the being sucked back into this thread * Now can we finally get back in order? Or at least my version of order, which has been influenced by many factors including a huge Machine in the sky that is actually running the world with 1's and 0's :) Ohh... And Pudge the fish... He controls the weather... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and VB.NET communication
Zoran Bogdanov schreef: Hi, I know this isn't purely php question but if you know please reply. I have a server with a PHP script on it. I need to write an app(VB.NET) that will connect to a server and request a script to process some info, and the php script will return XML data, in which I need to process that data with VB.net I'm currently using httpWebRequestMethod but no luck... if it's broken at the VB.Net end then this is not he place to ask. first you need to check whether the php script can return data. 1. hand craft a suitable URL 2. open your browser and enter the URL 3. check output 4. if no output, check php logs, fix script, goto step 2 if you have confirmed manually that the script works and VB.net is still a problem check the logs of the php webserver to see exactly what (if anything) VB.net is sending. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
Hello Jochem, Thanks for response, I'm using this aproach maybe more than one year. I did not get any problems. there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) Yes you are right writing global $foo in 25+ functions a bit problematic. that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho And this is why I'm asking here, WHY I should avoid globals like plague ? Every one says bad. Alright, but no one says WHY ? I try to use alternative ways. But maintenance, complexty and speed costs much too high. I did not see any benefit. Robert Cummings says to you may confusing to setting variable. I have some debugging methots to detect this. And Of course I did not use someting like for($GLOBALS['i']=0; And I use GLOBALS for everything for I need someting more than once. (Db pointer or config array etc). Thanks for response Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating Random Numbers with Normal Distribution
2007. 12. 19, szerda keltezéssel 08.50-kor Jason Pruim ezt írta: On Dec 19, 2007, at 1:51 AM, Robert Cummings wrote: On Tue, 2007-12-18 at 16:26 -0500, Daniel Brown wrote: On Dec 18, 2007 4:24 PM, Travis L. Font [EMAIL PROTECTED] wrote: Here's random! I'm going to close my eyes think of some drinking water and running AT the same time and just start pushing numbers on the pad however way my fingers desire while not thinking about it! Here: 7914718845748671454531587148354531452141857 Good enough? No. * Must resist the being sucked back into this thread * Now can we finally get back in order? Or at least my version of order, why do you want everyone else to get into your version of order? are you Microsoft or what? ;) :P greets Zoltán Németh which has been influenced by many factors including a huge Machine in the sky that is actually running the world with 1's and 0's :) Ohh... And Pudge the fish... He controls the weather... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
js schreef: That wouldn't work well when you have to update multiple tables in a transaction. I think it's more maintainable to use GLOBALS than passing around dbh to classes/functions. getDB() is a function that returns a database connection wrapper object not a handle to a connection (that handle is assumed to be stored inside the object). it is also assumed that this connection object has a query method of some sort so you could do something like: myBigTransaction() { $db = getDB(); $db-trans(); $db-query(/* bla */); $db-query(/* bla */); $db-query(/* bla */); $db-commit(); } BUT regardless of that example you can still get rid of the global dbh by replacing references to $GLOBALS['my_dbh'] with something like getDBH() with no functional difference except you nolonger have global variables that are overrideable. if you don't understand what I am saying (as your last reply seemed to imply) then please let's just leave it at that. On Dec 19, 2007 11:07 PM, Jochem Maas [EMAIL PROTECTED] wrote: please reply to the list ... js schreef: I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } On Dec 19, 2007 9:52 PM, Jochem Maas [EMAIL PROTECTED] wrote: Sancar Saran schreef: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and VB.NET communication
2007. 12. 19, szerda keltezéssel 14.30-kor Zoran Bogdanov ezt írta: Hi, I know this isn't purely php question but if you know please reply. I have a server with a PHP script on it. I need to write an app(VB.NET) that will connect to a server and request a script to process some info, and the php script will return XML data, in which I need to process that data with VB.net I'm currently using httpWebRequestMethod but no luck... Thanks! if httpWebRequestMethod is what I think it is, then it makes a normal http request for a given url. so it should work. can you access the php script with a plain browser? does it work correctly from a browser? (if it processes some post data, then set up a test form with which you can post the test data to the script so you can test if it works or not) if no, the problem is with the script, with that we probably can help you. if it works, but your httpWebRequestMethod still does not return anything or returns incorrect value, that problem has nothing to do with php but with the vbscript part instead. greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
That wouldn't work well when you have to update multiple tables in a transaction. I think it's more maintainable to use GLOBALS than passing around dbh to classes/functions. On Dec 19, 2007 11:07 PM, Jochem Maas [EMAIL PROTECTED] wrote: please reply to the list ... js schreef: I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } On Dec 19, 2007 9:52 PM, Jochem Maas [EMAIL PROTECTED] wrote: Sancar Saran schreef: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating Random Numbers with Normal Distribution
2007. 12. 19, szerda keltezéssel 09.24-kor Jason Pruim ezt írta: On Dec 19, 2007, at 9:19 AM, Zoltán Németh wrote: 2007. 12. 19, szerda keltezéssel 08.50-kor Jason Pruim ezt írta: On Dec 19, 2007, at 1:51 AM, Robert Cummings wrote: On Tue, 2007-12-18 at 16:26 -0500, Daniel Brown wrote: On Dec 18, 2007 4:24 PM, Travis L. Font [EMAIL PROTECTED] wrote: Here's random! I'm going to close my eyes think of some drinking water and running AT the same time and just start pushing numbers on the pad however way my fingers desire while not thinking about it! Here: 7914718845748671454531587148354531452141857 Good enough? No. * Must resist the being sucked back into this thread * Now can we finally get back in order? Or at least my version of order, why do you want everyone else to get into your version of order? are you Microsoft or what? ;) :P Why would I want to be a gigantic monopoly that uses is predatory business practices to squash any independent thinking individuals? :) Nahhh... I prefer to Think Different :) okay then :) so, in your original sentence you wanted to say 'Now can we finally get back in order? Or at least everyone in his/her version of order,' :D greets Zoltán Németh -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
please reply to the list ... js schreef: I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } On Dec 19, 2007 9:52 PM, Jochem Maas [EMAIL PROTECTED] wrote: Sancar Saran schreef: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opinion about the using $GLOBALS directly
js wrote: That wouldn't work well when you have to update multiple tables in a transaction. I think it's more maintainable to use GLOBALS than passing around dbh to classes/functions. But you don't need to pass the dbh around to classes or functions, they can just call getDB when they need it and it will return the same connection and thus transactions will work fine. You did notice the static keyword in there right? Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating Random Numbers with Normal Distribution
On Dec 19, 2007, at 9:19 AM, Zoltán Németh wrote: 2007. 12. 19, szerda keltezéssel 08.50-kor Jason Pruim ezt írta: On Dec 19, 2007, at 1:51 AM, Robert Cummings wrote: On Tue, 2007-12-18 at 16:26 -0500, Daniel Brown wrote: On Dec 18, 2007 4:24 PM, Travis L. Font [EMAIL PROTECTED] wrote: Here's random! I'm going to close my eyes think of some drinking water and running AT the same time and just start pushing numbers on the pad however way my fingers desire while not thinking about it! Here: 7914718845748671454531587148354531452141857 Good enough? No. * Must resist the being sucked back into this thread * Now can we finally get back in order? Or at least my version of order, why do you want everyone else to get into your version of order? are you Microsoft or what? ;) :P Why would I want to be a gigantic monopoly that uses is predatory business practices to squash any independent thinking individuals? :) Nahhh... I prefer to Think Different :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
On Dec 18, 2007 10:01 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, December 18, 2007 9:17 am, Richard Heyes wrote: Emails that bounce get sent back to the address in the Return-Path: header. Correct? Depends on who is following which standards from which era... There was an Error-to: header that was popular for awhile, and... I don't think you can safely assume all email clients/muas/mtas are going to actually follow the same standard you are reading, much less follow it correctly. :-) ymmv This is just the opinion of one asshole, mind you, but considering how much of an asshole I am, that means my opinion *really* matters, right? I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
Hi Jochem, Sorry, I missed static. So, getDB() would works like singleton, right? I agree that's better method to manage dbh. On Dec 19, 2007 11:27 PM, Jochem Maas [EMAIL PROTECTED] wrote: js schreef: That wouldn't work well when you have to update multiple tables in a transaction. I think it's more maintainable to use GLOBALS than passing around dbh to classes/functions. getDB() is a function that returns a database connection wrapper object not a handle to a connection (that handle is assumed to be stored inside the object). it is also assumed that this connection object has a query method of some sort so you could do something like: myBigTransaction() { $db = getDB(); $db-trans(); $db-query(/* bla */); $db-query(/* bla */); $db-query(/* bla */); $db-commit(); } BUT regardless of that example you can still get rid of the global dbh by replacing references to $GLOBALS['my_dbh'] with something like getDBH() with no functional difference except you nolonger have global variables that are overrideable. if you don't understand what I am saying (as your last reply seemed to imply) then please let's just leave it at that. On Dec 19, 2007 11:07 PM, Jochem Maas [EMAIL PROTECTED] wrote: please reply to the list ... js schreef: I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } On Dec 19, 2007 9:52 PM, Jochem Maas [EMAIL PROTECTED] wrote: Sancar Saran schreef: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } That's surprisingly similar to how I do it. Then it's a simple matter to call getDB() (which you can do no matter what the current scope is) to get the database object. -- 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
[PHP] Re: Opinion about the using $GLOBALS directly
Sancar Saran wrote: And this is why I'm asking here, WHY I should avoid globals like plague ? Every one says bad. Alright, but no one says WHY ? Well for one thing it makes things harder to trace. You look at some code and you're just using some magic global variable. You can't tell what kind of object or variable it is just by looking at the code. There is also the chance that a mistake or some malicious code could overwrite you're global variable which could be hard to find/stop (one reason to ALWAYS put the constant on the LFH of the if equality test: if('somethine'=$var) gives a syntax/compile time error but if($var='something) is syntactically fine and often hard to spot that the extra = is missing). There is also the namespace issue. If you have a very cluttered global namespace and you try an merge in some other code with your which also uses global variables they may end up clobbering each other. You should definately always use a code-wide prefix on all global variables to try and reduce the likelihood of this happening. Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
On 19/12/2007, js [EMAIL PROTECTED] wrote: Hi Jochem, Sorry, I missed static. So, getDB() would works like singleton, right? I agree that's better method to manage dbh. The technique is called memoization (http://en.wikipedia.org/wiki/Memoization). -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php sockets
figured id top-post on this one, since the original message was so long.. i recommend debugging with a tool like wireshark. that way you can see whats in the packets going over the wire and hopefully it will lead to a solution. -nathan On Dec 19, 2007 12:54 AM, vixle [EMAIL PROTECTED] wrote: this code doesn't interact with php client while with c++ based one it works just fine. .anybody? #include stdio.h #include winsock2.h #include iostream #include process.h using namespace std; int i = 0; int ar = 0; const int is = 50; SOCKET stack[is]; void clientserve(void* ws) { SOCKET wsocket = *(SOCKET*)ws; int fgotused = 0; char sendbuf[70]; char recvbuf[70]; int scnt = 0; ar++; int id = ar; while(scnt = ar) { if(stack[scnt] == 0) { stack[scnt] = wsocket; id = scnt; fgotused = 1; scnt = 0; break; } scnt++; } if(fgotused == 0) stack[id] = wsocket; send(stack[id], Server message: You are now successfuly connected., 70, 0 ); while(1) { scnt = 0; if(recv(wsocket, recvbuf, 70, 0 ) == SOCKET_ERROR) { if(WSAGetLastError() == WSAECONNRESET) { i--; stack[id] = 0; cout Client Disconnected. endl; cout Clients connected: i endl; closesocket(wsocket); return; } } if(recvbuf) { cout recvbuf endl; while(scnt = ar) { if(scnt != id) send(stack[scnt], recvbuf, 70, 0); scnt++; } recvbuf = null; } } } void main() { WSADATA wsaData; int iResult = WSAStartup(MAKEWORD(2,2),wsaData); if (iResult != NO_ERROR) printf(Error at WSAStartup()\n); SOCKET m_socket; m_socket = socket (AF_INET, SOCK_STREAM, 0); if (m_socket == INVALID_SOCKET) { printf(Error at socket(): %ld\n, WSAGetLastError()); WSACleanup(); return; } sockaddr_in service; service.sin_family = AF_INET; service.sin_addr.s_addr = inet_addr(127.0.0.1); service.sin_port = htons(27015); if (bind(m_socket,(SOCKADDR*)service, sizeof(service)) == SOCKET_ERROR) { printf(bind() failed.\n); closesocket(m_socket); return; } if (listen(m_socket, 700) == SOCKET_ERROR) printf( Error listening on socket.\n); SOCKET AcceptSocket; printf(Waiting for a client to connect...\n); while (AcceptSocket = accept(m_socket, NULL, NULL)) { i++; cout Client Connected. endl; cout Clients connected: i endl; _beginthread(clientserve, 0, (void*)AcceptSocket); } } vixle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ?php /* Get the port for the WWW service. */ //$service_port = getservbyname('www', 'tcp'); /* Get the IP address for the target host. */ //$address = gethostbyname('www.example.com'); /* Create a TCP/IP socket. */ $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //echo Attempting to connect to '$address' on port '$service_port'...; $result = socket_connect($socket, 127.0.0.1, 27015); socket_RECV($socket, $read, 300, null); echo $read; socket_close($socket); ? i have a daemon running on that port that sends a message when it's got a client connected but the script above doesn't output anything it just loads my cpu up to 100 percent and thats it then it basically stops working. While i need it to display the messages sent by server(daemon) to the user running the script has anyone got any idea why it rejects to work? (yeah the daemon is written in c++ if that matters) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. -- 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
Re: [PHP] Just to confirm...
2007. 12. 19, szerda keltezéssel 09.56-kor Daniel Brown ezt írta: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true greets Zoltán Németh -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
Richard Heyes schreef: I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } That's surprisingly similar to how I do it. Then it's a simple matter to call getDB() (which you can do no matter what the current scope is) to get the database object. guess we agree on somethings :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
Daniel Brown schreef: On Dec 18, 2007 10:01 PM, Richard Lynch [EMAIL PROTECTED] wrote: On Tue, December 18, 2007 9:17 am, Richard Heyes wrote: Emails that bounce get sent back to the address in the Return-Path: header. Correct? Depends on who is following which standards from which era... There was an Error-to: header that was popular for awhile, and... I don't think you can safely assume all email clients/muas/mtas are going to actually follow the same standard you are reading, much less follow it correctly. :-) ymmv This is just the opinion of one asshole, mind you, but considering how much of an asshole I am, that means my opinion *really* matters, right? I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. hey look everyone, a talking ***hole ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
On Wed, December 19, 2007 4:13 am, Sancar Saran wrote: I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; Don't. You are using global variables, and you might as well admit it and use the 'global' keyword to designate them as such. Poking stuff into $GLOBALS instead just makes it look like you're trying to pretend you're not using global variables when you are, to me. I did form this opinion before altering $GLOBALS was a documented feature. ymmv -- 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] Just to confirm...
On Dec 19, 2007 10:51 AM, Zoltán Németh [EMAIL PROTECTED] wrote: 2007. 12. 19, szerda keltezéssel 15.31-kor Richard Heyes ezt írta: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. yes, for that Return-Path: should be used That's what I meant. Typo. If you look at the message prior to my last one, you'll see I'm just a fat-finger dope. And a talking asshole, as Jochem graciously reminded us all. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
On Wed, December 19, 2007 8:14 am, js wrote: That wouldn't work well when you have to update multiple tables in a transaction. I think it's more maintainable to use GLOBALS than passing around dbh to classes/functions. I also just use a 'global' for my db connection, for small to medium web applications. It's used all over the place, it's only one variable, and it's just not that tricky to remember that it's a global named $connection Others I'm sure consider this bad but there it is. -- 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] Opinion about the using $GLOBALS directly
js schreef: Hi Jochem, Sorry, I missed static. So, getDB() would works like singleton, right? yes - and it was just pseudo code off the top of my head, also there are 2 slightly different ways to attack this - one is to return an object that contains all the DB functionality (and stores the dbh internally) and the other is to return the actual dbh whether you need it ... the choice of which way to do this is rather dependant on how your current code works - regardless the point is the same - use a central 'store' for the dbh/db-object but keep it out of the global scope (so that there is less scope pollution and no chance of overwriting the dbh/db-object var) I agree that's better method to manage dbh. :-) On Dec 19, 2007 11:27 PM, Jochem Maas [EMAIL PROTECTED] wrote: js schreef: That wouldn't work well when you have to update multiple tables in a transaction. I think it's more maintainable to use GLOBALS than passing around dbh to classes/functions. getDB() is a function that returns a database connection wrapper object not a handle to a connection (that handle is assumed to be stored inside the object). it is also assumed that this connection object has a query method of some sort so you could do something like: myBigTransaction() { $db = getDB(); $db-trans(); $db-query(/* bla */); $db-query(/* bla */); $db-query(/* bla */); $db-commit(); } BUT regardless of that example you can still get rid of the global dbh by replacing references to $GLOBALS['my_dbh'] with something like getDBH() with no functional difference except you nolonger have global variables that are overrideable. if you don't understand what I am saying (as your last reply seemed to imply) then please let's just leave it at that. On Dec 19, 2007 11:07 PM, Jochem Maas [EMAIL PROTECTED] wrote: please reply to the list ... js schreef: I always store database handler in $GLOBALS. I think that's the best place to save request-level-global. I wonder where other people save that kind of data. how about a static variable inside a function or a static member of a class. e.g. function getDB($args) { static $conn = array(); $key = serialize($args); if (!isset($conn[ $key ]) $conn[ $key ] = new DBConn($args); return $conn[ $key ]; } On Dec 19, 2007 9:52 PM, Jochem Maas [EMAIL PROTECTED] wrote: Sancar Saran schreef: Hello list. I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho Regards Sancar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
2007. 12. 19, szerda keltezéssel 15.31-kor Richard Heyes ezt írta: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. yes, for that Return-Path: should be used greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Writing text into images, and setting text size [SOLVED]
Hi Dave, Thanks for the compliment! :) About TTF support in shared hosting... every decent hosting option should support it. Though it is kind of an optional feature, it is as common as GD itself (at least 9 out of 10 CAPTCHA scripts will rely on it). So if TTF support is not installed, the hosting provider should install it. How they should install it is up to them, and varies from system to system. In other words, if TTF support is not installed and your hosting provider is not willing to install it (or wants to charge you for that), either they don't have a clue, or they want to take advantage of your needs... in both cases the service sucks. We use CentOS boxes with DirectAdmin, and installing GD with TTF support is part of the standard setup. You cannot rely on ImageMagick, or the PHP ImageMagick extension being installed, though some hosting companies support it. But GD with TTF, Freetype, JPG and PNG support is pretty standard, like mbstring, cURL, or the sockets extension. Best 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 -Original Message- From: Dave M G [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 19, 2007 7:49 AM To: Andrés Robinet Cc: 'PHP List' Subject: Re: [PHP] Writing text into images, and setting text size [SOLVED] Rob, Thank you for helping me through this. '--enable-gd-native-ttf' '--with-ttf' This was the key information. I thought that having the GD modules installed meant I had TTF support. But after I saw that, I realized that TTF support was a separate module within the GD library. On my home Ubuntu environment, placing TTF support simply meant installing the right package from the repository (which I found in Synaptic by searching for PHP TTF). I'm hoping that TTF support is reasonably common on web hosting services, since I'm aspiring for my code to be portable. In any case, you've helped me get to the point that I needed to get to, so I am very grateful for your support. Thanks. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
Richard Lynch wrote: On Wed, December 19, 2007 4:13 am, Sancar Saran wrote: I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; Don't. You are using global variables, and you might as well admit it and use the 'global' keyword to designate them as such. Poking stuff into $GLOBALS instead just makes it look like you're trying to pretend you're not using global variables when you are, to me. I did form this opinion before altering $GLOBALS was a documented feature. I would have to disagree. Using the global keyword makes it less obvious that the variable your dealing with is in the global scope. Using $GLOBALS instead makes it clear to anyone looking at the code that you're dealing with a global variable. What I would say is that just because you can use global variables in this manner it doesn't mean they're not evil and IMHO they really should be avoided at all costs. I'm yet to come across a *good* reason to use a global variable. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About PHP Implements
On Dec 18, 2007 4:58 PM, Jim Webber [EMAIL PROTECTED] wrote: Hello I have a PHP4 server and I'm trying to figure out how to do implements on classes. Is there an analogous way to do this without PHP5 installed? It isn't inheritance in the same sense as PHP5, but you can use the method_exists() function to check whether a given object has the method you want to use before you try to use it. if (method_exists($obj, 'doSomething')) { $obj-doSomething(); } else { // $obj does not support the required interface } This at least allows a way for your code to enforce the interface on an as-needed basis and recover gracefully. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] control browser with a href tag
I can only say that MY user experience with web apps that TRIED to do the kind of stuff you describe has been a HORRIBLE experience of broken web apps and cross-browser incompatibility and bad UI design that didn't let me do what I needed to do. On Tue, December 18, 2007 11:25 pm, Andrés Robinet wrote: -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 18, 2007 11:57 PM To: Hiep Nguyen Cc: php-general@lists.php.net Subject: Re: [PHP] control browser with a href tag On Tue, December 18, 2007 12:23 pm, Hiep Nguyen wrote: hi friends, i have two pages: list.php and update.php list.php will have a hyper link that when click on, it will open a new window for user to update info. once user clicks update button on update.php page, i want to close update.php and return to list.php. however if user doesn't click update button, i don't want user to go back to list.php. in other word, freeze up list.php until user closes or clicks update button on update.php. is this possible to do with php? It's not even possible with a browser and HTTP, whether PHP is in the picture or not... You're describing a desktop application behaviour. Stop doing that; You'll just make yourself and your users miserable. Write a web application. It's different. Don't popup a new window unless you absolutely have to. If I want a new window, I'll use right-click and do it myself. Don't try to freeze up the list (you can't anyway) cuz I might want to look at other things in the list to decide how to correctly update the original 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? -- I agree on the point that you should not try to achieve the behavior with PHP alone, for the rest of it... I disagree. Why do users have to rethink application behavior? Sure, the web environment is different, there is a clear barrier between client and server... but what do end users have to do with all of that? Moreover, why we, developers, have to rethink UI and application design when we switch from desktop to the web? I think we shouldn't... it's only the legacy stuff we had to tolerate year after year, once the web became a massive thing. But now things are evolving, do things like Web 2.0, Ajax, Adobe Air, Mono, Silverlight, and the .Net Framework sound familiar to you (yes, the last two are created by the crappy M$ that we all know)? Because as far as I can see, an effort is been made everywhere to shorten the desktop-web distance. Why is CSS, XML and JavaScript so popular these days? We hated them some years ago, didn't we? They help to shorten the distance now, don't they? Yes, browsers are a mess to deal with, but they are not as much of a mess as they where some time ago, and we have some good abstraction layers such as PrototypeJS, JQuery and Mootools; and... at least we have now IE 7, which is a big step forward for M$ (despite being buggy as EVERY BROWSER IS), and Firefox and Opera... or are you going to tell me you still use HTML 3, PHP 3, MySQL 2 and put This site looks better in Firefox, Get Firefox Now! buttons in your websites? Have you tried ExtJS or the Yahoo UI?... Why is everyone using this geeky stuff?. I believe we should take the desktop-web distance as a temporary fact that can be fixed to some extent, and keep that in mind... but THAT'S ALL. We must also be prepared for evolution, listen to the trends, and try a bit with the new kids on the block...because evolution will happen, and we'll either be in or out of the standard... because the standard will change. All the above sh_t said to Richard (just an opinion, hope you don't take it wrong), this last paragraph is for the original user. I would search in a JavaScript forum for a way to mask the existing contents, open a DHTML window on top with a form in it, validate the form (maybe Ajax, maybe only JavaScript, it depends on what you need to validate) and then if it passes the test remove the mask and return to the old contents. Otherwise, for a straightforward solution, that makes use of this mask thing give a try to the form components in ExtJS (if you feel like you can handle JavaScript very well... of course). If you don't find your way... then you are not ready and you'd probably better off by creating two pages, so you make the user move from one to the other and back again... so unless the user fills in the correct data, you don't display the original form again, but the data input form every time. A last resort, may involve using a regular pop-up window, but the only way to make it truly modal is in IE for the PC (I think). Happy coding (and read more, so you'll ask better questions ;)) Rob P.S. You'll see no links in this email... but you can use google to find
Re: [PHP] Just to confirm...
On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? You have to accept the reality that standards aren't all that standard, and that way too much software incorrectly, sometimes purposely incorrectly, implements the standards Take that as your starting point, or prepare for a great deal of frustration and down-time. -- 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] Opinion about the using $GLOBALS directly
On Wed, December 19, 2007 8:18 am, Sancar Saran wrote: Thanks for response, I'm using this aproach maybe more than one year. I did not get any problems. there is no real difference between 'global $foo' and $GLOBALS['foo'], and the second is probably more maintainance friendly (as Rob pionted out) Yes you are right writing global $foo in 25+ functions a bit problematic. I don't see a problem with writing global $foo in 25+ functions *IF* the variable really should be a global in the first place -- something ubiquitous to the script as a whole, which is used everywhere, with a distinctive variable name that you will never ever attempt to use for something else. that said, avoid globals like the plague - sometimes you may come up with a situation where using a global is really necessary - such situations should be the exception rather than the rule, often if your thinking of using a global there is another way of doing it. jmho And this is why I'm asking here, WHY I should avoid globals like plague ? Every one says bad. Alright, but no one says WHY ? Because if you have too many 'global' variables running around, sooner or later, you end up using the same variable for two different things, and then suddenly your program misbehaves in ways that are impossible to track down. If you have ONE or TWO global variables, and you use them all the time, and you know not to use that variable name for anything else, *AND* you are not planning to integrate your code with another large chunk of code, you're okay. If you fail any of the above if tests, don't use a global. -- 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] Opinion about the using $GLOBALS directly
On Wed, December 19, 2007 10:14 am, Stut wrote: Richard Lynch wrote: On Wed, December 19, 2007 4:13 am, Sancar Saran wrote: I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; Don't. You are using global variables, and you might as well admit it and use the 'global' keyword to designate them as such. Poking stuff into $GLOBALS instead just makes it look like you're trying to pretend you're not using global variables when you are, to me. I did form this opinion before altering $GLOBALS was a documented feature. I would have to disagree. Using the global keyword makes it less obvious that the variable your dealing with is in the global scope. Using $GLOBALS instead makes it clear to anyone looking at the code that you're dealing with a global variable. Since the global keyword MEANS that the variable is in the global scope, I'm having a hard time seeing how it's less clear that the variable is in the global scope... 'Course I only have *ONE* or *TWO* at most in the first place, so I guess I never have any question about what's in the global scope... -- 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] export data to a ms excel file using php
On Tue, December 18, 2007 3:05 am, abderrazzak nejeoui wrote: can you help me to export data to a ms excel file using php. i tried to export them to an html format and change the extension to .xls that's work but i have lost the formatting excel and the navigator doesn't interpret my code in the same why (celles are not in the same size) There is an Excel writer script in the PEAR site: http://pear.php.net/ Never tried 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] control browser with a href tag
You're definitely going to be using javascript to handle this. The functionality that you are trying to create is a Modal window ( http://en.wikipedia.org/wiki/Modal_window). I create this same type of functionality using jQuery (http://jquery.com/) and Thickbox ( http://jquery.com/demo/thickbox/). You will basically pop up the window in Thickbox, which is really not a new window, just a div that overlays the existing window. You'll also want to make sure you set modal=true. Now the user has to interact with the update.php page that you popped up in the Thickbox before they return to the underlying screen. Tom Friedhof On Dec 18, 2007 10:23 AM, Hiep Nguyen [EMAIL PROTECTED] wrote: hi friends, i have two pages: list.php and update.php list.php will have a hyper link that when click on, it will open a new window for user to update info. once user clicks update button on update.php page, i want to close update.php and return to list.php. however if user doesn't click update button, i don't want user to go back to list.php. in other word, freeze up list.php until user closes or clicks update button on update.php. is this possible to do with php? thanks
Re: [PHP] Opinion about the using $GLOBALS directly
2007. 12. 19, szerda keltezéssel 10.25-kor Richard Lynch ezt írta: On Wed, December 19, 2007 10:14 am, Stut wrote: Richard Lynch wrote: On Wed, December 19, 2007 4:13 am, Sancar Saran wrote: I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; Don't. You are using global variables, and you might as well admit it and use the 'global' keyword to designate them as such. Poking stuff into $GLOBALS instead just makes it look like you're trying to pretend you're not using global variables when you are, to me. I did form this opinion before altering $GLOBALS was a documented feature. I would have to disagree. Using the global keyword makes it less obvious that the variable your dealing with is in the global scope. Using $GLOBALS instead makes it clear to anyone looking at the code that you're dealing with a global variable. Since the global keyword MEANS that the variable is in the global scope, I'm having a hard time seeing how it's less clear that the variable is in the global scope... well, if you have a long and complex function declaration which begins with global $whatever, and then all over the function $whatever is used, some dozens of lines later when looking for something in the code you might not have any idea that $whatever is global... however if you used $GLOBALS['whatever'] everywhere it would be trivial. greets Zoltán Németh 'Course I only have *ONE* or *TWO* at most in the first place, so I guess I never have any question about what's in the global scope... -- 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] Just to confirm...
On Dec 19, 2007 11:18 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? Actual code from a live page of mine. Just because I could. ;-P ? if(!stristr($_SERVER['HTTP_USER_AGENT'],mozilla)) { die(We only allow Mozilla browsers in here!\n); } ? DISCLAIMER: Yes, lawyers, I'm aware that client headers can be forged. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
On Dec 19, 2007 11:53 AM, Daniel Brown [EMAIL PROTECTED] wrote: On Dec 19, 2007 11:18 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? Actual code from a live page of mine. Just because I could. ;-P ? if(!stristr($_SERVER['HTTP_USER_AGENT'],mozilla)) { die(We only allow Mozilla browsers in here!\n); } ? DISCLAIMER: Yes, lawyers, I'm aware that client headers can be forged. Fine, if by Mozilla browsers you mean IE as well, even though it isn't even remotely Mozilla or any derivative thereof. Pretty good at keeping out most bots, though. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
On Dec 19, 2007 11:59 AM, Jim Lucas [EMAIL PROTECTED] wrote: Daniel Brown wrote: On Dec 19, 2007 11:18 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? Actual code from a live page of mine. Just because I could. ;-P ? if(!stristr($_SERVER['HTTP_USER_AGENT'],mozilla)) { die(We only allow Mozilla browsers in here!\n); } ? DISCLAIMER: Yes, lawyers, I'm aware that client headers can be forged. I was just about to say the same thing! If Micro$oft can require Internet Exploder for some pages, damn it, I can require Mozilla for others. ;-P Sincerely, A Biased Mozilla Developer -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
Daniel Brown wrote: On Dec 19, 2007 11:18 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? Actual code from a live page of mine. Just because I could. ;-P ? if(!stristr($_SERVER['HTTP_USER_AGENT'],mozilla)) { die(We only allow Mozilla browsers in here!\n); } ? You could, but you didn't!! This is a typical user agent provided by IE7... Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506) All IE browsers since the beginning of time have sent a user agent containing mozilla. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Opinion about the using $GLOBALS directly
Zoltán Németh wrote: 2007. 12. 19, szerda keltezéssel 10.25-kor Richard Lynch ezt írta: On Wed, December 19, 2007 10:14 am, Stut wrote: Richard Lynch wrote: On Wed, December 19, 2007 4:13 am, Sancar Saran wrote: I want know to you opinions about using $GLOBALS directly. like $GLOBALS['myString'] = 'test'; $GLOBALS['myArray']['this'] = 'this'; $GLOBALS['myArray']['that'] = 'that'; $GLOBALS['myClassObj] = new SomeClass; Don't. You are using global variables, and you might as well admit it and use the 'global' keyword to designate them as such. Poking stuff into $GLOBALS instead just makes it look like you're trying to pretend you're not using global variables when you are, to me. I did form this opinion before altering $GLOBALS was a documented feature. I would have to disagree. Using the global keyword makes it less obvious that the variable your dealing with is in the global scope. Using $GLOBALS instead makes it clear to anyone looking at the code that you're dealing with a global variable. Since the global keyword MEANS that the variable is in the global scope, I'm having a hard time seeing how it's less clear that the variable is in the global scope... well, if you have a long and complex function declaration which begins with global $whatever, and then all over the function $whatever is used, some dozens of lines later when looking for something in the code you might not have any idea that $whatever is global... however if you used $GLOBALS['whatever'] everywhere it would be trivial. Indeed. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just to confirm...
On Dec 19, 2007 12:26 PM, Stut [EMAIL PROTECTED] wrote: Daniel Brown wrote: On Dec 19, 2007 11:18 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? Actual code from a live page of mine. Just because I could. ;-P ? if(!stristr($_SERVER['HTTP_USER_AGENT'],mozilla)) { die(We only allow Mozilla browsers in here!\n); } ? You could, but you didn't!! This is a typical user agent provided by IE7... Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506) All IE browsers since the beginning of time have sent a user agent containing mozilla. Bah! You're right, I changed it to just be an easter egg in the code. The original (now commented out) was: ? if(stristr($_SERVER['HTTP_USER_AGENT'],msie)) { die(No friend of Internet Exploder is a friend of mine.); } ? It initially started to try to stop cURL, wget, Lynx, and other automated clients from grabbing the content from the page. Again, I know that headers can be spoofed, but that's a different topic. I try to make a joke and Stut shoots me in the ass. ;-P -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About PHP Implements
On Dec 19, 2007 11:17 AM, Andrew Ballard [EMAIL PROTECTED] wrote: On Dec 18, 2007 4:58 PM, Jim Webber [EMAIL PROTECTED] wrote: Hello I have a PHP4 server and I'm trying to figure out how to do implements on classes. Is there an analogous way to do this without PHP5 installed? It isn't inheritance in the same sense as PHP5, but you can use the method_exists() function to check whether a given object has the method you want to use before you try to use it. if (method_exists($obj, 'doSomething')) { $obj-doSomething(); } else { // $obj does not support the required interface } This at least allows a way for your code to enforce the interface on an as-needed basis and recover gracefully. this is indeed the best, if not only, way to emulate interfaces in php4; i believe this was recommended some time back as well. -nathan
Re: [PHP] Just to confirm...
Daniel Brown wrote: On Dec 19, 2007 11:18 AM, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, December 19, 2007 9:31 am, Richard Heyes wrote: I think that any MTA or client that doesn't work with the Reply-To header isn't worth beans. very very true Well the Reply-To: header isn't for bounces. The OP was asking about Return-path, not Reply-to Furthermore, while the MTA/client/MUA may not be worth beans, that doesn't mean nobody is using it. I don't think any MS products are worth beans; Yet many people are using them. Should I not bother to check IE compatibility? Actual code from a live page of mine. Just because I could. ;-P ? if(!stristr($_SERVER['HTTP_USER_AGENT'],mozilla)) { die(We only allow Mozilla browsers in here!\n); } ? DISCLAIMER: Yes, lawyers, I'm aware that client headers can be forged. I was just about to say the same thing! -- 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
[PHP] a bit OT - Does XMLHTTP work with Digest Authentication?
I've been searching all over MSDN for this info, but can't find anything. I have a script under a directory protected by HTTP Digest authentication. This is an Apache server on Linux. When I try to access the script through ajax using the XMLHttpRequest object, everything is fine in all browsers including IE 7, which uses XMLHttpRequest. In IE 6 and below, using Microsoft.XMLHTTP, the connection fails. HttpStatus returns an odd number (it's five digits) and the responseText and responseXML properties are empty. I'm embedding the username and password according to the open() method spec: xmlhttp.open('GET', 'script/path', true, 'username', 'password'); I originally wrote the responses and checks in PHP using the example given in the HTTP Authentication section of the manual, but switched to .htaccess, thinking it was a problem. It didn't help. However, when I switched the AuthType to Basic, IE 6 worked fine. Does anyone have any experience using XMLHTTP with digest authentication that can shed some light on this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using require instead of redirect architecture
Maybe I'm too old a dog to teach a new trick to. I've got the redirect example discussed a couple days ago working nicely. Back, Refresh, 'wrong username' - all work nicely. But I like the idea of reducing the load on the server, maybe alleviating some redirect pinball. So been trying to use require instead, and all hell has broken loose. Clearly I'm not structuring these pages correctly, but I've run into a conceptual wall of what I should be doing. p1.php: - display form - post to p2.php p2. php - grab and validate input - if good, require p3.php (which says congrats!) - if bad, set error message and require p1.php (which displays error msg and displays form again) Problems: - hitting back on p2.php shows the dreaded The page you are trying to view contains POST... -- OK and Cancel both generated unsatisfactory results - hitting refresh on p2.php runs the validation again, which means the validation code now has to be that much more complicated to trap for a second attempt, blah blah blah. So the architecture needs to look different. Been hitting my head against a wall - I'll be darned if I can figure out what it is. -- RE, Chicago -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using require instead of redirect architecture
Robert Erbaron wrote: Maybe I'm too old a dog to teach a new trick to. I've got the redirect example discussed a couple days ago working nicely. Back, Refresh, 'wrong username' - all work nicely. But I like the idea of reducing the load on the server, maybe alleviating some redirect pinball. So been trying to use require instead, and all hell has broken loose. Clearly I'm not structuring these pages correctly, but I've run into a conceptual wall of what I should be doing. p1.php: - display form - post to p2.php p2. php - grab and validate input - if good, require p3.php (which says congrats!) - if bad, set error message and require p1.php (which displays error msg and displays form again) Problems: - hitting back on p2.php shows the dreaded The page you are trying to view contains POST... -- OK and Cancel both generated unsatisfactory results - hitting refresh on p2.php runs the validation again, which means the validation code now has to be that much more complicated to trap for a second attempt, blah blah blah. So the architecture needs to look different. Been hitting my head against a wall - I'll be darned if I can figure out what it is. Personally, I could see two solutions. 1. p1.php would post to itself. Do data validation. After data validation upon error, include p1.php again with included error messages upon success, redirect to p3.php with congrats. 2. p1.php would post to p2. perform data validation. upon error, save data into session variable, redirect back to p1.php, display error messages inline upon success, redirect to p3.php, display congrats I personally like the second option. It is cleaner. Each page/script has a single purpose in life. It just makes better sense to my small little mind. -- 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] Using require instead of redirect architecture
1. p1.php would post to itself. Do data validation. After data validation upon error, include p1.php again with included error messages upon success, redirect to p3.php with congrats. Yeah, I could do this, but it uses a redirect, and like you said, it's gnarly. 2. p1.php would post to p2. perform data validation. upon error, save data into session variable, redirect back to p1.php, display error messages inline upon success, redirect to p3.php, display congrats I've already got this working, per thread of a couple days ago. But it uses a redirect. I personally like the second option. It is cleaner. Each page/script has a single purpose in life. It just makes better sense to my small little mind. I agree as well. But I'm trying to get away from multiple trips to the server for simple page calls, per some pundits on the list. :) So I'm trying to learn a different architecture, and I'm not getting it yet. -- RE, Chicago -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Change case of HTML tags
I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph
[PHP] Change case of HTML tags
I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph
Re: [PHP] Using require instead of redirect architecture
Robert Erbaron [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 1. p1.php would post to itself. Do data validation. After data validation upon error, include p1.php again with included error messages upon success, redirect to p3.php with congrats. Yeah, I could do this, but it uses a redirect, and like you said, it's gnarly. 2. p1.php would post to p2. perform data validation. upon error, save data into session variable, redirect back to p1.php, display error messages inline upon success, redirect to p3.php, display congrats I've already got this working, per thread of a couple days ago. But it uses a redirect. I personally like the second option. It is cleaner. Each page/script has a single purpose in life. It just makes better sense to my small little mind. I agree as well. But I'm trying to get away from multiple trips to the server for simple page calls, per some pundits on the list. :) So I'm trying to learn a different architecture, and I'm not getting it yet. -- RE, Chicago Well, I would tend to agree with Jim, the second suggestion he had is the way I've seen this problem done the most. It works, it's simple and this way you have one less PHP file, just enter your data and congratulations. The load to the server shouldn't be any different if you did it the way you suggested. Oh, well just my opinion. - Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using require instead of redirect architecture
On Dec 19, 2007 3:55 PM, Robert Erbaron [EMAIL PROTECTED] wrote: 1. p1.php would post to itself. Do data validation. After data validation upon error, include p1.php again with included error messages upon success, redirect to p3.php with congrats. Yeah, I could do this, but it uses a redirect, and like you said, it's gnarly. the post to itself is a good idea; and there is nothing wrong with having another script as the 'welcome' script or w/e. in order to avoid a redirect in this case you could simply have an include directive. eg. if($wasLoginSuccessul) { include('welcome.php'); die; } not something i would do in a complex system, but in a simple system, for-sure. I agree as well. But I'm trying to get away from multiple trips to the server for simple page calls, per some pundits on the list. :) So I'm trying to learn a different architecture, and I'm not getting it yet. one thing i think of to mention is that each php script does not have to be one that is accessible by an end user. you can have 'back-end' scripts that do all sorts of stuff. validation for example.. you might have a class, something roughly like ?php class DataValidator { public static function isEmailAddress($potentialEmailAddress) { // regex to determine if $potentialEmailAddress is valid return $isEmailAddressValid; } public static function isUsernameAcceptable($potentialUsername) { // etc.. return $isUsernameAcceptable; } } ? clearly this is not a script a user will access through the browser. in fact these are the sort of scripts i usually stash away in /usr/share/php5/someProject anyway, this is the best sort of generic advice i can give you on a solid 'architecture'. if all your scripts are designed with the premise of being accessed directly from a client browser youll be building a house of cards. -nathan
Re: [PHP] Change case of HTML tags
If you're using PHP5, you can use the tidy functions - http://us2.php.net/tidy. The default settings output html tags in lower-case. For tidy config settings, see http://tidy.sourceforge.net/docs/quickref.html Brady On Dec 19, 2007 1:10 PM, Christoph Boget [EMAIL PROTECTED] wrote: I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change case of HTML tags
On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote: I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph ? $s = EOD HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML EOD; $s = preg_replace('/(.*)/Ue',strtolower('$1'),$s); echo $s.\n; ? -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change case of HTML tags
Daniel Brown wrote: On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote: I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph ? $s = EOD HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML EOD; $s = preg_replace('/(.*)/Ue',strtolower('$1'),$s); Nice use of the 'e' modifier, but would it not be safer to use this? $s = preg_replace('/(.*)/U', strtolower($1), $s); This way the arbitrary html is not executed? echo $s.\n; ? -- 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] Change case of HTML tags
On Dec 19, 2007 6:08 PM, Jim Lucas [EMAIL PROTECTED] wrote: Daniel Brown wrote: On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote: I've been looking through the docs but haven't found an internal function that does what I'm looking for. Perhaps I missed it? Or perhaps someone can point me in the right direction? I'm looking for a routine that will convert tags to lower case. For example, if I have HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML I want to convert only the tags to lower case. So HTML becomes html and so on; I don't want anything else touched. This may seem kind of silly but I'm working with an XMLDocument object in javascript and when I serialize it to string format, for some reason all the tags are made into uppercase. I'm taking the serialized string, posting it back to the server and using it on the back end. I figure that since I can make it so that the serialized string is lower case on the front end, perhaps I can convert it on the back. Any ideas/pointers? thnx, Christoph ? $s = EOD HTML HEAD TITLEThis is the Page Title/TITLE /HEAD Body Here is the Page Text /Body /HTML EOD; $s = preg_replace('/(.*)/Ue',strtolower('$1'),$s); Nice use of the 'e' modifier, but would it not be safer to use this? $s = preg_replace('/(.*)/U', strtolower($1), $s); This way the arbitrary html is not executed? echo $s.\n; ? That won't work because preg_replace() doesn't know to evaluate the output of strtolower(). At least in my test case that's how it works. -- PHP 5.2.4 (cli) -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] About PHP Implements
Andrew Ballard wrote: On Dec 18, 2007 4:58 PM, Jim Webber [EMAIL PROTECTED] wrote: Hello I have a PHP4 server and I'm trying to figure out how to do implements on classes. Is there an analogous way to do this without PHP5 installed? It isn't inheritance in the same sense as PHP5, but you can use the method_exists() function to check whether a given object has the method you want to use before you try to use it. if (method_exists($obj, 'doSomething')) { $obj-doSomething(); } else { // $obj does not support the required interface } but that means you have to change all the calling functions, which becomes a real PITA. I think you could do something with the constructor but how well it works I don't know :) class x { function x() { $required_methods = array('a','b','c'); foreach ($required_methods as $req) { if (!method_exists($this, $req)) { die(You need to create $req method for class . get_class($this)); } } } } -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)
hi guys, well having tried for countless hours to build php on leopard I pretty much gave up. apparently it's pretty much impossible unless your name is Marc Liyanage (entropy.ch) ... the problem lies with the fact that you need 64bit libs and the some (most notably iconv) of the libs included with Leopard are borked in respect to the 'universal build' stuff (which I gather means you actually have a number of different [architecture related] executables bundled into a single file ... I probably have that all wrong, to be honest it's a little over my head. Marc L. offers a tarball with a working php5.2.5 (just untar and move the php5 dir to /usr/local): http://www2.entropy.ch/download/php5-5.2.5.leopard.release1.tar.gz his build does work but it doesn't include one extension that I rely on for some of my projects, namely interbase. I figured I'd try using Marc' configure line (as given by /usr/local/php5/bin/php-config against the source of php5.2.5 that I downloaded and add the relevant configure option (--with-interbase[=DIR]) ... in the hope I at least get a couple of usable extensions so that I could copy the ibase extension over into the working php5.2.5 installation ... no joy. I figure I'm screwed - I have a painfully expensive dev machine I can't blooming use. oh well, at least it is the nicest looking paper weight I've got. I'm still wondering whether it's possible to build just the interbase extension ... anyone know how to do that? or have any tips? rgds, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?
On 11-Dec-07, at 2:13 PM, Per Jessen wrote: René Fournier wrote: However, the number of socket clients connecting in the past 3-4 months has steadily increased, and this seems to have exposed (if not created) a strange performance issue with PHP 5.2.4, MySQL 5.0.45 and/or Mac OS X Server 10.4.11. (I say and/or because I am unsure where the problem's cause really lies.) Basically, after the script has been running for a day or so (processing essentially the amount data that used to take two weeks), the CPU usage of the machine goes from 30% (normal) to 80-90%. Have you tried stracing it to see what's really happening when the load goes that high? Good advice, since I think there's nothing left for me to do but inspect the MySQL process. Incidentally, I've made some changes to the script a week ago, which has seemed to improve the situation somewhat. Now, the script has run for nearly 7 days without interruption or high CPU load. Problem solved? Again this morning, I noticed CPU went up to 90% and is staying there. (Previously, this would happen after 1-2 days.) The number of distinct MySQL connections remains low, since the script (which runs in a loop, with a sleep(1) and a timeout on the stream_socket_select()), only creates one MySQL connection in the beginning. All MySQL queries run through that. The script has run for 6-7 days, during which time it's executed 2.7 million queries (mostly SELECTs) and created 105,198 external, short- lived child processes (each lasts about a second or two, then closes after mysql_close())--I don't think this is an issue. Memory usage seems okay. By the end of 7 days, the script's memory usage has peaked at 4MB (out of 16MB max). Typically it's around 3MB. MySQL memory usage doesn't seem to be a constraint. I'm using my- huge.cnf, and the nature of the queries is fairly regular. I would say that the database structure is not an issue (though I could be wrong!)--everything is pretty well normalized and indexed. I'm logging slow queries, non-indexed SELECTs, etc. I'm really not sure what to try next. ps -aux shows MySQL as hogging the CPU, not PHP or Terminal: PID COMMAND %CPU TIME #TH #PRTS #MREGS RPRVT RSHRD RSIZE VSIZE 342 mysqld 83.3% 16:13:19 33 125 139 435M 4.75M 439M 539M 385 Terminal 4.7% 5:36:35 22 184 251 20.1M 33.5M 28.8M+ 256M 1190 php 4.3% 3:13:33 1 15 148 6.51M 8.15M 12.1M 89.0M 0 kernel_tas 1.3% 2:02:40 47 2 619 5.00M- 0B 219M- 1.26G- It's really strange and strangely consistent. The script will run for a few million cycles, whereupon MySQL suddenly uses 50% more CPU. But for what? I'm looking at tutorials on ktrace and kdump to see what I can learn from MySQL. I wonder if I would have this problem under Linux... ...Rene
Re: [PHP] Using require instead of redirect architecture
On Wed, 2007-12-19 at 14:23 -0700, Dan wrote: Robert Erbaron [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 1. p1.php would post to itself. Do data validation. After data validation upon error, include p1.php again with included error messages upon success, redirect to p3.php with congrats. Yeah, I could do this, but it uses a redirect, and like you said, it's gnarly. 2. p1.php would post to p2. perform data validation. upon error, save data into session variable, redirect back to p1.php, display error messages inline upon success, redirect to p3.php, display congrats I've already got this working, per thread of a couple days ago. But it uses a redirect. I personally like the second option. It is cleaner. Each page/script has a single purpose in life. It just makes better sense to my small little mind. I agree as well. But I'm trying to get away from multiple trips to the server for simple page calls, per some pundits on the list. :) So I'm trying to learn a different architecture, and I'm not getting it yet. -- RE, Chicago Well, I would tend to agree with Jim, the second suggestion he had is the way I've seen this problem done the most. It works, it's simple and this way you have one less PHP file, just enter your data and congratulations. The load to the server shouldn't be any different if you did it the way you suggested. Oh, well just my opinion. Sorry, but option one is superior YMMV :B Page posts to itself, everything is already there, all the values posted, the form description, associated validation etc. Then if successful you redirect to the next logical page. Mind you, I assign predefined validation routines, or custom handlers to the form before it is rendered so it all makes sense to be in one place. Custom validators are pulled in as needed from their own separate controller. I used the other technique many years ago and I found it to be a hassle. Cheers, Rob. -- ... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assign variable to a block of html code
What you have will work, you just need to escape out the double quotes in the html. On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote: Hi All, Is it possible to assign variable to a block of html code ? Something like this : $myblokvar = table width=487 border=0 cellspacing=0 cellpadding=0 tr tdtable width=487 border=0 cellspacing=0 cellpadding=0 tr tdimg src=images/bartitle_login.gif alt=Login width=475 height=30 //td tdnbsp;/td /tr tr td class=produktable width=100% border=0 cellpadding=3 cellspacing=2 tr td class=katalog ?=$log_info? /td /tr /table/td tdnbsp;/td /tr tr td class=produknbsp;/td tdnbsp;/td /tr /table/td /tr /table ; Although example above is not working, what I want to achieve is something like that. Is it possible how can I do that ? Regards, Feris -- Stephen Johnson The Lone Coder http://www.ouradoptionblog.com *Join us on our adoption journey* [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a bit OT - Does XMLHTTP work with Digest Authentication?
On Dec 19, 2007 10:24 AM, Shu-Wai Chow [EMAIL PROTECTED] wrote: I've been searching all over MSDN for this info, but can't find anything. I have a script under a directory protected by HTTP Digest authentication. This is an Apache server on Linux. When I try to access the script through ajax using the XMLHttpRequest object, everything is fine in all browsers including IE 7, which uses XMLHttpRequest. In IE 6 and below, using Microsoft.XMLHTTP, the connection fails. HttpStatus returns an odd number (it's five digits) and the responseText and responseXML properties are empty. I'm embedding the username and password according to the open() method spec: xmlhttp.open('GET', 'script/path', true, 'username', 'password'); I originally wrote the responses and checks in PHP using the example given in the HTTP Authentication section of the manual, but switched to .htaccess, thinking it was a problem. It didn't help. However, when I switched the AuthType to Basic, IE 6 worked fine. Does anyone have any experience using XMLHTTP with digest authentication that can shed some light on this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I've run into this problem before... Try searching Google with the five-digit status code. It's one of Microsoft's non-standard codes... -Casey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Profiling PHP App
Hi All, Is there any tool to profiling PHP app ? Regards, Feris
[PHP] Re: [PHP-DB] Credit Card Encryption
When it comes to liability, who is liable, the merchant running the system, the develper that created the system, or both? If the develper is included, would that be mitigated in that he created the system to the merchant's specifications? Also, in terms of the developer, would this be covered under errors and omissions insurance, or would they take the position that the developer should have known better and was negligent in creating a non-compliant system leaving the developer on the hook for damages? Unfortunately, I'd argue that he who has the best lawyers wins. -- RE, Chicago -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Profiling PHP App
On Thu, 2007-12-20 at 11:21 +0700, php mail wrote: Is there any tool to profiling PHP app ? Yes, there are a few. The best that I have found anyway, is Xdebug 2 (http://pecl.php.net/xdebug). It can also integrate nicely with PHPUnit as well to do code coverage as well as make your life generally more enjoyable. --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] Profiling PHP App
php mail wrote: Hi All, Is there any tool to profiling PHP app ? http://www.xdebug.org/docs/profiler -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Assign variable to a block of html code
You should try the HEREDOC structure. See link: http://php.net/heredoc It should look to something like: $myblokvar = EOF table blabla tr td Welcome $name to this website! /td /tr /table EOF; No need of quotes or php start/end tags when placing a variable. To use it afterwards simply call the $mylokvar variable. Hope it helped! Xavier Web Developer Site: www.eds.mu -Original Message- From: Stephen Johnson [mailto:[EMAIL PROTECTED] Sent: jeudi 20 décembre 2007 07:43 To: php mail; PHP General List Subject: Re: [PHP] Assign variable to a block of html code What you have will work, you just need to escape out the double quotes in the html. On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote: Hi All, Is it possible to assign variable to a block of html code ? Something like this : $myblokvar = table width=487 border=0 cellspacing=0 cellpadding=0 tr tdtable width=487 border=0 cellspacing=0 cellpadding=0 tr tdimg src=images/bartitle_login.gif alt=Login width=475 height=30 //td tdnbsp;/td /tr tr td class=produktable width=100% border=0 cellpadding=3 cellspacing=2 tr td class=katalog ?=$log_info? /td /tr /table/td tdnbsp;/td /tr tr td class=produknbsp;/td tdnbsp;/td /tr /table/td /tr /table ; Although example above is not working, what I want to achieve is something like that. Is it possible how can I do that ? Regards, Feris -- Stephen Johnson The Lone Coder http://www.ouradoptionblog.com *Join us on our adoption journey* [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php