php-general Digest 29 Sep 2005 08:44:59 -0000 Issue 3709
php-general Digest 29 Sep 2005 08:44:59 - Issue 3709 Topics (messages 223384 through 223391): Re: Strange behaviour overriding methods in 5.0.4 223384 by: mail 223388 by: Jochem Maas 223389 by: Rob Agar 223391 by: mail Re: bad use of foreach() when building xml str from xml tree(source code provided here). 223385 by: Scott Fletcher Re: ODBC and DB2 functions (PDO_ODBC) 223386 by: Oscar Gosdinski Re: Array - partical path to the array's path (part 2) 223387 by: Jochem Maas Re: mail function-new line-security 223390 by: Torgny Bjers Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- Norbert Wenzel wrote: Hi, i have a very strange example of code. Maybe you know where my mistake could be. I've got an index.php with a few div's and a short php code, like: divecho $_SESSION['view']-getContent();/div The view is in every case one of my view objects. And there's the problem. In my specific case $_SESSION['view'] is of class NoLoggedUserView, which of course extends View. The View class containts a few public methods, namely getTitle() getHeadline() getSelection() getSubselection() getContentHeadline() getContent() getFunctions() The child class NoLoggedUserView contains only the getContent()-method, which provides a login window. But of course I still call all the other methods like getTitle() in my index.php. Until yesterday I encountered no problems with that, but today, if i call $noLoggedUserView-getTitle() in the index.php i get an empty document. No error, no warning, no notice ... nothing. The page stays the same and doesn't change. Even the timestamp I print out to check if there has been a change, doesn't change. I tested a few things: The page loads fine and without any problems, if the public method getTitle() is written in the NoLoggedUserView and the method returns a stupid string. If getTitle() in NoLoggedUserView looks like this did you try letting the parent class method just return a string constant? The method in parent class just returns a string constant. I'm at home right no, but as far as I remeber it looks pretty much like this: public function getTitle() { //in parent class View return 'My Company:'; } public function getTitle() { return parent::getTitle(); } there is the same problem as before. I get an empty page, no changes are made. My current version of getTitle() looks like this: current version in NoLoggedUserView I presume, whats the definition in the parent class? yes, in no logged user view. See the parent class above. public function getTitle() { //return 'NoLoggedTitle'; // works great //return parent::getTitle(); // no changes are made what if there is no parent? there is, because it's just a test to see if i get this working. until yesterday i just called $_SESSION['view']-getTitle() and since this was an instance of View the method should be at least available in View. $classname = get_parent_class($this); $v = new $classname(); now just imagine if: $classname === false see message above, it's just to make the page working. return $v-getTitle(); // works great } And again, this strange thing works. So what could cause php to act like this? Any ideas or suggestions or at least assumptions? Please, I really don't know where to search the mistake.. use a shed load of echo(), print_r() and/or var_dump() to see what stufff is and how far along the execution gets - I do it now and again when I have bumped into another segfault. i.e. do stuff like echo 1,br; // your code here echo 2,br; // your code here echo 3,br; I would like to do so, but the page doesn't even load a blank page on error. the page stays the same as it was before, so if do reload nothing happens, just as if the page doesn't get compiled or so. but then again, if i change the page, so it doesn't need to call any parent:: stuff, it compiles and loads without any errors. so it looks like the page isn't even compiled when calling parent:: ... ---End Message--- ---BeginMessage--- mail wrote: Norbert Wenzel wrote: Hi, i have a very strange example of code. Maybe you know where my mistake could be. I've got an index.php with a few div's and a short php code, like: divecho $_SESSION['view']-getContent();/div The view is in every case one of my view objects. And there's the problem. In my specific case $_SESSION['view'] is of class NoLoggedUserView, which of course extends View. The View class containts a few public methods, namely getTitle() getHeadline() getSelection()
php-general Digest 29 Sep 2005 21:45:41 -0000 Issue 3710
php-general Digest 29 Sep 2005 21:45:41 - Issue 3710 Topics (messages 223392 through 223430): Re: Array Select from database 223392 by: Robin Vickery Functions Returning large strings 223393 by: zzapper 223397 by: Andy Pieters 223402 by: zzapper imap_mail and outgoing mailserver configurations 223394 by: Lars Demel Re: Error with DOMDocument-saveXML() 223395 by: Andy Pieters 223410 by: Stephen Leaf 223416 by: Scott Fletcher 223420 by: Stephen Leaf 223421 by: Stephen Leaf Re: Strange behaviour overriding methods in 5.0.4 223396 by: Jochem Maas Re: Object Function-call handling in PHP5 223398 by: DarkX updating forms 223399 by: hope 223400 by: Norbert Wenzel 223401 by: Norbert Wenzel Problems with new PHP install 223403 by: Chris Boget 223404 by: Jay Blanchard 223406 by: Chris Boget 223407 by: John Nichel 223408 by: John Nichel 223409 by: Chris Boget 223412 by: Jay Blanchard 223413 by: Chris Boget 223414 by: John Nichel 223415 by: Jay Blanchard Re: Array - partical path to the array's path (part 2) 223405 by: Scott Fletcher Array: how to find a parent key when using a child key? 223411 by: Scott Fletcher decrypting query string back into $_GET['var'] 223417 by: Graham Anderson 223418 by: Jochem Maas 223419 by: Graham Anderson Mixing PHP VBSCript 223422 by: Jay Blanchard 223423 by: Chris W. Parker 223428 by: Miles Thompson 223429 by: Jay Blanchard 223430 by: Satyam php search engine 223424 by: Ross 223427 by: John Nichel PHP and Active Directory 223425 by: Miretsky, Anya Re: PDF Thumbnails 223426 by: Matt Darby Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- On 9/28/05, Silvio Porcellana [EMAIL PROTECTED] wrote: In addiction, I would (SQL)escape the values joined: supposing you are using MySQL, I'd do: $values = join(', ', array_map('mysql_real_escape_string', $array)); I agree entirely; I was just trying to keep things simple for the OP. -robin ---End Message--- ---BeginMessage--- Hi, I have a series of nested functions which return a large string (as apposed to working on global string) , is this inefficient? Or is PHP clever enough to just pass a pointer? to simplify $large_string=fn_one(fn_two(fn_three(; your advice pls -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ ---End Message--- ---BeginMessage--- Hi I have a series of nested functions which return a large string (as apposed to working on global string) , is this inefficient? Or is PHP clever enough to just pass a pointer? $large_string=fn_one(fn_two(fn_three(; PHP is by no means cleaver enough to read your mind as to what you want it to do. If you want to pass pointers instead of strings then do as this function one($buffer) { #processing, return true/false based on success, put result in buffer } function two($buffer) { #processing,... } Then do like this: $variable='input value'; if(one($variable)) if(two($variable)) echo Result: $variable; HTH Andy -- Registered Linux User Number 379093 Now listening to [silence] amaroK::the Coolest Media Player in the known Universe! Cockroaches and socialites are the only things that can stay up all night and eat anything. Herb Caen -- -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- pgpEbsC3TVEQs.pgp Description: PGP signature ---End Message--- ---BeginMessage--- On Thu, 29 Sep 2005 11:48:10 +0200, wrote: Hi I have a series of nested functions which recursively return a large string (as apposed to working on global string) , is this inefficient? Or is PHP clever enough to just pass a pointer? $large_string=fn_one(fn_two(fn_three($some_long_string; PHP is by no means clever enough to read your mind as to what you want it to do. No slight meant to PHP, just wanted to know whether I had to worry about it, according to your reply seems like I must. -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ ---End Message--- ---BeginMessage--- hi, i
Re: [PHP] mail function-new line-security
Peppy wrote: AJ, So what your reply means is that I should not have a new line character in any variable on my page??? Of course you can have newlines in your email message, just make sure that any user input is received through POST, and that you run a regular expression to validate that only one email has been specified in the recipient field (whatever you call that on your form I don't know) to ensure that it is only sent to one person. Other than that you ought to be pretty secure. Make sure that the user cannot enter any type of header information in the beginning of their message, so, for instance you could do what you did: $usermailmsg = This is the information you submitted.\n // ... It will ensure that other text appears before the user submitted data. Hope that helps. Regards, Torgny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange behaviour overriding methods in 5.0.4
I have to say thank you to you both. In fact I still don't know what exactly was wrong or may have caused this error (output buffering was off, and there was no @ in the whole file) but after a night of sleep I tried again before reinstalling the server and everything worked as fine as it should. It's quite strange, since I was the last one in company yesterday and locked it myself, but maybe some tiny little imps fixed the problem by night. And to dissapoint you Jochem (at least I think it was you), it is a Red Hat System, no Windows. Thanks for your help and greetings from Vienna, Norbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array Select from database
On 9/28/05, Silvio Porcellana [EMAIL PROTECTED] wrote: In addiction, I would (SQL)escape the values joined: supposing you are using MySQL, I'd do: $values = join(', ', array_map('mysql_real_escape_string', $array)); I agree entirely; I was just trying to keep things simple for the OP. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Functions Returning large strings
Hi, I have a series of nested functions which return a large string (as apposed to working on global string) , is this inefficient? Or is PHP clever enough to just pass a pointer? to simplify $large_string=fn_one(fn_two(fn_three(; your advice pls -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imap_mail and outgoing mailserver configurations
hi, i have a problem with imap_mail. the mails i always send with this function contents in the header field 'from' always the server where php is installed. in our system php and the mail server are installed on different machines. so i think that might be the problem. but we configured in the php.ini the outgoing mailserver (smtp section of course). Does anybody could help us to fix the problem to use the right outgoing mail server??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
Hi bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / That's just what it says, check your program flow. You overrided the tostring function and somewhere in that new function you jump out of it because of a flag that is set, and thus not returning anything, which is equal to return null. I've not checked my E_NOTICE's yet.. actually not quite sure how to turn One way would be to use .htaccess files, but I have included in all my programs (read sites) a mechanism for this. Have one file where you keep all the varialbes that you need accross the different pages (scripts), and then on all your files, put this on the top: if(!(defined('GLOBALS_LOADED'))) require_once 'scripts/globals.php'; #be sure to set relative path to globals if(defined('DEBUG_LVL')) error_reporting(DEBUG_LVL); else error_reporting(0); Then in your file globals.php you need to have at least this: ?php define('GLOBALS_LOADED',true); define('DEBUG_LVL',E_ALL); ? Once you go to production, all you need to do is change the E_ALL to 0 and all the pages follow suit... HTH Andy -- Registered Linux User Number 379093 Now listening to Radio Stream amaroK::the Coolest Media Player in the known Universe! Cockroaches and socialites are the only things that can stay up all night and eat anything. Herb Caen -- -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- pgpH2F3Wp9agY.pgp Description: PGP signature
Re: [PHP] Strange behaviour overriding methods in 5.0.4
Norbert Wenzel wrote: I have to say thank you to you both. In fact I still don't know what exactly was wrong or may have caused this error (output buffering was off, and there was no @ in the whole file) but after a night of sleep I tried again before reinstalling the server and everything worked as fine as it should. It's quite strange, since I was the last one in company yesterday and locked it myself, but maybe some tiny little imps fixed the problem by night. And to dissapoint you Jochem (at least I think it was you), it is a Red Hat System, no Windows. you do realise RedHat is the 'Windows' of the Linux world ;-) hey your on Linux whats to disappoint :-) Thanks for your help and greetings from Vienna, Norbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Functions Returning large strings
Hi I have a series of nested functions which return a large string (as apposed to working on global string) , is this inefficient? Or is PHP clever enough to just pass a pointer? $large_string=fn_one(fn_two(fn_three(; PHP is by no means cleaver enough to read your mind as to what you want it to do. If you want to pass pointers instead of strings then do as this function one($buffer) { #processing, return true/false based on success, put result in buffer } function two($buffer) { #processing,... } Then do like this: $variable='input value'; if(one($variable)) if(two($variable)) echo Result: $variable; HTH Andy -- Registered Linux User Number 379093 Now listening to [silence] amaroK::the Coolest Media Player in the known Universe! Cockroaches and socialites are the only things that can stay up all night and eat anything. Herb Caen -- -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- pgphHcBjoE1mU.pgp Description: PGP signature
[PHP] Re: Object Function-call handling in PHP5
Thats what im looking for pretty much, Ill keep my eye on that bug. Thanks! On 9/28/05, Ondrej Ivanič [EMAIL PROTECTED] wrote: Dmitry committed a path for improved __toString() support. However, im not sure if it will be PHP6 only... I know about this patch. I think, it will be PHP6 only. -- Ondrej Ivanic ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -BEGIN PGP MESSAGE- The One and Only DarkX -END PGP MESSAGE- -BEGIN PGP SIGNATURE owGbwMvMwCRoO3M+/7fM0iLG07JJDE4vrReHZKQq+OelKiTmpQDpnEoFl8Si7Aiu DntmVpD8BpgGQabIGob5ToUFGnFlWgz8cj6zPulrPMrfdI2ZYX7wx/++aeWli6aY 7ZqsahKeKc789DAA =k1EI -END PGP SIGNATURE-
[PHP] updating forms
i have a text area on my page. As page is uploaded it displays certain text in it. It has also has a text area with same text that is being displayed above in the page . If user changes this text of text area n presses submit button the page needs to display updated text in the text area and as well as updated text above in the page. 2ndly the text area must display text alogwith tags e.g h1headingh1 this goes text but above in the page these tags must like h1 /h1 mustnt be displayed instead the heading word must become of h1 format. how can i get all tags like br h1 etc. as enterd by user coz if i get it on next page n save it database, the next time wen i wil dsiplay there wil be no brs . n how to update the page n display updated text? regards hope -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: updating forms
(hope) wrote: i have a text area on my page. As page is uploaded it displays certain text in it. It has also has a text area with same text that is being displayed above in the page . If user changes this text of text area n presses submit button the page needs to display updated text in the text area and as well as updated text above in the page. 2ndly the text area must display text alogwith tags e.g h1headingh1 this goes text but above in the page these tags must like h1 /h1 mustnt be displayed instead the heading word must become of h1 format. how can i get all tags like br h1 etc. as enterd by user coz if i get it on next page n save it database, the next time wen i wil dsiplay there wil be no brs . n how to update the page n display updated text? regards hope see functions htmlentities() or htmlspecialchars() to replace with lt; and so on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Functions Returning large strings
On Thu, 29 Sep 2005 11:48:10 +0200, wrote: Hi I have a series of nested functions which recursively return a large string (as apposed to working on global string) , is this inefficient? Or is PHP clever enough to just pass a pointer? $large_string=fn_one(fn_two(fn_three($some_long_string; PHP is by no means clever enough to read your mind as to what you want it to do. No slight meant to PHP, just wanted to know whether I had to worry about it, according to your reply seems like I must. -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with new PHP install
Since I was having so much difficulty getting PHP (with libxml2) installed on RH9, I decided to take the advice given by several people and use Fedora Core 4 instead, which I get installed w/o difficulty. So next is Apache/PHP and I download Apache version 2.0.54 and PHP version 5.0.5. Following the instructions on the PHP site (http://www.php.net/manual/en/install.unix.apache2.php) exactly, I'm able to get both configured and installed w/o difficulty. I first test Apache by going to localhost to see if the server is running. It is. Then I modify the httpd.conf file as instructed at the above page by adding the LoadModule and AddType and then create a 'hello world' php script to make sure php is working. The problem I'm getting is when I access the page, it's showing me the actual php code and not the parsed result. I looked in the modules directory to see if the libphp5.so file is there and it is. I did notice something odd, though. In the httpd.conf file there are a large number of LoadModule lines for modules that are not in the modules directory. Could that be causing my problem? In any case, if someone could give me some pointers are to where I should concentrate my attentions in order to resolve this problem, I would be very appreciative! thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems with new PHP install
[snip] Then I modify the httpd.conf file as instructed at the above page by adding the LoadModule and AddType and then create a 'hello world' php script to make sure php is working. [/snip] Did you restart the Apache server after making the changes to httpd.conf ? I know it is basic, I just have to ask. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array - partical path to the array's path (part 2)
the xml above is not structurally the same as the array below I'll bet your output has just one message element right? or you have gone completely offtrack. might be time you went here: http://php.net/xml http://php.net/dom http://php.net/domxml might be something there to help you out especially if you give php5 a try. Yea, gone offtrack. Not sure if it is just one element that is offtrack or more since this is only a simple testcase. I'll keep working on it. The funny things is most of the xml features doesn't fully cover our need so somebody had to do custom programming. The one at Pear isn't close enough and is a little bit primitive. I guess we're doing all what we can here. I found that keeping the script simple would greatly help as we move on to newer and newer version. I can't really upgrade to php5 since I have at least 5 websites running on the same version. It would take some testing through the whole scripts on the whole websites to make sure the code work correctly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with new PHP install
[snip] Then I modify the httpd.conf file as instructed at the above page by adding the LoadModule and AddType and then create a 'hello world' php script to make sure php is working. [/snip] Did you restart the Apache server after making the changes to httpd.conf ? I know it is basic, I just have to ask. Fair enough. :) Yes, I did. Step 8 (on the included link) of the PHP installation has you start Apache and then stop it again. It was during this step that I tested to make sure Apache was working by just going to http://localhost. Then step 16 has you start Apache again. The only slightly different thing I did that wasn't part of the installation was my configure of php. It looked like this: ./configure \ --enable-force-cgi-redirect \ --without-pear \ --enable-magic-quotes \ --enable-bcmath \ --enable-calendar \ --with-mysql=/usr/local/mysql \ --enable-ftp \ --enable-mailparse \ --with-mcrypt \ --enable-trans-sid \ --disable-short-tags \ --with-zlib-dir=/usr/lib \ --enable-wddx \ --with-xml \ --with-dom=/usr \ --with-xslt-sablot \ --with-expat-dir=/usr \ --with-dom-xslt=/usr \ --with-sablot-js=/usr \ --enable-xslt \ --with-apxs2=/usr/local/apache2/bin/apxs And that configured with no error (at least, as far as I could tell). My test script looks like this: script language=php echo PHP Works!!; /script br ? echo PHP Works??; And that is exactly what is getting output by the browser. The br isn't even getting interpreted as a break...? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with new PHP install
Chris Boget wrote: Since I was having so much difficulty getting PHP (with libxml2) installed on RH9, I decided to take the advice given by several people and use Fedora Core 4 instead, which I get installed w/o difficulty. So next is Apache/PHP and I download Apache version 2.0.54 and PHP version 5.0.5. Following the instructions on the PHP site (http://www.php.net/manual/en/install.unix.apache2.php) exactly, I'm able to get both configured and installed w/o difficulty. I first test Apache by going to localhost to see if the server is running. It is. Then I modify the httpd.conf file as instructed at the above page by adding the LoadModule and AddType and then create a 'hello world' php script to make sure php is working. The problem I'm getting is when I access the page, it's showing me the actual php code and not the parsed result. I looked in the modules directory to see if the libphp5.so file is there and it is. I did notice something odd, though. In the httpd.conf file there are a large number of LoadModule lines for modules that are not in the modules directory. Could that be causing my problem? In any case, if someone could give me some pointers are to where I should concentrate my attentions in order to resolve this problem, I would be very appreciative! Is there a line like this in your httpd.conf...? AddType application/x-httpd-php .php (Don't forget to restart Apache ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with new PHP install
Chris Boget wrote: snip My test script looks like this: script language=php echo PHP Works!!; /script br ? echo PHP Works??; And that is exactly what is getting output by the browser. The br isn't even getting interpreted as a break...? Yeah, looks like you need the AddType entry. Apache doesn't know what *.php is, so it's just serving it up as plain text. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with new PHP install
And that is exactly what is getting output by the browser. The br isn't even getting interpreted as a break...? Is there a line like this in your httpd.conf...? AddType application/x-httpd-php .php [snip] Yeah, looks like you need the AddType entry. Apache doesn't know what *.php is, so it's just serving it up as plain text. Step 15 of the php installation (as listed in the link in my OP) has you add the following to the httpd.conf: AddType application/x-httpd-php .php .phtml I also went ahead and added the following as well AddType application/x-httpd-php-source .phps The filename of my test script, though, is php_test.php and not php_test.phps so php should be parsing it.. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
On Thursday 29 September 2005 04:20 am, Andy Pieters wrote: Hi bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / That's just what it says, check your program flow. You overrided the tostring function and somewhere in that new function you jump out of it because of a flag that is set, and thus not returning anything, which is equal to return null. I'd love to say that is possible however it's not. function __toString() { # Transform... if (!$this-outXML) { $XSlt = new xsltprocessor(); $XSlt-registerPHPFunctions(); $XSlt-importStyleSheet(DomDocument::load($this-style)); return $XSlt-transformToXML($this-Dom); } else { return $this-Dom-saveXML(); } } As you can see there is nothing that could make it jump out. very straight forward and all cases handled via else. The line: return $this-Dom-saveXML(); is somehow returning null. Thank you for the advice on how to enable notices. being I always include my Document script I just added error_reporting(E_ALL); to the top. Sadly I'm getting no Notices about my problem. Am getting 1 notice but nothing of any interest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array: how to find a parent key when using a child key?
I'm using the recursive function and it use the foreach() loop. I can figure out how to use the current key but I could not figure out how to use the parent's key. Can anyone point out to what I'm missing here? Just look at the //Parent Key - How?? comment in the script...I'm not sure what php function that can allow us to walk up the array like array_walk() for example. Thanks... [code] $array = array ( 'NEWSFEED' = array ( '0' = array ( 'MESSAGE' = array ( '0' = array ( 'COMMENT' = array ( '0' = array ( 'VALUE' = 'Comment #1' ) ) ), '1' = array ( 'COMMENT' = array ( '0' = array ( 'VALUE' = 'Comment #2' ) ) ) ) ) ) ); function GetXmlStr($tree) { $branch_level = 0; //Tree's branches level... XmlTreeDecompile($tree, $branch_level); return htmlentities($str1); } function XmlTreeDecompile($tree, $branch_level) { $branch_level++; foreach($tree as $key = $value) { if ($branch_level % 2 != 0) { //xml name-tag counter... if(!(is_array($value))) { echo str_repeat( ,$branch_level)..$key..$value./.$key..\r\n; } else { echo str_repeat( ,$branch_level)..$key..\r\n; XmlTreeDecompile($value, $branch_level); echo str_repeat( ,$branch_level)./.$key..\r\n; $str1 = $key; } } else { //Xml tag's name... //echo $key. #br; if ($key != 0) { //Parent Key - How?? echo str_repeat( ,($branch_level-1))./MESSAGE###.\r\n; echo str_repeat( ,($branch_level-1)).MESSAGE###.\r\n; } XmlTreeDecompile($value, $branch_level); } } } $xml_string = GetXmlStr($array); //echo \nbrbr\n.$xml_string; [/code] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems with new PHP install
[snip] Step 15 of the php installation (as listed in the link in my OP) has you add the following to the httpd.conf: AddType application/x-httpd-php .php .phtml I also went ahead and added the following as well AddType application/x-httpd-php-source .phps The filename of my test script, though, is php_test.php and not php_test.phps so php should be parsing it.. [/snip] Have you enabled a version of php.ini? It is not necessary...just a thought. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with new PHP install
Step 15 of the php installation (as listed in the link in my OP) has you add the following to the httpd.conf: Ok, color me retarded. Pretty please. :) It turns out I modified the wrong httpd.conf file. duh. Sorry about that. Everyone can move along. Nothing to see here but some blathering idiot. :p hehehe thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with new PHP install
Chris Boget wrote: Step 15 of the php installation (as listed in the link in my OP) has you add the following to the httpd.conf: Ok, color me retarded. That happens when Jay gets involved. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems with new PHP install
[snip] duh. [/snip] You have now officially obtained a lifetime membership to the club. Your t-shirt should arrive in the mail soon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
It is just that not many work with XML often enough to know well enough how to use it. I noticed many folks have different way of using XML that doesn't best fit our need. I have this same problem as well. So, you're not the only one here as I have this same problem as well. Stephen Leaf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thursday 29 September 2005 04:20 am, Andy Pieters wrote: Hi bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / That's just what it says, check your program flow. You overrided the tostring function and somewhere in that new function you jump out of it because of a flag that is set, and thus not returning anything, which is equal to return null. I'd love to say that is possible however it's not. function __toString() { # Transform... if (!$this-outXML) { $XSlt = new xsltprocessor(); $XSlt-registerPHPFunctions(); $XSlt-importStyleSheet(DomDocument::load($this-style)); return $XSlt-transformToXML($this-Dom); } else { return $this-Dom-saveXML(); } } As you can see there is nothing that could make it jump out. very straight forward and all cases handled via else. The line: return $this-Dom-saveXML(); is somehow returning null. Thank you for the advice on how to enable notices. being I always include my Document script I just added error_reporting(E_ALL); to the top. Sadly I'm getting no Notices about my problem. Am getting 1 notice but nothing of any interest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] decrypting query string back into $_GET['var']
What is the best way to decrypt a query string back into variables ? $root = http://www.myserver.com/script.php;; $queryString = ?test=mytestcolor=red; myEncrypt($queryString); //add mCrypt encryption $finalURL = $root.$encryptedQueryString; what is the proper what to decrypt the GET variables on the other side ? Do you need to decrypt the query string first ? decrypt($_SERVER['QUERY_STRING']); Once you have decrypted it, can you pass it along to a $_GET as you would with an unencrypted query string ? $test = $_GET['test']; Or, do you need to parse the string to extract variables? many thanks g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] decrypting query string back into $_GET['var']
Graham Anderson wrote: What is the best way to decrypt a query string back into variables ? $root = http://www.myserver.com/script.php;; $queryString = ?test=mytestcolor=red; myEncrypt($queryString); //add mCrypt encryption $finalURL = $root.$encryptedQueryString; what is the proper what to decrypt the GET variables on the other side ? Do you need to decrypt the query string first ? yes - if you have a query string like 4509134534068953534875104584437043134081743 or whatever then php won't turn it into a $_GET var. although your query string could contain 's and/or ?'s and/or ='s in which case you might have cruft in the $_GET array which you would want to clean out before extracting your decrypted string into $_GET .. decrypt($_SERVER['QUERY_STRING']); Once you have decrypted it, can you pass it along to a $_GET as you would with an unencrypted query string ? $test = $_GET['test']; Or, do you need to parse the string to extract variables? yes you do, but this being php - there is a function that will do it for you :-) http://php.net/parse_str many thanks g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] decrypting query string back into $_GET['var']
thanks :) that was exactly what I needed g On Sep 29, 2005, at 9:33 AM, Jochem Maas wrote: Graham Anderson wrote: What is the best way to decrypt a query string back into variables ? $root = http://www.myserver.com/script.php;; $queryString = ?test=mytestcolor=red; myEncrypt($queryString); //add mCrypt encryption $finalURL = $root.$encryptedQueryString; what is the proper what to decrypt the GET variables on the other side ? Do you need to decrypt the query string first ? yes - if you have a query string like 4509134534068953534875104584437043134081743 or whatever then php won't turn it into a $_GET var. although your query string could contain 's and/or ?'s and/or ='s in which case you might have cruft in the $_GET array which you would want to clean out before extracting your decrypted string into $_GET .. decrypt($_SERVER['QUERY_STRING']); Once you have decrypted it, can you pass it along to a $_GET as you would with an unencrypted query string ? $test = $_GET['test']; Or, do you need to parse the string to extract variables? yes you do, but this being php - there is a function that will do it for you :-) http://php.net/parse_str many thanks 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] Error with DOMDocument-saveXML()
On Thursday 29 September 2005 09:37 am, Scott Fletcher wrote: It is just that not many work with XML often enough to know well enough how to use it. I noticed many folks have different way of using XML that doesn't best fit our need. It is a newer idea of how to do things. I have this same problem as well. So, you're not the only one here as I have this same problem as well. Glad I'm not in this boat alone! I almost have a sneaky suspicion that it has something to do with the __toString() I've noticed in the past I couldn't do somethings that I normally could do in custom functions. think it had something to do with constants but then that was when I didn't have much experience with php5 objects so it's very likely that was just stupidity on my behalf. Not played around with it too much since then however. So I guess nows a better time than ever. hopefully I can duplicate this behavior in a smaller class that I can just post to the list. Stephen Leaf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thursday 29 September 2005 04:20 am, Andy Pieters wrote: Hi bFatal error/b: Method Document::__toString() must return a string value in b/srv/www/localhost/htdocs/db/index.php/b on line b140/bbr / That's just what it says, check your program flow. You overrided the tostring function and somewhere in that new function you jump out of it because of a flag that is set, and thus not returning anything, which is equal to return null. I'd love to say that is possible however it's not. function __toString() { # Transform... if (!$this-outXML) { $XSlt = new xsltprocessor(); $XSlt-registerPHPFunctions(); $XSlt-importStyleSheet(DomDocument::load($this-style)); return $XSlt-transformToXML($this-Dom); } else { return $this-Dom-saveXML(); } } As you can see there is nothing that could make it jump out. very straight forward and all cases handled via else. The line: return $this-Dom-saveXML(); is somehow returning null. Thank you for the advice on how to enable notices. being I always include my Document script I just added error_reporting(E_ALL); to the top. Sadly I'm getting no Notices about my problem. Am getting 1 notice but nothing of any interest -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error with DOMDocument-saveXML()
On Thursday 29 September 2005 12:26 pm, Stephen Leaf wrote: I have figured it out! My guess couldn't have been more _wrong_. Here is all you need to recreate the Error. There is only 1 value that is off. in the DOMDocument I gave it the wrong encoding type. uft-8 .. it should read utf-8. Interesting that PHP doesn't tell you about a bad encoding type. ?php class test { private $Dom; function __construct ($rootName) { $this-Dom = new DOMDocument('1.0', 'uft-8'); $this-Dom-appendChild($this-Dom-createElement($rootName)); } function __toString() { return $this-Dom-saveXML(); } } $test = new test(test); echo $test; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mixing PHP VBSCript
I have a situation where I have to fix an app interface that was constructed with hundreds of lines of VBScript. The quickest way for me to do this would be to replace the offending VBScipt with PHP. Does anyone see any potential problems with doing this? I did a diagram on paper and see no gotcha's..TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mixing PHP VBSCript
Jay Blanchard mailto:[EMAIL PROTECTED] on Thursday, September 29, 2005 11:03 AM said: I have a situation where I have to fix an app interface that was constructed with hundreds of lines of VBScript. The quickest way for me to do this would be to replace the offending VBScipt with PHP. Does anyone see any potential problems with doing this? I did a diagram on paper and see no gotcha's..TIA You don't mean within the same file do you? If so (though I doubt it) I'm sure there will be lots of problems! On the other hand if you're just having one file (that may be written in vbs) talk to another file (PHP perhaps) via GET, POST, or COOKIE I don't see why you would have a problem. Working with the SESSION might be a problem though. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php search engine
I am looking to install a php site search on one of my sites. Looking at http://www.site-search-pro.com/ has anyoner used this? what do I need to do to get it working? do the files reside on my server? Any alternatives free or paid let me know.. R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and Active Directory
Hi, How do I connect a php script running on linux with Active Directory on a windows machine? I would like to have my php script autmotatically read email addresses from the AD server. Can this be done? I've found a bunch of ldap functions for php but they seem to require ldap to be installed on linux. I'm confused. Thanks in advance for your help. Anya
Re: [PHP] PDF Thumbnails
I wrote a script for this; it's designed to run from the command line in *nix, but can be triggered via exec(): Usage: ./pdf2thumb.php source_dir out_dir [code] #!/usr/local/bin/php ? function getDirFiles($dirPath){ $filesArr=array(); if ($handle = opendir($dirPath)){ while (false !== ($file = readdir($handle))) if ($file != . $file != ..){$filesArr[] = trim($file);} closedir($handle);} return $filesArr; } function usage(){ echo(USAGE: pdf2thumb source_folder_path destination_folder_path\n\n); exit; } if(!isset($argv[1])){usage();} substr($argv[1],-1)==/?$path=$argv[1]:$path=$argv[1]./; isset($argv[2])?$dest_path=$argv[2]:$dest_path=$path; substr($dest_path,-1)==/?$dest_path=$dest_path:$dest_path.=/; $total_time=0; $total_files=0; if(!file_exists($dest_path)){`mkdir $dest_path`;} $files=getDirFiles($path); for($i=0;$icount($files);$i++){ if(substr($files[$i],-3)==pdf){ echo(Converting .$files[$i] ); $time_start = microtime(true); $old_name=$path.$files[$i]; $new_name=$dest_path.str_replace(.pdf,.jpg,$files[$i]); `/usr/bin/convert '$old_name' -thumbnail 240x160 '$new_name'`; $time_end = microtime(true); $convert_time=round($time_end-$time_start,2); echo(Done. ($convert_time seconds)\n); $total_time+=$convert_time; $total_files++; } } echo(\n---\n); echo($total_files files converted in .round($total_time/60,2). $minutes (AVG: .round($total_time/$total_files,2).s)\n\n); ? [/code] [EMAIL PROTECTED] wrote: You would haven't happen to have an example? I am new to imagemagick. Any help would be greatly appreciated. On 9/26/05, Jim Moseby [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 1:43 AM To: php-general@lists.php.net Subject: [PHP] PDF Thumbnails I give my users an option to upload pdf files to my site and would like them to see a thumbnail view of the file once uploaded. Has anyone heard of a way how to do this? The 'convert' function of ImageMagick will do it. JM
Re: [PHP] php search engine
Ross wrote: I am looking to install a php site search on one of my sites. Looking at http://www.site-search-pro.com/ has anyoner used this? what do I need to do to get it working? do the files reside on my server? Any alternatives free or paid let me know.. I'm partial to mnogoSearch http://search.mnogo.ru/ http://us3.php.net/mnogosearch It has to be compiled into your PHP, so if you're on shared hosting, it may not be an option. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixing PHP VBSCript
At 03:02 PM 9/29/2005, Jay Blanchard wrote: I have a situation where I have to fix an app interface that was constructed with hundreds of lines of VBScript. The quickest way for me to do this would be to replace the offending VBScipt with PHP. Does anyone see any potential problems with doing this? I did a diagram on paper and see no gotcha's..TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jay, Your new job is getting real interesting! Did you try it on a test file? If it works then the parsing in the web server can be overloaded, for lack of a better term. So whether the extension is .asp or .php, watch for the tags and treat them appropriately, that it? Wow - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mixing PHP VBSCript
[snip] Your new job is getting real interesting! Did you try it on a test file? If it works then the parsing in the web server can be overloaded, for lack of a better term. So whether the extension is .asp or .php, watch for the tags and treat them appropriately, that it? [/snip] Darn right 'wow'! I can keep the ASP seperate from the PHP by use of the proper tags for this instance. So... % stuff here gets executed by ASP % ?php stuff here gets executed by PHP ? Interestingly enough, the following worked ...but I will not use it in production; ?php $sql = SELECT foo FROM bar where fooID = ' ; ? % response.write(fooID) % ?php $sql .= ' ; echo $sql . \n; ? returned SELECT foo FROM bar where fooID = '4' Nuts, huh? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mixing PHP VBSCript
A real interesting challenge and when I first read it I thought the same thing, instead of using the short form of tags, using a more extended form such as script language= and so on, it should work, but then, Irealized that there is a lot going on outside of the code, such as parsing the incoming arguments of the POST or GET into either the $_REQUEST array or the Request.Form collection and, on the opposite site, the assembly of the output buffer. Even in the CGI version of the PHP interpreter there is no provision I am aware of to pipe either the request or the reply to any other interpreter down the line, nor do I think the ASP interpreter has a CGI version.How come you were able to do both a Response.Write and an echo and get them both streamed into the same browser, I can't figure out. If you manage to send headers from one or the other in any order it would be impressive, and if from both, I would appreciate it if you would warn me to sit down tight before you ever break the news. Other 'global' objects or arrays would also mess up. Sessions, cookies, etc, I can't imagine. Another issue would be sharing variables, calling functions or passing parameters. I am certain that should be impossible. A trick it should work, if you find any trouble with this is to do a sort of 'web service' with PHP which you can call from ASP, so you still leave ASP handling the user interface as I assume it does now, and you can request from a server running PHP (which might be the very same one) whatever the PHP one cannot provide. Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] Your new job is getting real interesting! Did you try it on a test file? If it works then the parsing in the web server can be overloaded, for lack of a better term. So whether the extension is .asp or .php, watch for the tags and treat them appropriately, that it? [/snip] Darn right 'wow'! I can keep the ASP seperate from the PHP by use of the proper tags for this instance. So... % stuff here gets executed by ASP % ?php stuff here gets executed by PHP ? Interestingly enough, the following worked ...but I will not use it in production; ?php $sql = SELECT foo FROM bar where fooID = ' ; ? % response.write(fooID) % ?php $sql .= ' ; echo $sql . \n; ? returned SELECT foo FROM bar where fooID = '4' Nuts, huh? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mixing PHP VBSCript
Jay Blanchard mailto:[EMAIL PROTECTED] on Thursday, September 29, 2005 1:34 PM said: Darn right 'wow'! I can keep the ASP seperate from the PHP by use of the proper tags for this instance. So... % stuff here gets executed by ASP % ?php stuff here gets executed by PHP ? Wow. I didn't think that would work! haha Nuts, huh? Yes. C. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] RE: [PHP] php search engine
hi Ross Any alternatives free or paid let me know.. http://www.isearchthenet.com/isearch/ is a good 'un, so long as you don't have thousands of pages. R -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5 Hosting
Any recommendations on good host providers for PHP 5? Bonus points if they support SSH access and a PHP compiler like Zend. Thanks, Ed
[PHP] Question about Rasmus' 30 second AJAX Tutorial
Hi, I did the Rasmus' 30 second AJAX Tutorial just for testing and everything works fine, by the way... thanks Rasmus, for this and for all !!. My little script have a single input and for every keystroke (calling the javascript function with onkeyup) the value of the input is parsed by another php script that just return the lenght of the string. So, if I start typing the word hello, when i press the h key it displays 1, for ho it displays 2 and so onvery simple, just for testing. But (theres always a but!!) it seems that only work if I call the function sndReq(); with onkeyup. If I call the function from a onsubmit it returns...nothing!. Then alert('response:'+http.responseText); it's EMPTY. Im absolutely sure that the difference between the two scripts is that the one that works is the onkeyup, and the one that not is the onsubmit. So, anybody knows why this is happening? Sorry about my english (I'm from the third world ;) ) Regards, (from Argentina) Federico. I find a lot of this AJAX stuff a bit of a hype. Lots of people have been using similar things long before it became AJAX. And it really isn't as complicated as a lot of people make it out to be. Here is a simple example from one of my apps. First the Javascript: function createRequestObject() { var ro; var browser = navigator.appName; if(browser == Microsoft Internet Explorer){ ro = new ActiveXObject(Microsoft.XMLHTTP); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq(action) { http.open('get', 'rpc.php?action='+action); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseText; var update = new Array(); if(response.indexOf('|' != -1)) { update = response.split('|'); document.getElementById(update[0]).innerHTML = update[1]; } } } This creates a request object along with a send request and handle response function. So to actually use it, you could include this js in your page. Then to make one of these backend requests you would tie it to something. Like an onclick event or a straight href like this: a href=javascript:sndReq('foo') [foo]/a That means that when someone clicks on that link what actually happens is that a backend request to rpc.php?action=foo will be sent. In rpc.php you might have something like this: switch($_REQUEST['action']) { case 'foo': /* do something */ echo foo|foo done; break; ... } Now, look at handleResponse. It parses the foo|foo done string and splits it on the '|' and uses whatever is before the '|' as the dom element id in your page and the part after as the new innerHTML of that element. That means if you have a div tag like this in your page: div id=foo /div Once you click on that link, that will dynamically be changed to: div id=foo foo done /div That's all there is to it. Everything else is just building on top of this. Replacing my simple response id|text syntax with a richer XML format and makine the request much more complicated as well. Before you blindly install large AJAX libraries, have a go at rolling your own functionality so you know exactly how it works and you only make it as complicated as you need. Often you don't need much more than what I have shown here. Expanding this approach a bit to send multiple parameters in the request, for example, would be really simple. Something like: function sndReqArg(action,arg) { http.open('get', 'rpc.php?action='+action+'arg='+arg); http.onreadystatechange = handleResponse; http.send(null); } And your handleResponse can easily be expanded to do much more interesting things than just replacing the contents of a div. -Rasmus
Re: [PHP] Question about Rasmus' 30 second AJAX Tutorial
On Thu, 2005-09-29 at 22:46, xfedex wrote: Hi, I did the Rasmus' 30 second AJAX Tutorial just for testing and everything works fine, by the way... thanks Rasmus, for this and for all !!. My little script have a single input and for every keystroke (calling the javascript function with onkeyup) the value of the input is parsed by another php script that just return the lenght of the string. So, if I start typing the word hello, when i press the h key it displays 1, for ho it displays 2 and so onvery simple, just for testing. But (theres always a but!!) it seems that only work if I call the function sndReq(); with onkeyup. If I call the function from a onsubmit it returns...nothing!. Then alert('response:'+http.responseText); it's EMPTY. Im absolutely sure that the difference between the two scripts is that the one that works is the onkeyup, and the one that not is the onsubmit. So, anybody knows why this is happening? Aside from using ajax to clean the toilet once in a while I'm not really into it. But I do wrangle out some javascript from time to time :) Why are you using onsubmit? Wouldn't onclick work better? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about Rasmus' 30 second AJAX Tutorial
On 9/29/05, Robert Cummings [EMAIL PROTECTED] wrote: Aside from using ajax to clean the toilet once in a while I'm not really into it. But I do wrangle out some javascript from time to time :) Why are you using onsubmit? Wouldn't onclick work better? Cheers, Rob. Hi Robert, I also try with onclick and i got the same result as with onsubmit, it seems that only work with onkeyup but the point is why? Saludos, Fede.
[PHP] if string contains
Humour me. I knew how to do this. I want to parse $searchenquiry and see if it contains searchenquiry=. Good grief, sorry. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if string contains
John Taylor-Johnston wrote: Humour me. I knew how to do this. I want to parse $searchenquiry and see if it contains searchenquiry=. $yourAnswer = ( strpos( $searchenquiry, 'searchenquiry=' ) !== false ); -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if string contains
Jasper Bryant-Greene wrote: John Taylor-Johnston wrote: Humour me. I knew how to do this. I want to parse $searchenquiry and see if it contains searchenquiry=. $yourAnswer = ( strpos( $searchenquiry, 'searchenquiry=' ) !== false ); Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if string contains
Me thinks that was what I used. http://ca.php.net/strstr http://ca.php.net/stristr http://ca.php.net/strpos What's the difference? Other than *Note: * If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function *strpos()* http://ca.php.net/manual/en/function.strpos.php instead. Rob Agar wrote: heh. you perhaps remember the strstr function..? :) Rob -Original Message- From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] Sent: Friday, 30 September 2005 2:26 PM To: php-general@lists.php.net Cc: [EMAIL PROTECTED] Subject: [PHP] if string contains Humour me. I knew how to do this. I want to parse $searchenquiry and see if it contains searchenquiry=. Good grief, sorry. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- John Taylor-Johnston - If it's not Open Source, it's Murphy's Law. ' ' 'Collège de Sherbrooke: ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/ - 819-569-2064 °v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures /(_)\ Université de Sherbrooke ^ ^ http://compcanlit.ca/ T: 819.569.2064
RE: [PHP] if string contains
hi John Me thinks that was what I used. http://ca.php.net/strstr http://ca.php.net/stristr http://ca.php.net/strpos What's the difference? the ones ending 'pos' just return an integer position. The 'i' in these string manipulation functions generally means that the function is case-insensitive. Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FTP Chmod problem
I'm using 5.0.something. Al [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Matt Palermo wrote: Hello everyone. I have a script where I am using FTP functions to chmod files/folders. I'm running into a problem with the ftp_chmod() function when trying to change the permissions of a directory. Here is the code I'm using: ftp_chmod($connId, 0777, $folder); The function almost works, but when I check the permission of the folder after it's run, the folder has 410 for permissions instead of 777. So, it is changing the permissions, but not to the correct value. Now when I use the following code, it seems to work fine: $chmodCmd = CHMOD 0777 .$file; ftp_site($connId, $chmodCmd); This properly changes the folder permissions to 777. Does anyone know why the ftp_chmod() function doesn't work correctly? As a side note, the ftp_chmod() function works correctly on a file, but not a directory. Any help is appreciated. Thanks, Matt Palermo http://sweetphp.com Which php version are you using? PHP 4x does not have ftp_chmod(); It does have ftp_site() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File Upload Max Size
Hello everyone. I'm basically building a PHP FTP client app. This app connects to an FTP server and allows the user to edit/delete files/permissions, etc. I've gotten to the point where I have started to create a file upload feature. The problem I have is that PHP only allows a 2mb maximum file upload, while normal FTP allows a much larger file to be uploaded. This app will be for a server where the user does not have access to change any php.ini settings. I'm basically looking for a way to upload large files (if needed) through my PHP FTP client app. This 2mb file limit is killing me here. Is there any way to get around this? I'm using the PHP built in FTP functions to do all the backend work for the app. I don't imagine there is an FTP function to use that will allow larger uploads is there? Please let me know if you have any suggestions. I really need to upload larger files, and since it's going to an FTP site, there shouldn't be too many size restrictions. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Hosting
The first two results both seem pretty good at a glance: http://www.google.com/search?hl=enq=php5+ssh+hostingbtnG=Google+Search On Sep 29, 2005, at 8:29 PM, Ed Lazor wrote: Any recommendations on good host providers for PHP 5? Bonus points if they support SSH access and a PHP compiler like Zend. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is there any open source project of php like swik.net?
Hi,All, Swik is good for us to set one site of ourself open database! is there any open source project of php like swik.net? Anyone Can Edit SWiK is a project to create a useful free-content directory for open source software. SWiK was inspired by the wiki concept used by projects like Wikipedia and WikiWikiWeb. Regular visitors are the editors of SWiK, people like you or me. Find Useful Information Swik project pages are different from the typical wiki pages you may have seen before. Each project page has its own set of wiki pages. Additionally SWiK features templates for different kinds of pages, like blogs or bookmark pages. -- Sent from the PHP - General forum at Nabble.com: http://www.nabble.com/is-there-any-open-source-project-of-php-like-swik.net--t360794.html#a999132
Re: [PHP] working with xml from a php file for xsl transformations
jonathan wrote: //neither of these work //$menu=file_get_contents(urlencode('menu_render.php? menu_id=4format=xml')); $xml-load('menu_render.php?menu_id=4format=xml'); You need to pass those get variables through a web server, otherwise you're looking for a file called menu_render.php?menu_id=4format=xml which doesn't exist. Try: $menu = file_get_contents( 'http://www.yoursite.com/yourpath/menu_render.php?menu_id=4format=xml' ); -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php