Re: [PHP] Pwersistent Queue
Hello chetan rane, use serialize, unserialize, array and file. or xml Best regards, === At 2007-02-01, 13:53:38 you wrote: === >Hi everyone > >I aneed top maintain a persisistent Queue can anyone help. > > >-- >Have A plesant Day >Chetan. D. Rane >Location: Pune , India >Contact: +91-9890792762 >otherID: [EMAIL PROTECTED] > [EMAIL PROTECTED] > = = = = = = = = = = = = = = = = = = = = Nicholas Yim [EMAIL PROTECTED] 2007-02-01 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.4.5RC2
Hello! I packed PHP 4.4.5RC2 today, which you can find here: http://downloads.php.net/derick/ Please test it carefully, and report any bugs in the bug system, but only if you have a short reproducable test case. If everything goes well, we can release it somewhere at the end of next week. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested, referenced foreach & implicit current array pointer issues
# [EMAIL PROTECTED] / 2007-02-01 02:26:09 +0100: > Roman Neuhauser wrote: > > # [EMAIL PROTECTED] / 2007-01-31 19:41:42 +0100: > >> instead I would suggest that your better off doing one of 2 things: > >> > >> 1. pass in the array to the function explicitly. > >> 2. use a special function that can be called to retrieve the array > >> from within your example function. > >> > >> bad advice? I'm open to being corrected :-) > > > > 2. is only marginally better than "global". > > if you use a function you can make sure it's output is > consistent and you have a single point of control. > > personally I consider that some what more than a marginal gain. Singleton is still an antipattern (in most cases). If you're affraid that someone will break a convention which says that the global associative array $foos has string indexes and values must be positive integers, or that it needs to be an array at all ($GLOBALS['foos'] = new sabotage("haha")), you would be better off in e. g. C++ with std::map foos; voila, you don't need to worry anymore! Alas, global variables, including those hidden behind accessors, are a grievous problem in C++ as well. It's not control over data types, it's visibility of access that causes most of the lossage. Wrapping the global in a function doesn't remove the structural defect. Been there, done that, got the scars. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CONTACT ...
Alberto Ferreira wrote: > Teste > -- .~. Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org / v \ Simplicity is Beauty! May the Force and Farce be with you! /( _ )\ (Ubuntu 6.10) Linux 2.6.19.2 ^ ^ 19:27:01 up 20 days 22:39 0 users load average: 1.07 1.02 1.00 news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parsing mail file
Easy!! Pierre Pintaric : Hello there, I'm sure this question was ask 1,000 times, but I didn't find any archive about this, that's why I need help... Here is my problem: I receive mail file from my MTA (ie QMail), that works fine. Now, I would to find a class or a function that parse the mail and gives headers informations, body of the mail (even if it is a multi-part mail) and file attachments. I found nothing in PEAR library, nothing on the web, ... I don't what want to rebuild the wheel if somebody works on it and made a good job... If somebody uses a great function and want to share, I will please him... :-) Thanks for your help. Pierre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] PHP 4.4.5RC2
The Windows build is ready as well: http://downloads.php.net/edink/php-4.4.5RC2-Win32.zip Edin Derick Rethans wrote: Hello! I packed PHP 4.4.5RC2 today, which you can find here: http://downloads.php.net/derick/ Please test it carefully, and report any bugs in the bug system, but only if you have a short reproducable test case. If everything goes well, we can release it somewhere at the end of next week. regards, Derick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Socket problem plz read.
Richard Lynch skrev: On Wed, January 31, 2007 9:39 am, Németh Zoltán wrote: On sze, 2007-01-31 at 16:26 +0100, Scripter47 wrote: I'm making a simple socket server that just receive some data, and then send some data back again to the client. EDIT: I forgot to tell that i need help! I have search around for hours now, and the examples are always not what I needed :( the program is written in Python, if that helps, and is something like this this is PHP list. go to Python list with that, I suggest I believe the OP is asking how to write the PHP to RECEIVE that data from the Python script. That's what I want! plz help me, with some sample code :) Or, possibly, how to implement that same code in PHP. http://php.net/sockets is still my best answer... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Socket problem plz read.
On cs, 2007-02-01 at 14:45 +0100, Scripter47 wrote: > Richard Lynch skrev: > > On Wed, January 31, 2007 9:39 am, Németh Zoltán wrote: > >> On sze, 2007-01-31 at 16:26 +0100, Scripter47 wrote: > >>> I'm making a simple socket server that just receive some data, and > >>> then > >>> send some data back again to the client. > >>> > >>> EDIT: > >>> I forgot to tell that i need help! > >>> > >>> I have search around for hours now, and the examples are always not > >>> what > >>> I needed :( > >>> > >>> the program is written in Python, if that helps, and is something > >>> like this > >> this is PHP list. go to Python list with that, I suggest > > > > I believe the OP is asking how to write the PHP to RECEIVE that data > > from the Python script. > > > That's what I want! > > plz help me, with some sample code :) ok, then you should read (as Richard also said) http://php.net/sockets there are examples in there and everything Zoltán Németh > > Or, possibly, how to implement that same code in PHP. > > > > http://php.net/sockets > > is still my best answer... > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Who uses PHP
I've heard some concern expressed that PHP might be more insecure then other methods of developing website where security was of prime importance. Now, I personally do not believe this, but it would help me to convince others if I could point to major sites, where security (mostly with respect to the user authentication system) was extremely important (financial sites, etc.) and where PHP was the primary development platform. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested, referenced foreach & implicit current array pointer issues
Roman Neuhauser wrote: > # [EMAIL PROTECTED] / 2007-02-01 02:26:09 +0100: >> Roman Neuhauser wrote: >>> # [EMAIL PROTECTED] / 2007-01-31 19:41:42 +0100: instead I would suggest that your better off doing one of 2 things: 1. pass in the array to the function explicitly. 2. use a special function that can be called to retrieve the array from within your example function. bad advice? I'm open to being corrected :-) >>> 2. is only marginally better than "global". >> if you use a function you can make sure it's output is >> consistent and you have a single point of control. >> >> personally I consider that some what more than a marginal gain. > > Singleton is still an antipattern (in most cases). the reliance on persistence being one of the major gripes about Singleton (with regard to testing mostly) - which is kind of funny and sad at the same time - persistence being at once the most basic expectation of an average computer user AND something which apparently CS people on whole do everything to avoid providing. totally besides the point - the second option merely suggests providing a way to create a single source for the data - the source being more reliable than a global named $arr. this is not the same a Singleton pattern. > > If you're affraid that someone will break a convention which says that > the global associative array $foos has string indexes and values must be given an array of data that is used all over a php application then it quite simply saves alot fo headaches down the road to to agree on a convention that says 'we' will use a function to retrieve this data whenever it is needed (regardless > positive integers, or that it needs to be an array at all > ($GLOBALS['foos'] = new sabotage("haha")), you would be better off in > e. g. C++ with > > std::map foos; please refrain from the old 'you-should-be-using-language-FOO-look-i'll-show-you-how-clever-I-am' argument it's not really adding anything to this discussion. > > It's not control over data types, it's visibility of access that causes > most of the lossage. Wrapping the global in a function doesn't remove > the structural defect. huh? > > Been there, done that, got the scars. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
Eric Gorr wrote: > I've heard some concern expressed that PHP might be more insecure then > other methods of developing website where security was of prime > importance. Now, I personally do not believe this, but it would help me > to convince others if I could point to major sites, where security > (mostly with respect to the user authentication system) was extremely > important (financial sites, etc.) and where PHP was the primary > development platform. google, yahoo. for the rest search Zend.com or your favorite sdearch engine > > Thank you. > > --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] Who uses PHP
[snip] I've heard some concern expressed that PHP might be more insecure then other methods of developing website where security was of prime importance. Now, I personally do not believe this, but it would help me to convince others if I could point to major sites, where security (mostly with respect to the user authentication system) was extremely important (financial sites, etc.) and where PHP was the primary development platform. [/snip] Google for one. I am pretty sure Yahoo. Also, check out http://www.shiflett.org as Chris is one of if not the leading expert in security with PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
On Feb 1, 2007, at 9:47 AM, Jochem Maas wrote: Eric Gorr wrote: I've heard some concern expressed that PHP might be more insecure then other methods of developing website where security was of prime importance. Now, I personally do not believe this, but it would help me to convince others if I could point to major sites, where security (mostly with respect to the user authentication system) was extremely important (financial sites, etc.) and where PHP was the primary development platform. google, yahoo. For their user authentication system? Session management? Everything? Don't suppose there would be any URL (press release, just general info, etc.) with that information? for the rest search Zend.com or your favorite sdearch engine Thanks. While zend.com, etc. will tell me who is using PHP, they do not generally state exactly how it is being used and, as much as the who, it is the how that is important. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
On Feb 1, 2007, at 9:50 AM, Jay Blanchard wrote: Also, check out http://www.shiflett.org as Chris is one of if not the leading expert in security with PHP. Great site. thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
On 2/1/07, Eric Gorr <[EMAIL PROTECTED]> wrote: On Feb 1, 2007, at 9:50 AM, Jay Blanchard wrote: > > Also, check out > http://www.shiflett.org as Chris is one of if not the leading > expert in > security with PHP. Great site. thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php http://afup.org/IMG/flickr_php.pdf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
Eric Gorr wrote: > > On Feb 1, 2007, at 9:47 AM, Jochem Maas wrote: > >> Eric Gorr wrote: >>> I've heard some concern expressed that PHP might be more insecure then >>> other methods of developing website where security was of prime >>> importance. Now, I personally do not believe this, but it would help me >>> to convince others if I could point to major sites, where security >>> (mostly with respect to the user authentication system) was extremely >>> important (financial sites, etc.) and where PHP was the primary >>> development platform. >> >> google, yahoo. > > For their user authentication system? Session management? Everything? > Don't suppose there would be any URL (press release, just general info, > etc.) with that information? > >> for the rest search Zend.com or your favorite sdearch engine > > Thanks. > > While zend.com, etc. will tell me who is using PHP, they do not > generally state exactly how it is being used and, as much as the who, it > is the how that is important. ah right - please ignore my post - I wasn't really reading your question properly, my apologies > > --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] Who uses PHP
On Feb 1, 2007, at 10:06 AM, Jochem Maas wrote: Eric Gorr wrote: On Feb 1, 2007, at 9:47 AM, Jochem Maas wrote: Eric Gorr wrote: I've heard some concern expressed that PHP might be more insecure then other methods of developing website where security was of prime importance. Now, I personally do not believe this, but it would help me to convince others if I could point to major sites, where security (mostly with respect to the user authentication system) was extremely important (financial sites, etc.) and where PHP was the primary development platform. google, yahoo. For their user authentication system? Session management? Everything? Don't suppose there would be any URL (press release, just general info, etc.) with that information? for the rest search Zend.com or your favorite sdearch engine Thanks. While zend.com, etc. will tell me who is using PHP, they do not generally state exactly how it is being used and, as much as the who, it is the how that is important. ah right - please ignore my post - I wasn't really reading your question properly, my apologies Well, if you do not know the answer to my particular question, I'm curious how might you respond to someone who says: PHP has to many security issues and should not be used with a user authentication system. We should use XXX. You are not allowed to say 'Well, you're wrong. PHP is as secure as anything else.' without explaining why. Or, would you agree with the statement? Is there an 'XXX' that should be used instead of PHP? Given the limited number of options for maintaining state information, I would be hard pressed to see how any language could be inherently more security or why one could not write PHP code which implemented the same techniques as 'XXX'. (No, I do not know what 'XXX' might be.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
On cs, 2007-02-01 at 10:19 -0500, Eric Gorr wrote: > On Feb 1, 2007, at 10:06 AM, Jochem Maas wrote: > > > Eric Gorr wrote: > >> > >> On Feb 1, 2007, at 9:47 AM, Jochem Maas wrote: > >> > >>> Eric Gorr wrote: > I've heard some concern expressed that PHP might be more > insecure then > other methods of developing website where security was of prime > importance. Now, I personally do not believe this, but it would > help me > to convince others if I could point to major sites, where security > (mostly with respect to the user authentication system) was > extremely > important (financial sites, etc.) and where PHP was the primary > development platform. > >>> > >>> google, yahoo. > >> > >> For their user authentication system? Session management? Everything? > >> Don't suppose there would be any URL (press release, just general > >> info, > >> etc.) with that information? > >> > >>> for the rest search Zend.com or your favorite sdearch engine > >> > >> Thanks. > >> > >> While zend.com, etc. will tell me who is using PHP, they do not > >> generally state exactly how it is being used and, as much as the > >> who, it > >> is the how that is important. > > > > ah right - please ignore my post - I wasn't really reading your > > question properly, > > my apologies > > Well, if you do not know the answer to my particular question, I'm > curious how might you respond to someone who says: > > PHP has to many security issues and should not be used with a > user authentication system. > We should use XXX. I think security mainly depends on the programmer and not on the language he uses... greets Zoltán Németh > > You are not allowed to say 'Well, you're wrong. PHP is as secure as > anything else.' without explaining why. > Or, would you agree with the statement? Is there an 'XXX' that should > be used instead of PHP? > > Given the limited number of options for maintaining state > information, I would be hard pressed to see how any language could be > inherently more security or why one could not write PHP code which > implemented the same techniques as 'XXX'. > > (No, I do not know what 'XXX' might be.) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
On Thu, 2007-02-01 at 10:19 -0500, Eric Gorr wrote: > > Well, if you do not know the answer to my particular question, I'm > curious how might you respond to someone who says: > > PHP has to many security issues and should not be used with a > user authentication system. > We should use XXX. > > You are not allowed to say 'Well, you're wrong. PHP is as secure as > anything else.' without explaining why. > Or, would you agree with the statement? Is there an 'XXX' that should > be used instead of PHP? For the most part, any program in a mature language is as secure as the least competent coder that worked with it. Following from that, if your developers are competent, you are less likely to have security problems. PHP provides all the tools necessary to write very secure applications, most of the problems in the wild are due to incompetence especially as relates to popular packages (such as PHPBB). > Given the limited number of options for maintaining state > information, I would be hard pressed to see how any language could be > inherently more security or why one could not write PHP code which > implemented the same techniques as 'XXX'. Some languages provide features that essentially tie the developer's hands behind their back and make it more difficult to introduce security flaws. This idealogy only has limited success because no matter how intelligent you think your language is, there is almost certainly a human of marvellous counter intelligence that will do something stupid... often by force of will. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested, referenced foreach & implicit current array pointer issues
# [EMAIL PROTECTED] / 2007-02-01 15:46:39 +0100: > Roman Neuhauser wrote: > > # [EMAIL PROTECTED] / 2007-02-01 02:26:09 +0100: > >> Roman Neuhauser wrote: > >>> # [EMAIL PROTECTED] / 2007-01-31 19:41:42 +0100: > instead I would suggest that your better off doing one of 2 things: > > 1. pass in the array to the function explicitly. > 2. use a special function that can be called to retrieve the array > from within your example function. > > bad advice? I'm open to being corrected :-) > >>> 2. is only marginally better than "global". > >> if you use a function you can make sure it's output is > >> consistent and you have a single point of control. > >> > >> personally I consider that some what more than a marginal gain. > > > > Singleton is still an antipattern (in most cases). > > the reliance on persistence being one of the major gripes about > Singleton (with regard to testing mostly) Sorry, I don't understand this... > totally besides the point - the second option merely suggests providing > a way to create a single source for the data - the source being more > reliable than a global named $arr. > > this is not the same a Singleton pattern. Singleton in Design Patterns, p. 127: : Intent : Ensure a class only has one instance, and provide a global point of : access to it. The second part is IMO pretty much what you said. > > If you're affraid that someone will break a convention which says that > > the global associative array $foos has string indexes and values must be > > given an array of data that is used all over a php application then it quite > simply > saves alot fo headaches down the road to to agree on a convention that says > 'we' will use a function to retrieve this data whenever it is needed > (regardless Agreeing on abandoning global variables would save even more headaches. > > positive integers, or that it needs to be an array at all > > ($GLOBALS['foos'] = new sabotage("haha")), you would be better off in > > e. g. C++ with > > > > std::map foos; > > please refrain from the old > 'you-should-be-using-language-FOO-look-i'll-show-you-how-clever-I-am' > argument it's not really adding anything to this discussion. Originally I wanted to illustrate my point using PHP, but it's much more code. Sorry if I hurt your feelings. > > It's not control over data types, it's visibility of access that causes > > most of the lossage. Wrapping the global in a function doesn't remove > > the structural defect. > > huh? If PHP was statically typed, global variables would still be a bad smell. They are bad smell in C++ and Java, for example. It's too easy to call getfoo() before you have set up $foo. The risk grows exponentially: as soon as you add another global, $bar, you risk that you or someone else will use getfoo() inside initbar(), and getbar() inside initfoo() (or getfoo() inside initfoo()). Of course, it will be several function calls deep, and quite probably only happen in a code path that's rarly used (such as error handling). -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested, referenced foreach & implicit current array pointer issues
On Thu, 2007-02-01 at 16:42 +0100, Roman Neuhauser wrote: > > If PHP was statically typed, global variables would still be a bad > smell. They are bad smell in C++ and Java, for example. It's too easy > to call getfoo() before you have set up $foo. The risk grows > exponentially: as soon as you add another global, $bar, you risk that > you or someone else will use getfoo() inside initbar(), and getbar() > inside initfoo() (or getfoo() inside initfoo()). Of course, it will be > several function calls deep, and quite probably only happen in a code > path that's rarly used (such as error handling). Nopthing wrong with globals as long as they aren't used to punt data around from function to function. I find globals quite useful when used for configuration. I usually use a double level array. The first index is a grouping index such as "someProject" the second index is the name of the property. I could use a database table, but why incur an extra query. I could use a class, but why increase complexity, I could use functions, but complexity again. As for singletons... just use a static class method. Now how hard was that!? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested, referenced foreach & implicit current array pointer issues
On cs, 2007-02-01 at 10:53 -0500, Robert Cummings wrote: > On Thu, 2007-02-01 at 16:42 +0100, Roman Neuhauser wrote: > > > > If PHP was statically typed, global variables would still be a bad > > smell. They are bad smell in C++ and Java, for example. It's too easy > > to call getfoo() before you have set up $foo. The risk grows > > exponentially: as soon as you add another global, $bar, you risk that > > you or someone else will use getfoo() inside initbar(), and getbar() > > inside initfoo() (or getfoo() inside initfoo()). Of course, it will be > > several function calls deep, and quite probably only happen in a code > > path that's rarly used (such as error handling). > > Nopthing wrong with globals as long as they aren't used to punt data > around from function to function. I find globals quite useful when used > for configuration. I usually use a double level array. The first index > is a grouping index such as "someProject" the second index is the name > of the property. I could use a database table, but why incur an extra > query. I could use a class, but why increase complexity, I could use > functions, but complexity again. I greatly agree with this. I use config arrays, and put all initialization which sets up the elements of the config arrays in an include file which is included everywhere. And inside functions these config arrays are my only globals (besides the superglobals of course). greets Zoltán Németh > As for singletons... just use a static > class method. > > > class Foo extends Singleton > { > function Foo() > { > static $createdAlready = false; > > if( $createdAlready ) > { > die( 'Use Foo::getGlobalInstance() instead.' ); > } > > $createdAlready = true; > } > > function getGlobalInstance() > { > static $singleton = null; > > if( $singleton === null ) > { > $singleton = &new Foo(); > } > > return $singleton; > } > } > > ?> > > Now how hard was that!? > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Send Email to Mobile
Hi guys, I have a script that send emails to mobiles: And this is the message in a mobile: [EMAIL PROTECTED] I don´t know why appear the address [EMAIL PROTECTED] the address must be: [EMAIL PROTECTED], could you help me please, thank you
RE: [PHP] Manipulating "categories" in a mysql database
> -Message d'origine- > De : Richard Lynch [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 1 février 2007 02:35 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] Manipulating "categories" in a mysql database > > On Tue, January 30, 2007 12:36 pm, Tim wrote: > > This is more of a conceptional question rather then a technical one. > > > > I am developping an online catalog, the catalog is a standard > > categorie/subcat/subsubcat system using the following logic in my > > database: > > > > cat_id cat_name > > > > 10DVD > > 1010 DVD/Action > > 1020 DVD/Adventure > > 20CD > > 2010 CD/Reggae > > 2020 CD/Electro > > > > Up to now I enter the category id's manually from an administration > > console. > > > > I would like to be able to have my console automagically generate a > > cat_id > > when my users add categories (so they don't have to bother with that > > aspect > > of adding a category) and I would also like to be able to move a > > category up > > or down in the way it displays on the page, as of now I am sorting by > > cat_id > > Rule of thumb for SQL: > Never ever ever sort by *_id, because it will almost alway send up > biting you in the butt sooner or later. > > Add a 'rank' column and maintain that in your web application. > > > I have been for a while trying to develop a logical scheme to be able > > to > > generate the id's and change their cat_id to reflect a "new" position > > in how > > it displays (displaying DVD/Action after DVD/Adventure for example I > > would > > need to change the cat_id from 1010 to something above 1020 say 1021). > > This > > is fine as I can test the previous elements cat_id and add or subtract > > 1 but > > I get stuck when I have a cat_id say 1010 that I would want to put > > between > > 1011 and 1012. I'm having trouble developing the algorithm that would > > allow > > this.. > > Once you separate the cat_id and the 'rank' you will have no problems. > > Your cat_id can just be auto_increment and never displayed to the user. > > Your 'rank' can be a simple integer, and to re-order you'll just do like: > > //Assume cat_id # 7 needs to move to the 42nd place in the list: > $cat_id = 7; > $new_rank = 42; > $query = "update catalog set rank = rank + 1 where rank >= $new_rank"; > mysql_query($query) or error_log(mysql_error() . " $query"); > $query = "update catalog set rank = $new_rank where cat_id = $cat_id"; > mysql_query($query) or error_log(mysql_error() . " $query"); > ?> > > This may create a "hole" in the rank listing, if $cat_id 7 used to be > LOWER than 42. > > A little bit more effort can solve this, however. > AFTER the above queries, tack on: > if ($old_rank < $new_rank){ > $query = "update catalog set rank = rank - 1 where rank > $old_rank"; > mysql_query($query) or error_log(mysql_error() . " $query"); > } > > You could go even further and change the minimum number of ranks > needed in any given change, to avoid thrashing the index on the rank. > This would be crucial if your table was very large. Thanks a lot, that put me in the right direction, I am studying this option as I write this, I have drawn it up in a diagram and it looks quite simple now. I have also discovered a flaw in my database programming that made me realize how badly I use the MySQL engine by doing the sorting at the application-layer level rather then using the MySQL engine to sort the info prior to sending back to the application.. Have now discovered, indexing, foreign keys, and joins :D Great list, always opening new doors :) Thank you much for all your suggestions! Regards, Tim > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some starving artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Send Email to Mobile
This kind of hassle you can avoid if you use PHPMailer that you can find at http://phpmailer.sourceforge.net Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Marcelo Ferrufino Murillo [mailto:[EMAIL PROTECTED] Sent: Thursday, February 01, 2007 6:17 PM To: php-general@lists.php.net Subject: [PHP] Send Email to Mobile Hi guys, I have a script that send emails to mobiles: And this is the message in a mobile: [EMAIL PROTECTED] I don´t know why appear the address [EMAIL PROTECTED] the address must be: [EMAIL PROTECTED], could you help me please, thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble...
I have an xml stored in a variable. If I load it in a domdocument as HTML: $DDoc->loadHTML($xml); I can get elements by an xpath query, but if I instead load it as XML my xpath queries stop working: $DDoc = new DOMDocument(); $DDoc->loadXML($xml); $xpath = new DOMXPath($DDoc); $query = "//[EMAIL PROTECTED]".$i."]"; $topics = $xpath->query($query); I've checked that the xml is well formated, no error or warning is displayed. $topics is just empty. Do anyone know why this could happen? Thank you for your attention.
[PHP] Combining 2 DOM XML nodes from different documents
Hi, EOT; $x2 = << EOT; $X1 = new DOMDocument(); $X1->loadXML($x1); $X2 = new DOMDocument(); $X2->loadXML($x2); $X1->firstChild->appendChild($X2->firstChild->cloneNode(true)); echo htmlspecialchars($X1->saveXML()); ?> I got an error in the line $X1->firstChild->appendChild... [01-Feb-2007 22:20:29] PHP Fatal error: Uncaught exception 'DOMException' with message 'Wrong Document Error' in E:\www\mysite\htdocs\combine.php:17 How can I combine these 2 XMLs to get: -thanks! :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT - PHP Code Search
If you are looking for php code examples try searching for them at http://www.php-code-search.com/ berber
Re: [PHP] OT - PHP Code Search
On Thu, 2007-02-01 at 22:51 +0200, WeberSites LTD wrote: > www.php-cod-search.com/ Why? Is this a new site you've set up with disgusting amounts of advertising? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - PHP Code Search
Not too many ads on the pages after you find what you're searching for, and mostly just some "ads by google" type stuff. Speaking of Google.. you can also go here for PHP code searching.. I do all my "cod" (sic) searching there! Fresh! http://www.google.com/codesearch?q=lang%3Aphp&hl=en&btnG=Search+Code -TG = = = Original message = = = On Thu, 2007-02-01 at 22:51 +0200, WeberSites LTD wrote: > www.php-cod-search.com/ [-TG edit: www.php-code-search.com/ Fixed!] Why? Is this a new site you've set up with disgusting amounts of advertising? Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - PHP Code Search
On Thu, 2007-02-01 at 16:18 -0500, [EMAIL PROTECTED] wrote: > Not too many ads on the pages after you find what you're searching for, and > mostly just some "ads by google" type stuff. > > Speaking of Google.. you can also go here for PHP code searching.. I do all > my "cod" (sic) searching there! Fresh! > > http://www.google.com/codesearch?q=lang%3Aphp&hl=en&btnG=Search+Code > > -TG > > = = = Original message = = = > > On Thu, 2007-02-01 at 22:51 +0200, WeberSites LTD wrote: > > www.php-cod-search.com/ > > [-TG edit: www.php-cod-search.com/ Fixed!] *smirk* Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Send Email to Mobile
Add a Reply-to: field on your headers. http://php.net/mail Read about the fifth argument. On Thu, February 1, 2007 10:17 am, Marcelo Ferrufino Murillo wrote: > Hi guys, I have a script that send emails to mobiles: > > $subject=$_REQUEST["sb"]; > $nmobile=trim($_REQUEST["nmobile"]); > $message=$_REQUEST["message"]; > $header="From: [EMAIL PROTECTED]"; > > //Bolivia providers > switch($nmobile[1]){ > case 0: $company="@viva-gsm.com"; break; > case 1: $company="@entelmovil.com.bo";break; > case 2: > case 3: $company="@movil.com.bo"; break; > case 6: > case 7: $company="@tigo.com.bo";break; > } > $number="591".$nmobile.$company; > if( @mail($number,$subject,$message,$header)) > echo "Message sent"; > else echo "error"; > ?> > > And this is the message in a mobile: [EMAIL PROTECTED] > > > > I don´t know why appear the address [EMAIL PROTECTED] the address > must > be: [EMAIL PROTECTED], could you help me please, thank you > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OT - PHP Code Search
On Thu, 2007-02-01 at 23:51 +0200, WeberSites LTD wrote: > I guess you have no real use for advertising cause no one really comes to > your site. > Go get a life instead of sending idiotic emails to the list. *lol* That's not what you said when you tried to recruit me as a forum moderator for the dweeber site several months ago. BTW, I have a life, my wife and two kids are more life than a website and a framework could ever give me. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who uses PHP
Eric Gorr wrote: PHP has to many security issues and should not be used with a user authentication system. We should use XXX. Well, people's complaints about PHP probably stem from some security pitfalls built-in for simplicity's sake. (The most common being register_globals.) For that reason, I strongly agree with the general sentiments of many posters: code is as secure as the least capable developer can make it. I write code in C, python, Perl, PHP, Java, C#, JavaScript, etc, etc... I don't find PHP to be inherently less secure than any other language. I've recently run into a company that has a payment web service that handles outgoing transactions. They have a hole in their system that could be used to rip off e-commerce sites accross the internet. (Site thinks the person has paid, where they have not.) Their code is written in ASP. Is it ASP's fault? No. It's the programmers who failed to recognize the hole in their protocol. jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 & Commercial Development
I haven't tracked this particular issue, but I know when PHP5 was first released is wasn't recommended in a commercial/production environment. However, a lot of time has passed and we're at v5.2 now...have things changed? Have Google&Yahoo, for example, moved to PHP5? Or is PHP4 still the recommendation for such environments? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP5 & Commercial Development
AFAIK php5 is the preferred production/enterprise environment. (buzzword +1) Respectfully, Ligaya Turmelle -Original Message- From: Eric Gorr [mailto:[EMAIL PROTECTED] Sent: Friday, February 02, 2007 9:13 AM To: php-general@lists.php.net Subject: [PHP] PHP5 & Commercial Development I haven't tracked this particular issue, but I know when PHP5 was first released is wasn't recommended in a commercial/production environment. However, a lot of time has passed and we're at v5.2 now...have things changed? Have Google&Yahoo, for example, moved to PHP5? Or is PHP4 still the recommendation for such environments? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date to string
How do I take "2007-02-01" and turn it into Thursday, February 1, 2006? Simple question, except I don't know the answer :) This is all I see for now: http://ca.php.net/manual/en/function.px-date2string.php John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 & Commercial Development
Eric Gorr wrote: I haven't tracked this particular issue, but I know when PHP5 was first released is wasn't recommended in a commercial/production environment. However, a lot of time has passed and we're at v5.2 now...have things changed? Have Google&Yahoo, for example, moved to PHP5? Or is PHP4 still the recommendation for such environments? It really depends. I'm sure I'll get some arguments about this but hey :P If you're writing applications where you control or have a say in the system environment (eg an internal system or you can talk to the sysadmin about what should be running), then go for the latest. If you're writing applications where you have no control over the environment - that is, your target market is using shared hosting, then you have to back down a little bit and not go for the very latest. A lot of shared hosts still use php4 for whatever reason, so you need to make your code work with that version instead. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date to string
John Taylor-Johnston wrote: How do I take "2007-02-01" and turn it into Thursday, February 1, 2006? Use strtotime (http://php.net/strtotime) to turn it into a timestamp and then format it using date (http://php.net/date). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date to string
Chris wrote: John Taylor-Johnston wrote: How do I take "2007-02-01" and turn it into Thursday, February 1, 2006? Use strtotime (http://php.net/strtotime) to turn it into a timestamp and then format it using date (http://php.net/date). echo date("l, F j, Y", strtotime("2007-02-01")); That's it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date to string
John Taylor-Johnston wrote: Chris wrote: John Taylor-Johnston wrote: How do I take "2007-02-01" and turn it into Thursday, February 1, 2006? Use strtotime (http://php.net/strtotime) to turn it into a timestamp and then format it using date (http://php.net/date). echo date("l, F j, Y", strtotime("2007-02-01")); That's it? Seems to work ;) $ php -a Just noticed your original message said about turning 2007-02-01 into 2006 :P heh. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Combining 2 DOM XML nodes from different documents
EOT; $x2 = << EOT; $X1 = new DOMDocument(); $X1->loadXML($x1); $X2 = new DOMDocument(); $X2->loadXML($x2); $X1->firstChild->appendChild($X2->firstChild->cloneNode(true)); echo htmlspecialchars($X1->saveXML()); ?> I got an error in the line $X1->firstChild->appendChild... [01-Feb-2007 22:20:29] PHP Fatal error: Uncaught exception 'DOMException' with message 'Wrong Document Error' in E:\www\mysite\htdocs\combine.php:17 Found the answer. Should use DOMDocument->importNode() method, and just append the imported node. -thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested, referenced foreach & implicit current array pointer issues
Roman Neuhauser wrote: ... > > Singleton in Design Patterns, p. 127: > > : Intent > : Ensure a class only has one instance, and provide a global point of > : access to it. > > The second part is IMO pretty much what you said. it's completely out of context: a, there is no suggestion of a class (by me) b, there is no suggestion that the data returned by the proposed function may only exist as a single instance. > >>> If you're affraid that someone will break a convention which says that >>> the global associative array $foos has string indexes and values must be >> given an array of data that is used all over a php application then it quite >> simply >> saves alot fo headaches down the road to to agree on a convention that says >> 'we' will use a function to retrieve this data whenever it is needed >> (regardless > > Agreeing on abandoning global variables would save even more headaches. so what's your solution to data that is shared accross an application? - for instance user data - or should every bit of code [re]retrieve the user data from the database? and is the database really not just a 'global variable' wrapped up in a couple of functions that are used to return data? and where would the 'key' come from that allows for the retrieval of said user data? > >>> positive integers, or that it needs to be an array at all >>> ($GLOBALS['foos'] = new sabotage("haha")), you would be better off in >>> e. g. C++ with >>> >>> std::map foos; >> please refrain from the old >> 'you-should-be-using-language-FOO-look-i'll-show-you-how-clever-I-am' >> argument it's not really adding anything to this discussion. > > Originally I wanted to illustrate my point using PHP, but it's much more > code. Sorry if I hurt your feelings. hardly - it's just that this is a php list - C++ examples aren't very useful on the whole, and the language comparison is never truely orthogonal. > >>> It's not control over data types, it's visibility of access that causes >>> most of the lossage. Wrapping the global in a function doesn't remove >>> the structural defect. >> huh? > > If PHP was statically typed, global variables would still be a bad > smell. They are bad smell in C++ and Java, for example. It's too easy > to call getfoo() before you have set up $foo. The risk grows > exponentially: as soon as you add another global, $bar, you risk that > you or someone else will use getfoo() inside initbar(), and getbar() > inside initfoo() (or getfoo() inside initfoo()). Of course, it will be > several function calls deep, and quite probably only happen in a code > path that's rarly used (such as error handling). that is just utterly contrived? why does there need to be 2 seperate functions for init() & get()? doesn't encapsulation suggest that hiding the init() specifics within the get()is a good idea - why should the caller of get() have to worry about the init() at all? [sounds like unit testing is forcing a very rigid view of how to do things - given that unit testing 'forces' lego-brick type of code it might be worth considering that lots of real-world building are built from concrete. - granted it's a weird analogy] where does $foo come from and how it is initialized in your world exactly? and how do you suggest using, accessing, retrieving $foo? (i'm assuming you have a perfume to battle against all these awfully bad smells) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php