[PHP] Re: Caching Database Information
Paul Higgins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Can I cache too much and therefore negate the advantages of caching? Performance can be a very complicated subject. There is a good chance that the data is already cached. I don't know the details of how PHP, your hadrware and your operating system work, but it is very typical for data to be cached in memory by software and hardware. It is entirely possible that the most efficient solution is to simply have as much main memory as possible and let the hardware and software do what it already can do. Let's assume that the database data is cached by the database software and/or the operating system. Let's also assume that any cache that you create might cause virtual memory used by other software to be paged out. Then if that other memory needs to be paged back in then you easily coud be degrading performance by trying to improve it. You can't guess about perfomance. Effective optimization requires learning about the system and use of tools such as performance monitors. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing variable on include
Hi, I have to pass variable on include include(includes/include.php); include(includes/include.php?name=$name); wouldn't work. How do I do that? Cokies are not an option, btw. -- Tadas Talaikis [EMAIL PROTECTED] http://www.xongoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] List of cities
Morning... Does anyone know of a site that or resource available where I could pull a list of ALL UK cities and towns for an option list...? I started out with 100+, then expanded this list to over 200 but still get complaints that certain towns are not listed. -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variable on include
Xongoo!com: Central unit wrote: Hi, I have to pass variable on include include(includes/include.php); include(includes/include.php?name=$name); wouldn't work. How do I do that? Cokies are not an option, btw. Code in includes/include.php is executed in the scope of the including file, so all variables available at the include() will be available in the included file. Thus the solution is: $name = 'Your Name'; include(includes/include.php); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Download installer not found [***SPAM***] **SPAM USA 64.246.30.37 BODY**
Devx wrote: I click PHP 5.0.1 installer http://www.php.net/get/php-5.0.1-installer.exe/from/a/mirror link download at http://www.php.net/get/php-5.0.1-installer.exe/from/a/mirror . But i see download not found. Download not found This mirror site is improperly setup, and thus has no copy of the executable file you requested. Please select a different mirror site http://th.php.net/mirrors to get the file, until this site gets fixed. same PHP 4.3.8 installer http://www.php.net/get/php-4.3.8-installer.exe/from/a/mirror link,please fix. So which mirror were you using? http://th.php.net/mirrors is working for me and gives the same list I get from the UK mirrors, but it may be that you have an old cookie that needs clearing? -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: List of cities
Harlequin wrote: Does anyone know of a site that or resource available where I could pull a list of ALL UK cities and towns for an option list...? I started out with 100+, then expanded this list to over 200 but still get complaints that certain towns are not listed. I have a fairly complete Postcode table - 400Mb in Firebird. This gives me nearly 1500 postal towns. Do you really want that in a single drop down list? I can supply it as a list if you want really want it, but I think you need a rethink. (eMail direct if you do want it) -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: List of cities
Harlequin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Morning... Does anyone know of a site that or resource available where I could pull a list of ALL UK cities and towns for an option list...? I started out with 100+, then expanded this list to over 200 but still get complaints that certain towns are not listed. Ask the UK postal service (or whatever it is called). They should have such a list/directory containing all cities with zip codes in digital form (probably on CD-ROM). Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: List of cities
Torsten Roehr wrote: Does anyone know of a site that or resource available where I could pull a list of ALL UK cities and towns for an option list...? I started out with 100+, then expanded this list to over 200 but still get complaints that certain towns are not listed. Ask the UK postal service (or whatever it is called). They should have such a list/directory containing all cities with zip codes in digital form (probably on CD-ROM). It's a chargeable item - with annual subscription - depending on the number of users. -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simultaneus execution
An example would be the execution of a function. Let's say that I can't execute one same function twice, but how can I execute it again, before the first execution has completed? Regards, Andrew Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sunday 29 August 2004 09:56, Andrew wrote: Do anyone have an idea how to execute 2 different functions in the same moment, no matter if they're system or custom ones. For example, how can I execute 2 different loops simultaneously? I'm curious at what you're trying to achieve. Could you elaborate? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* QOTD: What do you mean, you had the dog fixed? Just what made you think he was broken! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variable on include
Duh, really, and just read on varianle scopes on php.net. Gotta to sleep for some time :) -- Tadas Talaikis [EMAIL PROTECTED] http://www.xongoo.com - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Xongoo!com: Central unit [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, August 29, 2004 11:41 AM Subject: Re: [PHP] Passing variable on include Xongoo!com: Central unit wrote: Hi, I have to pass variable on include include(includes/include.php); include(includes/include.php?name=$name); wouldn't work. How do I do that? Cokies are not an option, btw. Code in includes/include.php is executed in the scope of the including file, so all variables available at the include() will be available in the included file. Thus the solution is: $name = 'Your Name'; include(includes/include.php); -- 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[2]: [PHP] Simultaneus execution
Maybe you can use classes in this case? I'm using them when I need to process the same object or to assign some simultaneous actions to many objects at the same time. Sunday, August 29, 2004, 6:40:42 AM, you wrote: An example would be the execution of a function. Let's say that I can't execute one same function twice, but how can I execute it again, before the first execution has completed? Regards, Andrew Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sunday 29 August 2004 09:56, Andrew wrote: Do anyone have an idea how to execute 2 different functions in the same moment, no matter if they're system or custom ones. For example, how can I execute 2 different loops simultaneously? I'm curious at what you're trying to achieve. Could you elaborate? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* QOTD: What do you mean, you had the dog fixed? Just what made you think he was broken! */ -- Best regards, Eugenemailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Loading php_domxml.dll
After doing a lot of searching and trying many things, I finally got it working; at least to the extent that the extension is loaded. I am not sure what all I did that is necessary, but the one thing that seems to have been necessary is to copy iconv.dll to my Windows\Systme32 directory. I hesitated to try that, since I avoid doing things like that unless they are necessary, and I assumed the dll should be accessible along with the other DLLS. However now I am getting errors that seem incorrect from the domxml extension, but that is a separate story. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loading a html file using DOM XML
Is it possible to load a HTML file using DOM XML? I tried loading a HTML file using: $Document = domxml_open_file(DynamicTable.html); if (!$Document) { echo Error loading the document\n; exit; } Yet that does not work; I get the error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
It's obviously not a well-formed XML Document... chregu On Sun, 29 Aug 2004 05:11:19 -0700, Sam Hobbs [EMAIL PROTECTED] wrote: Is it possible to load a HTML file using DOM XML? I tried loading a HTML file using: $Document = domxml_open_file(DynamicTable.html); if (!$Document) { echo Error loading the document\n; exit; } Yet that does not work; I get the error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
I don't want a XML document! I need a HTML document. Are you sure that that is the only possible explanation? I think not, and if not, then it is not accurate to say that that is the obvious answer. I did try changing the extension from html to XML and loading that directly into IE. I did get errors. When I fixed the errors, the document loaded into IE, but of course it was shown as-is. That is not what I need; I need the HTML to be processed (formatted). When I load the corrected document in using domxml_open_file, it still does not load, regardlous of whether the extension is xml or html. So your answer is rather cryptic. I need to load a file that can be created and edited using a WYSIWYG editer, such as FrontPage. Then I need to modify it (to do things such as fill in a table) using the DOM and then show that. Perhaps the XML DOM is not capable of doing that then saying that the problem is that it is not well-formed is a minor detail and the answer is that I need HTML DOM functions instead of XML DOM. In other words, perhaps PHP cannot do what I need. Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's obviously not a well-formed XML Document... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
DOMXML can basically only load well-formed XML documents and does this quite well. If it doesn't work, you are doing something wrong or your XML/HTML document is not wellformed. It's that simple.. And yes, FrontPage, doesn't produce well-formed code ;) But... There is a solution, which maybe helps, see http://ch.php.net/manual/en/function.dom-domdocument-loadhtmlfile.php This function can load HTML into a DOM Document without having to be well-formed chregu On Sun, 29 Aug 2004 05:56:51 -0700, Sam Hobbs [EMAIL PROTECTED] wrote: I don't want a XML document! I need a HTML document. Are you sure that that is the only possible explanation? I think not, and if not, then it is not accurate to say that that is the obvious answer. I did try changing the extension from html to XML and loading that directly into IE. I did get errors. When I fixed the errors, the document loaded into IE, but of course it was shown as-is. That is not what I need; I need the HTML to be processed (formatted). When I load the corrected document in using domxml_open_file, it still does not load, regardlous of whether the extension is xml or html. So your answer is rather cryptic. I need to load a file that can be created and edited using a WYSIWYG editer, such as FrontPage. Then I need to modify it (to do things such as fill in a table) using the DOM and then show that. Perhaps the XML DOM is not capable of doing that then saying that the problem is that it is not well-formed is a minor detail and the answer is that I need HTML DOM functions instead of XML DOM. In other words, perhaps PHP cannot do what I need. Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's obviously not a well-formed XML Document... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
DOMDocument-loadHTMLFile is what I was using when I was unable to get the domxml enabled. The documentation is confusing; I don't know if the DOM in PHP (which includes DOMDocument-loadHTMLFile) will replace the XML DOM, or if the XML DOM will repalce the DOM or if they are two different things and both will continue to exist. However it does make sense that I need to use DOMDocument-loadHTMLFile. As I said, I got confused. So if I need to use DOM instead of DOM XML then I need to enable DOM instead of DOM XML. I have enabled the domxml extension; is there a different extension that I need for DOM (DOMDocument-loadHTMLFile)? Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] DOMXML can basically only load well-formed XML documents and does this quite well. If it doesn't work, you are doing something wrong or your XML/HTML document is not wellformed. It's that simple.. And yes, FrontPage, doesn't produce well-formed code ;) But... There is a solution, which maybe helps, see http://ch.php.net/manual/en/function.dom-domdocument-loadhtmlfile.php This function can load HTML into a DOM Document without having to be well-formed chregu On Sun, 29 Aug 2004 05:56:51 -0700, Sam Hobbs [EMAIL PROTECTED] wrote: I don't want a XML document! I need a HTML document. Are you sure that that is the only possible explanation? I think not, and if not, then it is not accurate to say that that is the obvious answer. I did try changing the extension from html to XML and loading that directly into IE. I did get errors. When I fixed the errors, the document loaded into IE, but of course it was shown as-is. That is not what I need; I need the HTML to be processed (formatted). When I load the corrected document in using domxml_open_file, it still does not load, regardlous of whether the extension is xml or html. So your answer is rather cryptic. I need to load a file that can be created and edited using a WYSIWYG editer, such as FrontPage. Then I need to modify it (to do things such as fill in a table) using the DOM and then show that. Perhaps the XML DOM is not capable of doing that then saying that the problem is that it is not well-formed is a minor detail and the answer is that I need HTML DOM functions instead of XML DOM. In other words, perhaps PHP cannot do what I need. Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's obviously not a well-formed XML Document... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
Correction: the documentation is quite clear in saying that the DOM extension is the replacement for the DOM XML extension. So that is further indication that I should use DOM not DOM XML. Sam Hobbs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] DOMDocument-loadHTMLFile is what I was using when I was unable to get the domxml enabled. The documentation is confusing; I don't know if the DOM in PHP (which includes DOMDocument-loadHTMLFile) will replace the XML DOM, or if the XML DOM will repalce the DOM or if they are two different things and both will continue to exist. However it does make sense that I need to use DOMDocument-loadHTMLFile. As I said, I got confused. So if I need to use DOM instead of DOM XML then I need to enable DOM instead of DOM XML. I have enabled the domxml extension; is there a different extension that I need for DOM (DOMDocument-loadHTMLFile)? Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] DOMXML can basically only load well-formed XML documents and does this quite well. If it doesn't work, you are doing something wrong or your XML/HTML document is not wellformed. It's that simple.. And yes, FrontPage, doesn't produce well-formed code ;) But... There is a solution, which maybe helps, see http://ch.php.net/manual/en/function.dom-domdocument-loadhtmlfile.php This function can load HTML into a DOM Document without having to be well-formed chregu On Sun, 29 Aug 2004 05:56:51 -0700, Sam Hobbs [EMAIL PROTECTED] wrote: I don't want a XML document! I need a HTML document. Are you sure that that is the only possible explanation? I think not, and if not, then it is not accurate to say that that is the obvious answer. I did try changing the extension from html to XML and loading that directly into IE. I did get errors. When I fixed the errors, the document loaded into IE, but of course it was shown as-is. That is not what I need; I need the HTML to be processed (formatted). When I load the corrected document in using domxml_open_file, it still does not load, regardlous of whether the extension is xml or html. So your answer is rather cryptic. I need to load a file that can be created and edited using a WYSIWYG editer, such as FrontPage. Then I need to modify it (to do things such as fill in a table) using the DOM and then show that. Perhaps the XML DOM is not capable of doing that then saying that the problem is that it is not well-formed is a minor detail and the answer is that I need HTML DOM functions instead of XML DOM. In other words, perhaps PHP cannot do what I need. Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's obviously not a well-formed XML Document... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
Under domxml phpinfo shows the libxml Version as 20510 and it says that HTML Support is enabled. Is that what you mean? When I say: $Document = DOMDocument::loadHTMLFile(DynamicTable.html); print $Document-saveHTML(); It says: Fatal error: Call to undefined function: loadhtmlfile() in Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If loadHTMLFile doesn't work, your libxml2 doesn't maybe have HTML support, phpinfo() should tell you that (under the domxml section) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Simultaneus execution
Now look - I want to make a test/debug engine, that will optimize the performance of each machine I make tests on - my idea is to run as many similar processes as possible in the tasklist of the OS. That would be the same as creating multiple child processes of a single script. The results will be - flooding the RAM, decrees CPU performance, that kind of stuff, but in the end I should have stats about how each machine performed in different disciplines - db querying (insert/select), file manipulations, etc. I was thinking to create child script (that I want executed more than once) and additional socket script, that should connect to the child script through HTTP and execute it. In the end the child script would send a message to the socket that would close it. The nice thing about sockets is that they shouldn't wait the previous socket to close, before next is opened, so what I would do is similar to opening, for example, 500 browser windows and load one same page. Any ideas are welcome. Regards, Andrew Eugene [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Maybe you can use classes in this case? I'm using them when I need to process the same object or to assign some simultaneous actions to many objects at the same time. Sunday, August 29, 2004, 6:40:42 AM, you wrote: An example would be the execution of a function. Let's say that I can't execute one same function twice, but how can I execute it again, before the first execution has completed? Regards, Andrew Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sunday 29 August 2004 09:56, Andrew wrote: Do anyone have an idea how to execute 2 different functions in the same moment, no matter if they're system or custom ones. For example, how can I execute 2 different loops simultaneously? I'm curious at what you're trying to achieve. Could you elaborate? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* QOTD: What do you mean, you had the dog fixed? Just what made you think he was broken! */ -- Best regards, Eugene mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simultaneus execution
Andrew wrote: Now look - I want to make a test/debug engine, that will optimize the performance of each machine I make tests on - my idea is to run as many similar processes as possible in the tasklist of the OS. That would be the same as creating multiple child processes of a single script. The results will be - flooding the RAM, decrees CPU performance, that kind of stuff, but in the end I should have stats about how each machine performed in different disciplines - db querying (insert/select), file manipulations, etc. I was thinking to create child script (that I want executed more than once) and additional socket script, that should connect to the child script through HTTP and execute it. In the end the child script would send a message to the socket that would close it. The nice thing about sockets is that they shouldn't wait the previous socket to close, before next is opened, so what I would do is similar to opening, for example, 500 browser windows and load one same page. You can use sockets in nonblocking mode. I hope I got what you want to achieve. See socket_set_nonblock() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strcasecmp()
? $first_name = Hello; $second_name = Hello; if(strcasecmp($first_name,$second_name)) { echo words are equal; } else { echo words are not equal.; } ? .. In strcasecmp() - this comparison will return 0 - interpreted by PHP as FALSE - eventhough words are _equal_ so what will execute is words are not equal. whereas if the negation symbol of ! is inserted as in: ... ? $first_name = Hello; $second_name = Hello; if(!strcasecmp($first_name,$second_name)) { echo words are equal; } else { echo words are not equal.; } ? ... to read if the comparsion which is returned is not _FALSE_ excecute: words are equal. . Am I on the right track with this logic? Thank you. TR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
Perhaps it will be easier if I just install PHP 5. If I do, then I will need to also get the hsoting company that hosts my site to install it. Hopefully that won't be a problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strcasecmp()
Anthony Ritter wrote: ? $first_name = Hello; $second_name = Hello; if(strcasecmp($first_name,$second_name)) { echo words are equal; } else { echo words are not equal.; } ? if(strcasecmp($first_name,$second_name)===0) { echo 'words are equal'; } else { echo 'words are not equal'; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] print a element of a column
Hi, I want to print each element of a column of a mysql database. For exemple to print the first element could we do like this: Code: $result = mysql_query( SELECT username FROM users ); $column = mysql_fetch_array($result); print $column[1]; print $column[3]; Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loading a html file using DOM XML
Look at: http://simplesamples.info/Tests/PHPinfo.php That is not my local system but it is the information for the server that I will need to implement on. If anyone can give a hint of what I need to ask for to get DOM enabled there, then that will help. Or should I ask them to install PHP 5? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] print a element of a column
devil_online wrote: Hi, I want to print each element of a column of a mysql database. For exemple to print the first element could we do like this: Code: $result = mysql_query( SELECT username FROM users ); $column = mysql_fetch_array($result); print $column[1]; print $column[3]; Thanks You need to loop thru the result set if it's going to return more than one row while ( $column = mysql_fetch_array ( $result ) { print $column[0]; } In your query above, there won't be a $column[1] [2], etc., since you're only selecting 'username'. 'username' will be the first and only element. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simultaneus execution
That was exactly what I thought, but I was thinking of some internal method, that would do the same thing as socket_set_noblock() for the process of execution. Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Andrew wrote: Now look - I want to make a test/debug engine, that will optimize the performance of each machine I make tests on - my idea is to run as many similar processes as possible in the tasklist of the OS. That would be the same as creating multiple child processes of a single script. The results will be - flooding the RAM, decrees CPU performance, that kind of stuff, but in the end I should have stats about how each machine performed in different disciplines - db querying (insert/select), file manipulations, etc. I was thinking to create child script (that I want executed more than once) and additional socket script, that should connect to the child script through HTTP and execute it. In the end the child script would send a message to the socket that would close it. The nice thing about sockets is that they shouldn't wait the previous socket to close, before next is opened, so what I would do is similar to opening, for example, 500 browser windows and load one same page. You can use sockets in nonblocking mode. I hope I got what you want to achieve. See socket_set_nonblock() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Overloading in PHP5
Daniel Schierbeck wrote: Stefan wrote: It's a bug. * Siehe http://bugs.php.net/bug.php?id=28444 ... und ... * http://news.php.net/php.bugs/63652 A workaround is possible using __call( $name, $args) { return( $this-__get( $name)); }. But it sucks, since constructs using array indices are impossible as $obj-not_existing_attr()[0] regards Daniel Schierbeck wrote: Do you guys have any idea why this code: ?php class Foo { private $elem = array(); public function __get ($prop) { if (isset($this-elem[$prop])) { return $this-elem[$prop]; } else { trigger_error(Property '$prop' not defined, E_USER_ERROR); } } public function __set ($prop, $val) { $this-elem[$prop] = $val; } } $obj = new Foo; $obj-a = new Foo; $obj-a-b = Foobar; ? returns this: Fatal error: Cannot access undefined property for object with overloaded property access in ... on line 24 Where line 24 is: $obj-a-b = Foobar; ? %!#%%(/)((%%!#%%#!%#! Calm down, calm down... it's not good for your health :D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't my echo won't work? [newbie question]
John Nichel wrote: [EMAIL PROTECTED] wrote: The first two of these 3 echo statements work. But my last echo doesn't. 'username' is the name of the element I want to echo. To the right of each is what I see echoed. echo $_SERVER['REQUEST_METHOD']; echos - POST echo $_POST; echos - Array echo $_POST['username']; echos - nothing How are you setting $_POST['username']? Let's see the code for the form. Members in $_POST array are set (mostly) by submitting a form with POST method, make sure your form is not submitting by GET. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic HTML Creation
Sam Hobbs wrote: Ramil Sagum [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ah. You should have said this in your first mail (which was confusing). It now becomes clear. I think what you are looking for is a template engine, like smarty http://smarty.php.net/ If Smarty is a good solution that the other osCommerce users and developers agree is useful, then yes, I should have said more in my original question. If however Smarty is not a good solution for osCommerce, then explaining that I am modifying osCommerce would have been confusing and distracting. I like the idea of separating the UI from the program. Programmers and software designers have been doing that for many years. It is usually easier to keep the UI separate from the processing and then have tags of some type in the UI that allows the processing to put data into the UI and pluck it out. That type of thing can be done using HTML too. There are some disadvantages of using HTML and the DOM but I suspect there are limitations of Smarty too. If it is possible to use HTML and the DOM then there are significant advantages to using an existing standard that is in common use. If a web site is hosted in a server owned by someone else and if the server's owner (which includes the employees) must install Smarty befor it can be used, then that is a critical disadvantage of Smarty. So do you know of specific advantages of Smarty compated to using the HTML and DOM standards? Without spending a lot of time to learn Smarty, it is difficult for me to see the advantages. Smarty is a template engine, you can download it and embed it in your application, it's not necessary to 'install' it on the server. I suggest you read some overview of Smarty, you'll get the idea really fast. It's easy to understand... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't my echo won't work? [newbie question]
FrzzMan wrote: John Nichel wrote: [EMAIL PROTECTED] wrote: The first two of these 3 echo statements work. But my last echo doesn't. 'username' is the name of the element I want to echo. To the right of each is what I see echoed. echo $_SERVER['REQUEST_METHOD']; echos - POST echo $_POST; echos - Array echo $_POST['username']; echos - nothing How are you setting $_POST['username']? Let's see the code for the form. Members in $_POST array are set (mostly) by submitting a form with POST method, make sure your form is not submitting by GET. The first echo statement from the OP shows that the request method is *not* GET. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 5.0.1 broke mbstring regex?
Miles Keaton wrote: I just upgraded PHP from 5.0 to 5.0.1 on a FreeBSD box. But unfortunately it seemed to break the regex features of mbstring At startup and every time I try to run PHP I get this: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20040412/mbstring.so' - /usr/local/lib/php/20040412/mbstring.so: Undefined symbol quot;zif_mb_regex_encodingquot; in Unknown on line 0 Anyone heard of this problem or suggest a solution? Gerard Samuel [EMAIL PROTECTED] wrote: Dont cross post your messages to other lists Most likely a FreeBSD problem, where you didn't read /usr/ports/UPDATING Since I have no other platform to test on except FreeBSD, there is no way to tell if it is a FreeBSD-only error, but I doubt it. No there's no news on it in the UPDATING file. I feel it may actually be a PHP error with mbstring regex in the newest PHP 5.0.1 - but won't know until another PHP user on another platform gives it a try. When I turn off the regex option of mbstring, PHP works without error again. Can someone else using PHP 5.0.1 try mbstring regex and see if it works? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
Since posting the original copy of this message -- which, in 10 hours, never appeared on this newsgroup -- I upgraded from PHP version 4.3.4 to 5.0.1. Unfortunately, the same exact problem persists. I'm starting to believe this is a bug in PHP's MySQL memory management functions. Original Post: - I've set up several tests to try to find some way to get the mysql_close() function to work without throwing warning: Warning: mysql_close(): ## is not a valid MySQL-Link resource (where ## is some number like 18 or 39) The most robust form of these tests involves a database connection management class. The entirety of the class code is too large to post here, but these two methods should illustrate the management of the MySQL connection handle (there is a class property called hndConnection): ===CODE=== function openDatabase() { $bvStatus = false; // Close any open connection. $this-closeDatabase(); // Attempt to establish a connection to the target database host. $this-hndConnection = mysql_connect($this-DATA_HOSTNAME, $this-DATA_USER, $this-DATA_PASSWORD); if (0 $this-hndConnection) { // Connection succeeded; access the target database; if (mysql_select_db($this-DATA_DATABASE, $this-hndConnection)) { $this-bConnected = true; $bvStatus = true; } else { // Database selection failed; purge the database host connection. $this-closeDatabase(); } } else { // Connection failed; purge the handle. $this-hndConnection = NULL; } return ($bvStatus); } function closeDatabase() { $bvStatus = false; if ($this-isConnected()) { // Connected; try to close the connection. if (mysql_close($this-hndConnection)) { // Close attempt succeeded. $this-bConnected = false; $this-hndConnection = NULL; $bvStatus = true; } else { // Close attempt failed. $bvStatus = false; } } else { // No open connection; close was successful. Be sure the connection handle is purged. $bvStatus = true; $this-hndConnection = NULL; } return ($bvStatus); } ===/CODE=== As you can imagine, openDatabase() works just fine. I am able to use the open MySQL connection in all its facets. However, when it comes time to close the connection, closeDatabase() fails with the above-stated PHP Warning. As for mysql_free_result(), I get the same type of PHP Warning when I try to run a query and dump the results. For example, I get another PHP Warning complaining about not a valid MySQL-Link resource when I try to ($hndResult brings the same Warning from mysql_free_result(), even though -- as you can see -- it is clearly being used just like the PHP documentation advises): ===CODE=== function runQuery($szQuery) { $ivRecordCount = -1; $bvSelectQuery = false; $hndResult = 0; // Identify whether the current query is a SELECT statement (or empty). if (0 strlen($szQuery)) { $bvSelectQuery = stristr(substr(ltrim($szQuery), 0, 6), SELECT); // Open the database connection if it is closed; proceed only with a valid connection. if ($this-ensureConnection()) { // Run the query. $hndResult = mysql_query($szQuery, $this-getConnectionHandle()); // Check to see whether the query succeeded. if ($hndResult) { if ($bvSelectQuery) { $ivRecordCount = mysql_num_rows($hndResult); } else { $ivRecordCount = mysql_affected_rows($this-getConnectionHandle()); } // Purge memory used by this query. mysql_free_result($hndResult); } } } return ($ivRecordCount); } ===/CODE=== As you can see in this later method, the result handle is created and used only within several lines of code of each other, yet, the resource is already invalid by the time I try to use it. What's up? Naturally, the concept of these code samples came right out of PHP's documentation, yet they don't work. Can anyone illustrate a workaround to use these two mysql_* functions successfully? Incidentally, please don't waste time preaching about these functions not needed because all resources are closed at the end of the script's life. My programming philosophy differs from such a lazy approach, and I will not humor it. Please limit replies to constructive workarounds. Thanks! -- William Kimball, Jr. Programming is an art-form that fights back! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
William wrote: Since posting the original copy of this message -- which, in 10 hours, never appeared on this newsgroup -- I upgraded from PHP version 4.3.4 to 5.0.1. Unfortunately, the same exact problem persists. I'm starting to believe this is a bug in PHP's MySQL memory management functions. Original Post: - I've set up several tests to try to find some way to get the mysql_close() function to work without throwing warning: Warning: mysql_close(): ## is not a valid MySQL-Link resource (where ## is some number like 18 or 39) snip @mysql_close(); -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't my echo won't work? [newbie question]
Try using braces around $_POST or any superglobal you use: print_r($_POST); print brbr{$_SERVER['REQUEST_METHOD']}; print brbr{$_POST['username']}; Works for me. Hth, Andre On Sunday 29 August 2004 01:13 pm, John Nichel wrote: FrzzMan wrote: John Nichel wrote: [EMAIL PROTECTED] wrote: The first two of these 3 echo statements work. But my last echo doesn't. 'username' is the name of the element I want to echo. To the right of each is what I see echoed. echo $_SERVER['REQUEST_METHOD']; echos - POST echo $_POST; echos - Array echo $_POST['username']; echos - nothing How are you setting $_POST['username']? Let's see the code for the form. Members in $_POST array are set (mostly) by submitting a form with POST method, make sure your form is not submitting by GET. The first echo statement from the OP shows that the request method is *not* GET. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hire a developer
Hello, I'm needing to hire a developer to finish up some cart work that a previous developer started. If you wish to have more information on this project, please contact me off-list: joshua$abbott[at]crystalstream[dot]net replacing: $ with . [at] with @ [dot] with . Thanks Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mime type and PECL::Fileinfo.
Hi, PHP 4.3.8, Apache 1.3.31, Debian/GNU Linux Is anybody using PECL extensions ? I want to let people upload data to a site I'm building and want to avoid using mime_content_type because from the manual :- This extension has been deprecated as the PECL extension fileinfo provides the same functionality (and more) in a much cleaner way. After much messing about I eventually managed to work out how to install the package :- download Fileinfo from pecl.php.net pear install ./Fileinfo I had to install the magic library, libtools etc. before this would work. My question now is, how do I call the fileinfo function and where do I find any sensible documentation on it and what does it return ? Currently, I'm downloading and installing the XML2 libs so I can install php5 to see if it works any better :-( This has to be the worst experience I have had with PHP, there just seems to be no documentation on PECL aimed at an end user. Regards, Dave php/2004-08-30.tx php-general ++ | Dave Restall, IIRC Limited, PO Box 46, Skelton, Cleveland, TS12 2GT. | | Tel. 0845 10 80 151Mob. +44 (0) 7973 831245 Int. +44 (0) 1287 653003 | | email : [EMAIL PROTECTED] [EMAIL PROTECTED] Web : http://www.iirc.net | ++ | When you dig another out of trouble, you've got a place to bury your own. | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
I can accept that as a workaround, but I was hoping to do more than merely mute the warnings. Is there a way to truly use the connection and result set handles? Can PHP truly utilize it's own connection resource handles in code? Bottom Line: This is going to make a real mess when multiple database connections need to be used and when multiple query results need to be managed simultaneously. -- -- William Kimball, Jr. Programming is an art-form that fights back! John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : William wrote: : : Since posting the original copy of this message -- which, in 10 hours, never appeared on this newsgroup -- I upgraded : from PHP version 4.3.4 to 5.0.1. Unfortunately, the same exact problem persists. I'm starting to believe this is a bug : in PHP's MySQL memory management functions. : : Original Post: : - : I've set up several tests to try to find some way to get the mysql_close() function to work without throwing warning: : : Warning: mysql_close(): ## is not a valid MySQL-Link resource : (where ## is some number like 18 or 39) : snip : : @mysql_close(); : : -- : By-Tor.com : It's all about the Rush : http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
William wrote: I can accept that as a workaround, but I was hoping to do more than merely mute the warnings. Is there a way to truly use the connection and result set handles? Can PHP truly utilize it's own connection resource handles in code? Bottom Line: This is going to make a real mess when multiple database connections need to be used and when multiple query results need to be managed simultaneously. mysql_close and mysql_free_result work fine for me in 4.3.4 and higher as long as you pass it a valid resource, using multiple connections, and multiple result sets. Well, you don't have to pass mysql_close a resource at all, but if you do, it *has* to be valid. The only time I see the error you described in the original message was when I don't pass a valid resource. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 5.0.1 broke mbstring regex?
Miles Keaton wrote: Miles Keaton wrote: I just upgraded PHP from 5.0 to 5.0.1 on a FreeBSD box. But unfortunately it seemed to break the regex features of mbstring At startup and every time I try to run PHP I get this: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20040412/mbstring.so' - /usr/local/lib/php/20040412/mbstring.so: Undefined symbol quot;zif_mb_regex_encodingquot; in Unknown on line 0 Anyone heard of this problem or suggest a solution? Gerard Samuel [EMAIL PROTECTED] wrote: Dont cross post your messages to other lists Most likely a FreeBSD problem, where you didn't read /usr/ports/UPDATING Since I have no other platform to test on except FreeBSD, there is no way to tell if it is a FreeBSD-only error, but I doubt it. No there's no news on it in the UPDATING file. I feel it may actually be a PHP error with mbstring regex in the newest PHP 5.0.1 - but won't know until another PHP user on another platform gives it a try. When I turn off the regex option of mbstring, PHP works without error again. Can someone else using PHP 5.0.1 try mbstring regex and see if it works? Ok, Ill give you the benifit of the doubt, and install php 5 locally and report back of if mbstring is having problems.. Reason why Im said it may be a FBSD problem is because I see you used portupgrade, which in my opinion, is too big of an axe to split match sticks, when coming to upgrade programs, and should be used with caution... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 5.0.1 broke mbstring regex?
I feel it may actually be a PHP error with mbstring regex in the newest PHP 5.0.1 - but won't know until another PHP user on another platform gives it a try. Have you checked OS library dependencies? -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
joshua wrote: If you wish to have more information on this project, please contact me off-list: joshua$abbott[at]crystalstream[dot]net replacing: $ with . [at] with @ [dot] with . I am interested. Can you please contact me at *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c! replacing: $ with e with o [foo] with . (_2_) with @ ps with sp little with big % with k ! with m * with j ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Overloading in PHP5
Frzzman wrote: Daniel Schierbeck wrote: Stefan wrote: It's a bug. * Siehe http://bugs.php.net/bug.php?id=28444 ... und ... * http://news.php.net/php.bugs/63652 A workaround is possible using __call( $name, $args) { return( $this-__get( $name)); }. But it sucks, since constructs using array indices are impossible as $obj-not_existing_attr()[0] regards Daniel Schierbeck wrote: Do you guys have any idea why this code: ?php class Foo { private $elem = array(); public function __get ($prop) { if (isset($this-elem[$prop])) { return $this-elem[$prop]; } else { trigger_error(Property '$prop' not defined, E_USER_ERROR); } } public function __set ($prop, $val) { $this-elem[$prop] = $val; } } $obj = new Foo; $obj-a = new Foo; $obj-a-b = Foobar; ? returns this: Fatal error: Cannot access undefined property for object with overloaded property access in ... on line 24 Where line 24 is: $obj-a-b = Foobar; ? %!#%%(/)((%%!#%%#!%#! Calm down, calm down... it's not good for your health :D Hehe, I'm allright now, I just needed a cold shower... -- Daniel Schierbeck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
If you read the code I posted, you'd see that I am sending valid resources. :) As I explained, I lifted the technique directly from the PHP documentation. Now, if you can see a bug in my implementation of this technique, by all means, please point it out. -- -- William Kimball, Jr. Programming is an art-form that fights back! John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : William wrote: : : I can accept that as a workaround, but I was hoping to do more than merely mute the warnings. Is there a way to truly : use the connection and result set handles? Can PHP truly utilize it's own connection resource handles in code? : : Bottom Line: This is going to make a real mess when multiple database connections need to be used and when multiple : query results need to be managed simultaneously. : : : mysql_close and mysql_free_result work fine for me in 4.3.4 and higher : as long as you pass it a valid resource, using multiple connections, and : multiple result sets. Well, you don't have to pass mysql_close a : resource at all, but if you do, it *has* to be valid. The only time I : see the error you described in the original message was when I don't : pass a valid resource. : : -- : By-Tor.com : It's all about the Rush : http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
John Holmes wrote: I am interested. Can you please contact me at *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c! replacing: $ with e with o [foo] with . (_2_) with @ ps with sp little with big % with k ! with m * with j ;) There's got to be a regular expression in there somewhere. ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hire a developer
-Original Message- joshua wrote: If you wish to have more information on this project, please contact me off-list: joshua$abbott[at]crystalstream[dot]net replacing: $ with . [at] with @ [dot] with . I am interested. Can you please contact me at *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c! replacing: $ with e with o [foo] with . (_2_) with @ ps with sp little with big % with k ! with m * with j ;) We should come up with a regexp for parsing John's email addy :P hehe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
great stuff john On Sun, 29 Aug 2004 11:52:16 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- joshua wrote: If you wish to have more information on this project, please contact me off-list: joshua$abbott[at]crystalstream[dot]net replacing: $ with . [at] with @ [dot] with . I am interested. Can you please contact me at *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c! replacing: $ with e with o [foo] with . (_2_) with @ ps with sp little with big % with k ! with m * with j ;) We should come up with a regexp for parsing John's email addy :P hehe -- 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] Hire a developer
John Nichel wrote: John Holmes wrote: I am interested. Can you please contact me at *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c! replacing: $ with e with o [foo] with . (_2_) with @ ps with sp little with big % with k ! with m * with j ;) There's got to be a regular expression in there somewhere. ;) No, no...you'll confuse them. [foo] is a literal string, not a regex!! ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
William wrote: If you read the code I posted, you'd see that I am sending valid resources. :) As I explained, I lifted the technique directly from the PHP documentation. Now, if you can see a bug in my implementation of this technique, by all means, please point it out. Please limit replies to constructive workarounds. Well, since you *know* that all your resources are valid, why don't you echo out mysql_error() after you make a mysql function call. Constructive enough for you? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie questions
Greetings php-general, I'm just starting out with php ... judging from the posts I've been reading on this list I'm thinking this question is so basic it might almost be pathetic! I'm assuming the answers are in the php manual, but I have not found the correct pages ... any pointers to manual pages, tutorials, or an explanation would be greatly appreciated. ?php require_once 'library/functions/dbConnect.php'; class Content { var $db = null; // PEAR::DB pointer function Content($db) { $this-db = $db; } } ? I'm writing my first class following an example I found on the web and I have 2 questions. The constructor for Content accepts an object ... why is $db used instead of $db? I'm used to a this.varName syntax from other languages ... I grasp what is happening with $this-db, but I don't understand the literal translation of - and would like help understanding. -- Best regards, Kevin Bridges mailto:[EMAIL PROTECTED] Independent Contractor 303.809.4427 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
Incase anyone was wanting to hire John, I've cracked the code. Phear me, I great H4x0r. ?php // system requirements: PIV 3.0GHz 1.5GB RAM - 3D graphics accelerator - 14.4 Fax Modem. // make sure your turbo button is in the on position $eml = '*hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!'; $rplc = array ( '$' = 'e', '' = 'o', '[foo]' = '.', '(_2_)' = '@', 'ps' = 'sp', 'little' = 'big', '%' = 'k', '!' = 'm', '*' = 'j' ); while (list($k,$v) = each($rplc)) { echo Got key: $k - replacing with $vbr; if ($v == '@') echo 'Ah-ha! Phear me!br'; $eml = str_replace($k, $v, $eml); } echo 'br /bl33t code Warning/b: phear me in bthis here file/b on line b25/bbr /'; echo 'a href=mailto:'.$eml.''.$eml.'/a'; ? I'd like to suggest this as the official PHP mailing list email format for Mondays, Tuesdays, Rainy days, and all through May... if I may...you hear what I say? Jim Grill - Original Message - From: John Holmes [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, August 29, 2004 4:21 PM Subject: Re: [PHP] Hire a developer joshua wrote: If you wish to have more information on this project, please contact me off-list: joshua$abbott[at]crystalstream[dot]net replacing: $ with . [at] with @ [dot] with . I am interested. Can you please contact me at *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c! replacing: $ with e with o [foo] with . (_2_) with @ ps with sp little with big % with k ! with m * with j ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- 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] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
Why waste time by turning this into an attack? (A rhetorical question, please don't bother addressing it.) I'm pressing for a better answer now because the workaround you posted simply ignores the problem and because you implied that you got these functions to work -- presumably without having to mute warnings (otherwise, your solution is faulted). Just take a few minutes of your valuable time to read the code I posted. I challenge you to find fault with my management of the resource handles. In the end, we may both be better programmers. -- William Kimball, Jr. Programming is an art-form that fights back! John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : William wrote: : : If you read the code I posted, you'd see that I am sending valid resources. :) As I explained, I lifted the technique : directly from the PHP documentation. Now, if you can see a bug in my implementation of this technique, by all means, : please point it out. : : : Please limit replies to constructive workarounds. : : Well, since you *know* that all your resources are valid, why don't you : echo out mysql_error() after you make a mysql function call. : Constructive enough for you? : : -- : By-Tor.com : It's all about the Rush : http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
Jim Grill wrote: Incase anyone was wanting to hire John, I've cracked the code. Phear me, I great H4x0r. ?php // system requirements: PIV 3.0GHz 1.5GB RAM - 3D graphics accelerator - 14.4 Fax Modem. // make sure your turbo button is in the on position $eml = '*hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!'; $rplc = array ( '$' = 'e', '' = 'o', '[foo]' = '.', '(_2_)' = '@', 'ps' = 'sp', 'little' = 'big', '%' = 'k', '!' = 'm', '*' = 'j' ); while (list($k,$v) = each($rplc)) { echo Got key: $k - replacing with $vbr; if ($v == '@') echo 'Ah-ha! Phear me!br'; $eml = str_replace($k, $v, $eml); } echo 'br /bl33t code Warning/b: phear me in bthis here file/b on line b25/bbr /'; echo 'a href=mailto:'.$eml.''.$eml.'/a'; ? I'd like to suggest this as the official PHP mailing list email format for Mondays, Tuesdays, Rainy days, and all through May... if I may...you hear what I say? lol.. you guys crack me up. Wouldn't str_replace(array_keys($rplc),$rplc,$eml); be better, though? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
William wrote: Why waste time by turning this into an attack? (A rhetorical question, please don't bother addressing it.) I'm pressing for a better answer now because the workaround you posted simply ignores the problem and because you implied that you got these functions to work -- presumably without having to mute warnings (otherwise, your solution is faulted). Just take a few minutes of your valuable time to read the code I posted. I challenge you to find fault with my management of the resource handles. In the end, we may both be better programmers. Programming languages do not make things up. If you say mysql_close($anyvariable) and PHP says that $anyvariable is not a MySQL connection resource, then it's not. No, it's not. Shh. It's not. If you can reduce what you're seeing to the smallest amount of code possible and still reproduce this problem, then maybe it's a bug. I have 5.0.0 installed and will install 5.0.1 just for you if you can give me the smallest amount of code that reproduces this problem to help you test. Otherwise, use @ and turn a blind eye... ;) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Binary refresher needed
Okay, I need a reminder on this. A given variable can consist of two constants ORd together, say TEST1 and TEST2. If I'm looking to see if one of the constants was set in the variable, I use , right? if(($value TEST1) == TEST1) { echo 'TEST1 flag was set.'; } if(($value TEST2) == TEST2) { echo 'TEST2 flag was set.'; } I know that works, but is that the best way? Been a while since I played with this... :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
Jim Grill wrote: Incase anyone was wanting to hire John, I've cracked the code. Phear me, I great H4x0r. I'd like to suggest this as the official PHP mailing list email format for Mondays, Tuesdays, Rainy days, and all through May... if I may...you hear what I say? lol.. you guys crack me up. Wouldn't str_replace(array_keys($rplc),$rplc,$eml); be better, though? Damn... You are master l33t H4X0r. Exploiting esoteric features of str_replace by passing array as argX0rz. I make postings on the Sourceforge and make your name on the head developer. We be pheared by all!! Muhahaha ?php /** [EMAIL PROTECTED] John Holmes */ // system requirements: PIV 3.0GHz 1.5GB RAM - 3D graphics accelerator - 14.4 Fax Modem. $eml = '*hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!'; $rplc = array ( '$' = 'e', '' = 'o', '[foo]' = '.', '(_2_)' = '@', 'ps' = 'sp', 'little' = 'big', '%' = 'k', '!' = 'm', '*' = 'j' ); $eml = str_replace(array_keys($rplc),$rplc,$eml); echo 'br /bl33t code Warning/b: phear John in bthis here file/b on line b18/bbr /'; echo 'a href=mailto:'.$eml.''.$eml.'/a'; ? hehe (poor english faked for comedy purposes) Jim Grill -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
William wrote: Why waste time by turning this into an attack? (A rhetorical question, please don't bother addressing it.) I'm pressing for a better answer now because the workaround you posted simply ignores the problem and because you implied that you got these functions to work -- presumably without having to mute warnings (otherwise, your solution is faulted). Just take a few minutes of your valuable time to read the code I posted. I challenge you to find fault with my management of the resource handles. In the end, we may both be better programmers. Go 'challenge' someone else. I gave you a 'constructive workaround', you didn't like it. I gave you the non-'lazy approach' to help you find your problem, but you want to take the 'lazy approach' and 'challenge' us to find it for you. It's really simple. If the php mysql functions tell you it's not a valid link, then it isn't; no matter what you think it is or isn't. Use mysql_error, break down sections of your code, ensure that you're getting back/passing data that you think you are, and track the problem down. That's how to become a better programmer. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
John Holmes wrote: Programming languages do not make things up. If you say mysql_close($anyvariable) and PHP says that $anyvariable is not a MySQL connection resource, then it's not. No, it's not. Shh. It's not. If you can reduce what you're seeing to the smallest amount of code possible and still reproduce this problem, then maybe it's a bug. I have 5.0.0 installed and will install 5.0.1 just for you if you can give me the smallest amount of code that reproduces this problem to help you test. Otherwise, use @ and turn a blind eye... ;) ...and what the hell is up with the clock on your computer, John?!?! ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Binary refresher needed
John Holmes wrote: Okay, I need a reminder on this. A given variable can consist of two constants ORd together, say TEST1 and TEST2. If I'm looking to see if one of the constants was set in the variable, I use , right? if(($value TEST1) == TEST1) { echo 'TEST1 flag was set.'; } if(($value TEST2) == TEST2) { echo 'TEST2 flag was set.'; } I know that works, but is that the best way? Been a while since I played with this... :) Just if($value TEST1) { ... } is enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie questions
The constructor for Content accepts an object ... why is $db used instead of $db? $variable means to pass the variable by reference (as opposed to passing by value, which is the default). Instead of making a copy of the variable, you are telling $this-db to point to the same point in memory as the original $db - in effect you are using two names to point to the same data. If you modify $this-db, $db will also be modified and vice versa. Only the author of the code could tell you exactly why they chose to do things this way, but one possible reason is that when you close the database link (using $this-db-disconnect() if it's PEAR::DB) it will disconnect all the pointers to that link rather than just the one local to the class (which would be the case if it was passed in by value). Passing a reference rather than a copy also means you're not storing multiple database links in memory which could affect performance if the code was called often (e.g. on a busy web site). Hope this helps, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
?php for(${chr(0x5F)}=chr(0x61),${0x0}=0x61,${0x2A}=0;${0x0}!=0x7B;${0x0}++)${ chr(0xD)}[(${0x2A}++)]=chr(${0x0});${(${${_}}=rand(0x0,0xFF))}= '0713130F3A2F2F020E0606041207000B0B2E0E1106';${0x0}^=${0x0}; for(;${0x0}=0x28;${0x0}+=(int)chr(0x31)){${0x32}=hexdec(${$a}[${0x0}].${$a}[${0x0}+1]);@${$z}.=(${0x32}0x19)?chr(${0x32}):${ chr(0xD)}[${0x32}];++${0x0};}echo {${}}\n? :-D John On Sun, 2004-08-29 at 18:57, John Holmes wrote: Jim Grill wrote: Incase anyone was wanting to hire John, I've cracked the code. Phear me, I great H4x0r. ?php // system requirements: PIV 3.0GHz 1.5GB RAM - 3D graphics accelerator - 14.4 Fax Modem. // make sure your turbo button is in the on position $eml = '*hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!'; $rplc = array ( '$' = 'e', '' = 'o', '[foo]' = '.', '(_2_)' = '@', 'ps' = 'sp', 'little' = 'big', '%' = 'k', '!' = 'm', '*' = 'j' ); while (list($k,$v) = each($rplc)) { echo Got key: $k - replacing with $vbr; if ($v == '@') echo 'Ah-ha! Phear me!br'; $eml = str_replace($k, $v, $eml); } echo 'br /bl33t code Warning/b: phear me in bthis here file/b on line b25/bbr /'; echo 'a href=mailto:'.$eml.''.$eml.'/a'; ? I'd like to suggest this as the official PHP mailing list email format for Mondays, Tuesdays, Rainy days, and all through May... if I may...you hear what I say? lol.. you guys crack me up. Wouldn't str_replace(array_keys($rplc),$rplc,$eml); be better, though? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- John Coggeshall http://www.coggeshall.org/ The PHP Developer's Handbookhttp://www.php-handbook.com/ -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: newbie questions
Kevin Bridges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Greetings php-general, I'm just starting out with php ... judging from the posts I've been reading on this list I'm thinking this question is so basic it might almost be pathetic! I'm assuming the answers are in the php manual, but I have not found the correct pages ... any pointers to manual pages, tutorials, or an explanation would be greatly appreciated. ?php require_once 'library/functions/dbConnect.php'; class Content { var $db = null; // PEAR::DB pointer function Content($db) { $this-db = $db; } } ? I'm writing my first class following an example I found on the web and I have 2 questions. The constructor for Content accepts an object ... why is $db used instead of $db? I'm used to a this.varName syntax from other languages ... I grasp what is happening with $this-db, but I don't understand the literal translation of - and would like help understanding. Hi Kevin, with PHP4 $db means the value is passed by reference. Otherwise a copy of $db would be passed to the method. See here: http://de2.php.net/references With PHP5 variable assignments or passing variables to functions by reference is standard. $this-db is the PHP equal to this.varName. You access property db of the current object. Methods are called this way: $this-methodName() Hope this clears things up a bit. Best regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] newbie questions
Hello Torsten, Thanks for the answers ... it's all becoming clearer. Sunday, August 29, 2004, 3:08:01 PM, you wrote: TR Hi Kevin, TR with PHP4 $db means the value is passed by reference. Otherwise a copy of TR $db would be passed to the method. See here: TR http://de2.php.net/references TR With PHP5 variable assignments or passing variables to functions by TR reference is standard. $this-db is the PHP equal to this.varName. TR You access property db of the current object. Methods are called this way: TR $this-methodName() TR Hope this clears things up a bit. -- Best regards, Kevin Bridges mailto:[EMAIL PROTECTED] Independent Contractor 303.809.4427 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
The problem turned out to be a run-time bug with object instances (of the same class) stepping on each other. More specifically, PHP doesn't seem to differentiate between a flat script-level $ovConn object and a new instance of $ovConn that gets fired up in an unrelated object's method at run-time. When the latter object unloads, both instances of $ovConn lose their database connection resource handles. I have determined this through extensive debug logging through tracing all method calls. I will troubleshoot this further and try to find a way to get PHP to separate the two instances of $ovConn so one doesn't kill the other's resource handle. Please keep your responses professional; this newsgroup/list is the first contact for people needing help with PHP -- even if it's their own fault. Your enflamed, emotionally charged reactions help no one and seem only to serve your own ego. This matter is closed. Good day. -- -- William Kimball, Jr. Programming is an art-form that fights back! John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] : William wrote: : : Why waste time by turning this into an attack? (A rhetorical question, please don't bother addressing it.) : : I'm pressing for a better answer now because the workaround you posted simply ignores the problem and because you implied : that you got these functions to work -- presumably without having to mute warnings (otherwise, your solution is faulted). : Just take a few minutes of your valuable time to read the code I posted. I challenge you to find fault with my : management of the resource handles. In the end, we may both be better programmers. : : : Go 'challenge' someone else. I gave you a 'constructive workaround', : you didn't like it. I gave you the non-'lazy approach' to help you find : your problem, but you want to take the 'lazy approach' and 'challenge' : us to find it for you. : : It's really simple. If the php mysql functions tell you it's not a : valid link, then it isn't; no matter what you think it is or isn't. Use : mysql_error, break down sections of your code, ensure that you're : getting back/passing data that you think you are, and track the problem : down. That's how to become a better programmer. : : -- : By-Tor.com : It's all about the Rush : http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] attaching a custom icon to a file on server side
I want to attach a custom icon to a dynamically created text file on the server-side when the user downloads the file to his desktop, there is a custom icon...ico file attached to it... is this possible ? g -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Hire a developer
--- John Coggeshall [EMAIL PROTECTED] wrote: ?php for(${chr(0x5F)}=chr(0x61),${0x0}=0x61,${0x2A}=0;${0x0}!=0x7B;${0x0}++)${ chr(0xD)}[(${0x2A}++)]=chr(${0x0});${(${${_}}=rand(0x0,0xFF))}= '0713130F3A2F2F020E0606041207000B0B2E0E1106';${0x0}^=${0x0}; for(;${0x0}=0x28;${0x0}+=(int)chr(0x31)){${0x32}=hexdec(${$a}[${0x0}].${$a}[${0x0}+1]);@${$z}.=(${0x32}0x19)?chr(${0x32}):${ chr(0xD)}[${0x32}];++${0x0};}echo {${}}\n? You forgot the trailing slash. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: attaching a custom icon to a file on server side
[EMAIL PROTECTED] wrote: I want to attach a custom icon to a dynamically created text file on the server-side when the user downloads the file to his desktop, there is a custom icon...ico file attached to it... is this possible ? g nah, you can't embed binary data (icon file) into text file... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: attaching a custom icon to a file on server side
Is there another way to pull this offmaybe if it was a Windows Server ? or compressing the text file and an ico file on the server before download ? g On Aug 29, 2004, at 2:54 PM, FrzzMan wrote: [EMAIL PROTECTED] wrote: I want to attach a custom icon to a dynamically created text file on the server-side when the user downloads the file to his desktop, there is a custom icon...ico file attached to it... is this possible ? g nah, you can't embed binary data (icon file) into text file... -- 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] Hire a developer
John Coggeshall wrote: ?php for(${chr(0x5F)}=chr(0x61),${0x0}=0x61,${0x2A}=0;${0x0}!=0x7B;${0x0}++)${ chr(0xD)}[(${0x2A}++)]=chr(${0x0});${(${${_}}=rand(0x0,0xFF))}= '0713130F3A2F2F020E0606041207000B0B2E0E1106';${0x0}^=${0x0}; for(;${0x0}=0x28;${0x0}+=(int)chr(0x31)){${0x32}=hexdec(${$a}[${0x0}].${$a}[${0x0}+1]);@${$z}.=(${0x32}0x19)?chr(${0x32}):${ chr(0xD)}[${0x32}];++${0x0};}echo {${}}\n? :-D John Congrats dad!! :) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] User email changes verification strategy?
Hello, I'm adding some verification into my user database manager. After a while I come up with some ideas about asking user to verify their email address when they change their email address. But, the strategy is a lil confusing for me. When they change the email address. Where should the verification code be emailed to? Of course it's not the new addy, but what will happen if their old addy became unusable (so they change), can you guys come up with some ideas? I'm confusing... TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_close() and mysql_free_result() don't seem to work in PHP 4.3.4 or 5.0.1. A bug?
William wrote: snip Please keep your responses professional; this newsgroup/list is the first contact for people needing help with PHP -- even if it's their own fault. Your enflamed, emotionally charged reactions help no one and seem only to serve your own ego. This matter is closed. Good day. When you ask a question of this list, or any list for that matter, and end it with... Incidentally, please don't waste time preaching about 'these functions not needed because all resources are closed at the end of the script's life'. My programming philosophy differs from such a lazy approach, and I will not humor it. Please limit replies to constructive workarounds. ...calling those who differ from you lazy, and assuming that there are some on here who aren't going to be constructive...you get what you get. http://www.catb.org/~esr/faqs/smart-questions.html -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: User email changes verification strategy?
Hello, On 08/29/2004 07:13 PM, Frzzman wrote: I'm adding some verification into my user database manager. After a while I come up with some ideas about asking user to verify their email address when they change their email address. But, the strategy is a lil confusing for me. When they change the email address. Where should the verification code be emailed to? Of course it's not the new addy, but what will happen if their old addy became unusable (so they change), can you guys come up with some ideas? I'm confusing... The strategy that I use in the PHP Classes site is to send a message to the new address with a special URL that includes information about the new account identification, the new e-mail address and an authetication token that is the result of combination of the new address and a random secret key stored in a special field of the account for that purpose. This prevents that any user forge e-mail address change request URLs. If the combination of the secret key and the new address do not match the token sent. If you are not a subscriber, subscribe in http://www.phpclasses.org/ and try it yourself to see it working in practice. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with str_replace
Hello people... I have a little problem here... I hope you can help me... I'm building a simple template system for a web site, and I created some tags in a .html file that I read using the file_get_contents() function. The tags I created are something like {menu}, {date}, {user}, etc. Well, the problem shows up when I use the function str_replace({menu}, $var_with_some_menu_links, $html_contents). Nothings happen and when I output the template contents, I see the tags, in other words, nothing gets replaced. Any ideas on what I'm doing wrong? Thank you very much in advance for your help. P.S. Sorry for my bad english. -- Francisco Javier Escoppinichi Fernández Email: [EMAIL PROTECTED] Web: http://www.fire-dragon.net/ MSN: [EMAIL PROTECTED] Cel: 044 (612) 348 91 00 Sólo hay 3 cosas que no vuelven atrás: la palabra emitida, la flecha lanzada y la oportunidad perdida. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with str_replace
Francisco Javier Escoppinichi Fernández wrote: Hello people... I have a little problem here... I hope you can help me... I'm building a simple template system for a web site, and I created some tags in a .html file that I read using the file_get_contents() function. The tags I created are something like {menu}, {date}, {user}, etc. Well, the problem shows up when I use the function str_replace({menu}, $var_with_some_menu_links, $html_contents). Nothings happen and when I output the template contents, I see the tags, in other words, nothing gets replaced. Any ideas on what I'm doing wrong? Thank you very much in advance for your help. Show the code which isn't working. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with str_replace
On Sun, 29 Aug 2004 19:36:49 -0400, John Nichel [EMAIL PROTECTED] wrote: Francisco Javier Escoppinichi Fernández wrote: Hello people... I have a little problem here... I hope you can help me... I'm building a simple template system for a web site, and I created some tags in a .html file that I read using the file_get_contents() function. The tags I created are something like {menu}, {date}, {user}, etc. Well, the problem shows up when I use the function str_replace({menu}, $var_with_some_menu_links, $html_contents). Nothings happen and when I output the template contents, I see the tags, in other words, nothing gets replaced. Any ideas on what I'm doing wrong? Thank you very much in advance for your help. Show the code which isn't working. Here it goes: class.interior.php class Interior { var $html; var $menuLateral; var $buffer; var $titulo; function Interior() // Constructor. Construyo el menú y demás. { $this-html = file_get_contents('plantillas/interior.html'); // Plantilla interior. //$this-menuLateral = file_get_contents('plantillas/menulateral.html'); // Bloque menu lateral. $this-buffer = ''; } function Salida($output) // Agrega cosas a la interfaz de salida. { $this-buffer .= $output; } function Show() // This function outputs the final HTML. It's called by another module. { str_replace({contenido}, $this-buffer, $this-html); str_replace({tituloSeccion}, $this-titulo, $this-html); echo $this-html; } function Titulo($str) { $this-titulo = $str; } function Clear() // Elimino toda la salida y la dejo en blanco. { $this-buffer = ''; } } /class.interior.php the html file !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 / titleInstituto Tecnoloacute;gico de La Paz - {tituloSeccion}/title style type=text/css !-- .center { margin-right: auto; margin-left: auto; width: 779px; border: 1px solid #00; clear: both; display: table; } h2 { visibility: hidden; } .bg { background-repeat: repeat-x; background-position: top; background-image: url(/img/central-interior.png); } body { background-image: url(/img/bg.gif); } -- /style /head body div class=center table width=100% border=0 cellpadding=0 cellspacing=0 bgcolor=#FF tr td width=33%img src=/img/logosep.gif alt=Secretaría de Educación Pública width=145 height=64 //td td width=33%div align=centerimg src=/img/logoseit.gif alt=Dirección General de Institutos Tecnológicos width=121 height=64 //div/td td width=33%div align=rightimg src=/img/logoitlp.gif alt=Instituto Tecnológico de La Paz width=95 height=69 //div/td /tr /table table width=100% border=0 cellpadding=0 cellspacing=3 bgcolor=#FF tr td height=20div align=rightBienvenido, {usuario}./div/td /tr /table table width=779 height=21 border=0 cellpadding=0 cellspacing=0 tr td width=185 height=21 background=/img/barrafecha.png{fecha}/td td background=/img/barramenu.png{menuSuperior}/td /tr /table table width=100% height=36 border=0 cellpadding=0 cellspacing=0 tr td height=36 background=/img/barratitulo.pngdiv align=rightimg src=/util/dynheader.php?text={tituloSeccion} //div/td /tr /table table width=779 border=0 cellspacing=0 cellpadding=0 tr td width=27 height=147 valign=topimg src=/img/marcoizq-interior.png alt=Izquierda width=27 height=147 //td td class=bgp{contenido}/p /td td width=33 height=147 valign=topimg src=/img/marcoder-interior.png alt=Derecha width=33 height=147 //td /tr /table table width=100% border=0 cellspacing=0 cellpadding=0 tr td bgcolor=#FF{menuInferior}/td /tr tr td bgcolor=#FFdiv align=centerimg src=/img/bottom.gif width=758 height=47 border=0 usemap=#Map //div/td /tr /table /div map name=Map id=Map area shape=rect coords=363,23,539,34 href=/w/content/contacto / area shape=rect coords=300,33,449,48 href=/w/content/creditos / /map /body /html /the html file -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Francisco Javier Escoppinichi Fernández Email: [EMAIL PROTECTED] Web: http://www.fire-dragon.net/ MSN: [EMAIL PROTECTED] Cel: 044 (612) 348 91 00 Sólo hay 3 cosas que no vuelven atrás: la palabra emitida, la flecha lanzada y la oportunidad
Re: [PHP] Problem with str_replace
On Sun, 29 Aug 2004 17:45:05 -0600, Francisco Javier Escoppinichi Fernández [EMAIL PROTECTED] wrote: On Sun, 29 Aug 2004 19:36:49 -0400, John Nichel [EMAIL PROTECTED] wrote: Francisco Javier Escoppinichi Fernández wrote: Hello people... I have a little problem here... I hope you can help me... I'm building a simple template system for a web site, and I created some tags in a .html file that I read using the file_get_contents() function. The tags I created are something like {menu}, {date}, {user}, etc. Well, the problem shows up when I use the function str_replace({menu}, $var_with_some_menu_links, $html_contents). Nothings happen and when I output the template contents, I see the tags, in other words, nothing gets replaced. Any ideas on what I'm doing wrong? Thank you very much in advance for your help. Show the code which isn't working. Here it goes: [snip] http://us4.php.net/manual/en/function.str-replace.php I suggest you look at what the func actually does, as its not what you think. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with str_replace
Francisco Javier Escoppinichi Fernndez wrote: str_replace({contenido}, $this-buffer, $this-html); str_replace({tituloSeccion}, $this-titulo, $this-html); You have to capture the results of str_replace()... it returns the string back to you... $this-html = str_replace(...); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with str_replace
Hah! Beginner's mistake! I think I need some rest... I'm skipping some basic details :) *PROBLEM SOLVED* Thank you people... -- Francisco Javier Escoppinichi Fernández Email: [EMAIL PROTECTED] Web: http://www.fire-dragon.net/ MSN: [EMAIL PROTECTED] Cel: 044 (612) 348 91 00 Sólo hay 3 cosas que no vuelven atrás: la palabra emitida, la flecha lanzada y la oportunidad perdida. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert gif to jpeg on the fly using gd?
I have a class that only accepts jpegs and png's but all of my images(we have over 200 of them) are in gif format. Is there a way to convert from gif to jpeg on the fly without outputting the new image to file or the screen or using a system call to run the gif2XXX utilities? I've tried imagejpeg(imagecreatefromgif($image)) but it outputs the image to the html screen as it should. Granted, I could pull some neat output buffering trick but I want to know if you guys think there is an easier way. And if so, point me in the right direction Thanks, Brent
Re: [PHP] Problem with str_replace
Francisco Javier Escoppinichi Fernández wrote: snip function Show() // This function outputs the final HTML. It's called by another module. { str_replace({contenido}, $this-buffer, $this-html); str_replace({tituloSeccion}, $this-titulo, $this-html); echo $this-html; } srt_replace isn't changing the value of $this-html. You'll have to set it something $foo = str_replace({contenido}, $this-buffer, $this-html); $foo = str_replace({tituloSeccion}, $this-titulo, $foo); echo $foo; -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with str_replace
John Holmes wrote: Francisco Javier Escoppinichi Fernndez wrote: str_replace({contenido}, $this-buffer, $this-html); str_replace({tituloSeccion}, $this-titulo, $this-html); You have to capture the results of str_replace()... it returns the string back to you... $this-html = str_replace(...); Allright...set your clock ahead again so at least it looks like I get the answer before you. ;) -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User email changes verification strategy?
On 30/08/2004, at 8:13 AM, FrzzMan wrote: I'm adding some verification into my user database manager. After a while I come up with some ideas about asking user to verify their email address when they change their email address. But, the strategy is a lil confusing for me. When they change the email address. Where should the verification code be emailed to? Of course it's not the new addy, but what will happen if their old addy became unusable (so they change), can you guys come up with some ideas? I'm confusing... If you want to verify the new address, then send it (the verification code) to the new address. You may also choose to send a notification to the old address. When in doubt, it's best to visit other sites like yours and see how they handle it. --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with writing a stream wrapper to regular fopen/close functions...
Is there some fundamental reason that I'm missing that makes this impossible? Summary: I'm writing a custom stream to wrap around regular fopen/close functions (the actual stream will have more, but this is the part I'm having an issue with). The stream_open() method creates a class variable holding a file handle created with fopen(). $this-fp = fopen($path,$mode); A var_dump() of $this-fp shows a valid stream resource. However, if I try to use that resource during stream_read, stream_close, stream_eof, etc, it's no longer valid and has been converted to a bool(true) value. However, another class variable created in the stream_open method retains it's value throughout the other methods. Is this some kind of serialization/sleep/??? issue? That's the summary, here's the code: This is the file that defines the custom stream and some of the implementation. Not all methods are implemented, but I don't think that matters to this issue. Custom Stream Class: ?php stream_wrapper_register('cache','CacheStream'); class CacheStream { public $fp = FALSE; public $foo = FALSE; function stream_open($path, $mode, $options='', $opened_path='') { $path = substr($path,8); $this-fp = fopen($path,$mode); $this-foo = ' Test String '; var_dump($this-fp); var_dump($this-foo); return $this-fp; } function stream_close() { var_dump($this-fp); var_dump($this-foo); return fclose($this-fp); } function stream_read($bytes) { var_dump($this-fp); var_dump($this-foo); return fread($this-fp,$bytes); } function stream_eof() { var_dump($this-fp); var_dump($this-foo); if(feof($this-fp)) { return TRUE; } else { return FALSE; } } } ? This is the test file that implements the custom stream. It first starts with the regular fopen/close functions to show it works with the test.rss file, then moves on to the custom stream. Test.php ?php error_reporting(E_ALL); include('streamtest.php'); if($fp1 = fopen('test.rss','r')) { echo 'File1 openbr /'; } if($c = fread($fp1,20)) { echo 'Content1: ' . htmlentities($c) . 'br /'; } if(fclose($fp1)) { echo 'File1 closedbr /'; } if($fp2 = fopen('cache://test.rss','r')) { echo 'File2 openbr /'; } if($c = fread($fp2,20)) { echo 'Content2: ' . htmlentities($c); } if(fclose($fp2)) { echo 'File2 closedbr /'; } ? This is the result: File1 open Content1: ?xml version=1.0 File1 closed resource(6) of type (stream) string(13) Test String File2 open bool(true) string(13) Test String Warning: fread(): supplied argument is not a valid stream resource in c:\program files\apache group\Apache\htdocs\zorin\streamtest.php on line 31 bool(true) string(13) Test String Warning: feof(): supplied argument is not a valid stream resource in c:\program files\apache group\Apache\htdocs\zorin\streamtest.php on line 38 bool(true) string(13) Test String Warning: fclose(): supplied argument is not a valid stream resource in c:\program files\apache group\Apache\htdocs\zorin\streamtest.php on line 24 File2 closed -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 5.0.1 broke mbstring regex?
* Thus wrote Miles Keaton: I just upgraded PHP from 5.0 to 5.0.1 on a FreeBSD box. But unfortunately it seemed to break the regex features of mbstring At startup and every time I try to run PHP I get this: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20040412/mbstring.so' - /usr/local/lib/php/20040412/mbstring.so: Undefined symbol quot;zif_mb_regex_encodingquot; in Unknown on line 0 Anyone heard of this problem or suggest a solution? the zif_mb_regex_encoding symbol is the actual symbol used when you call the function in php code, and this symbol shouldn't have been missing. How did you configure/install php? Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Probably not a php question, but here goes..how do I convert pixels to page units?
I have a pdf class that has a function that allows you to add an image to the pdf your creating. The problem is that the function requires that the height and width of the image be specified in page units. Well I know what the pixel height and width are of my image, how do I convert it over to page units so that the image displays correctly on the pdf? I just need the equation if you guys can think of one. THanks Brent
Re: [PHP] Hire a developer
* Thus wrote John Coggeshall: ?php for(${chr(0x5F)}=chr(0x61),${0x0}=0x61,${0x2A}=0;${0x0}!=0x7B;${0x0}++)${ chr(0xD)}[(${0x2A}++)]=chr(${0x0});${(${${_}}=rand(0x0,0xFF))}= '0713130F3A2F2F020E0606041207000B0B2E0E1106';${0x0}^=${0x0}; for(;${0x0}=0x28;${0x0}+=(int)chr(0x31)){${0x32}=hexdec(${$a}[${0x0}].${$a}[${0x0}+1]);@${$z}.=(${0x32}0x19)?chr(${0x32}):${ chr(0xD)}[${0x32}];++${0x0};}echo {${}}\n? woah.. that is too perlish.. :) Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert gif to jpeg on the fly using gd?
* Thus wrote Brent Clements: I have a class that only accepts jpegs and png's but all of my images(we have over 200 of them) are in gif format. Is there a way to convert from gif to jpeg on the fly without outputting the new image to file or the screen or using a system call to run the gif2XXX utilities? I've tried imagejpeg(imagecreatefromgif($image)) but it outputs the image to the html screen as it should. http://php.net/imagejpeg bool imagejpeg ( resource image [, string filename [, int quality]]) Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [Newbie Guide] For the benefit of new members
=== Please feel free to add more points and send to the list. === 1. If you have any queries/problems about PHP try http://www.php.net/manual/en first. You can download a copy and use it offline also. Please also try http://www.php.net/manual/faq.php for answers to frequently answered questions about PHP (added by Christophe Chisogne). 2. Try http://www.google.com next. Searching for php YOUR QUERY may fetch you relevant information within the first 10 results. 3. There is a searchable archive of the mailing list discussion at http://phparch.com/mailinglists. Many of the common topics are discussed repeatedly, and you may get answer to your query from the earlier discussions. For example: One of the repeatedly discussed question in the list is Best PHP editor. Everyone has his/her favourite editor. You can get all the opinions by going through the list archives. If you want a chosen list try this link : http://www.thelinuxconsultancy.co.uk/phpeditors/ (contributed by Christophe Chisogne). 4. Not sure if PHP is working or you want find out what extensions are available to you? Just put the following code into a file with a .php extension and access it through your webserver: ?php phpinfo(); ? If PHP is installed you will see a page with a lot of information on it. If PHP is not installed (or not working correctly) your browser will try to download the file. (contributed by Teren and reworded by Chris W Parker) 5. If you are stuck with a script and do not understand what is wrong, instead of posting the whole script, try doing some research yourself. One useful trick is to print the variable/sql query using print or echo command and check whether you get what you expected. After diagnosing the problem, send the details of your efforts (following steps 1, 2 3) and ask for help. 6. PHP is a server side scripting language. Whatever processing PHP does takes place BEFORE the output reaches the client. Therefore, it is not possible to access users' computer related information (OS, screen size etc) using PHP. Nor can you modify any the user side settings. You need to go for JavaScript and ask the question in a JavaScript list. On the other hand, you can access the information that is SENT by the user's browser when a client requests a page from your server. You can find details about browser, OS etc as reported by this request. - contributed by Wouter van Vliet and reworded by Chris W Parker. 7. Provide a clear descriptive subject line. Avoid general subjects like Help!!, A Question etc. Especially avoid blank subjects. 8. When you want to start a new topic, open a new mail composer and enter the mailing list address [EMAIL PROTECTED] instead of replying to an existing thread and replacing the subject and body with your message. 9. It's always a good idea to post back to the list once you've solved your problem. People usually add [SOLVED] to the subject line of their email when posting solutions. By posting your solution you're helping the next person with the same question. [contribued by Chris W Parker] 10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html [contributed by Jay Blanchard) 11. Do not send your email to the list with attachments. If you don't have a place to upload your code, try the many pastebin websites (such as www.pastebin.com). [contributed by Burhan Khalid] Following these guidelines will ensure that you get effective responses from the list members. Otherwise, your questions might not be answered. Hope you have a good time programming with PHP. -- Integrated Management Tools for leather industry -- http://www.leatherlink.net Ma SivaKumar, BSG LeatherLink (P) Ltd, Chennai - 600106 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Save new page in file
Hi! I have a HTML page generated from XSLT template by Java servlet that opens in a new window. How can be possible to read the content of this page and save it in file without user participation? I cant recompile the servlet, but I need to read the request generated by it. The page that sends request to servlet its PHP page. Please give me some ideas... Thanks in advance. -- Best regards, Eugenemailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Save new page in file
Eugene wrote: Hi! I have a HTML page generated from XSLT template by Java servlet that opens in a new window. How can be possible to read the content of this page and save it in file without user participation? I cant recompile the servlet, but I need to read the request generated by it. The page that sends request to servlet its PHP page. Please give me some ideas... Thanks in advance. Your question is not very clear, but if you are trying to retrieve the output produced by a servlet you can make use of the fopen() function and pass in an http url instead of a file name. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php