Re: [PHP] how to exact mys database record?
On Sun, 2009-08-30 at 15:31 -0700, ann kok wrote: Hi how to exact mys database record in virtual format? Thank you __ Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php Erm, what sort of database is it? Have you read the manual on how to get PHP to connect and retrieve data from a database? Have you tried the examples? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: windows 5.2.10 PHP not working with phpinfo
On Mon, 2009-08-31 at 02:11 +0200, Ralph Deffke wrote: use wamp 2 !! http://www.wampserver.com/ no easier way under windows ralph_def...@yahoo.de Fred Silsbee fredsils...@yahoo.com wrote in message news:43633.64942...@web59909.mail.ac4.yahoo.com... I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: .The website is under maintenance. .The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around I've always that EasyPHP is very easy to set up. Just click the installer, tick the checkboxes for the modules you want to install, and it's done. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Write Japanese text into an existing PDF
At 10:23 PM -0600 8/31/09, George Langley wrote: On 31-Aug-09, at 6:37 AM, tedd wrote: I used the PDFB library to create this: http://webbytedd.com/bb/pdf/ Here's a link for more information: http://chir.ag/projects/pdfb/ While I've never used Japanese text, I think as long as you have a font for it, it should work. Cool - looks like it could be used to brand a PDF with dynamic text inserted by a visitor to your site. This has potential for me! Thanks! George Langley Musician, Arranger, Composer George: Yes, the dynamic text could come from anywhere (i.e., form, database, email, whatever). Using the library, you can create any type of document you want -- it just takes time. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_match doesn't match Greek
Hi gang, I am trying to make a form validation using preg_match and it fails. I think it is because the input is in Greek. I have made this script: $str = ΕΕΝ 5196; $pattern = /^[[:alnum:]\s\-\,]*$/u; echo 'pre'; print preg_match($pattern,$str,$matches).\n; print_r($matches); to test preg_match's behavior and when the above string has Latin characters the pattern matches when it's in greek. Can someone explain this? Is there a workaround? PS all are in UTF-8. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I'm not crazy I swear it... IE vs Safari and Firefox - The impossible!
Does anyone have any ideas on what could possibly be causing this? Matt: The first thing I would do is to validate the web portion of your application. In other words do your forms, as well as the rest of the web pages, validate? I've seen instances where people build projects around IE when that's not the browser you should be using as a foundation, but rather accommodating its shortcomings after you get your project working correctly. The second thing would be to check your javascript for errors. Oddly enough, I would use FF (Fire Bug) for that. You could post a url for us to look at as well. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
At 9:06 PM -0400 8/31/09, Paul M Foster wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Paul Paul: u r not the only 1. I h8 that 2! l8er :) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LoginShare | How to authenticate once, and login to different websites
On Tue, Sep 1, 2009 at 2:22 AM, Behzad behzad.esl...@gmail.com wrote: Dear list, i'm trying to integrate two php-driven web applications, which both require the user to authenticate using a username and a password. Consider a situation where the user has logged-in to the 1st application. She clicks over a hyper-link, which directs her to the 2nd application. The challenge is to automatically authenticate the user on the 2nd application as well. i'm wondering how? Is it secure to store the username and password in the $_SESSION, and share the session between the two applications? Please let me know what do you think. Thank you in advance, -behzad The best approach to shared sessions are, commonly, database driven, but this can vary depending on your site/network topology. If the two sites are in the same server (and the server is unique) you can share sessions, but this is risky, so you have to develop with this issue in mind, let's say avoid things like this. ?php $_SESSION[ 'something' ] = $somewhat; # you can be, probably, breaking the other app ? If you have more than just one web server, or you are planning to scale it later, then the database driven fits better. You need to share a cookie between both sites, often the session_id, and store the user-session info in a table. If the user logs-in -no matter in which site- an entry on the user-session table is set with the cookie and the user id. When the user logs-out this entry is removed, and the user is not able to navigate to private areas in both sites. Avoid doing things like a form-post from SiteA to SiteB. This kind of things only make holes to your application security system. User credentials MUST not be handled at client-side. Keep them safetily at server-side where you are who decide which action should be taken. -- Martin Scotta
Re: [PHP] IRC and English
On Tue, Sep 1, 2009 at 9:44 AM, tedd tedd.sperl...@gmail.com wrote: At 9:06 PM -0400 8/31/09, Paul M Foster wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Paul Paul: u r not the only 1. I h8 that 2! l8er :) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yo estoy de acuerdo en que respetar el idioma es importante, aunque claro, redactando sobre la computadora tiene ciertos beneficios. Yo, por ejemplo, evito utilizar acentos. Entiendo que pueda molestarles el hecho de las comunes abreviaturas. Eso es lo malo del lenguaje. Es de todos y, al mismo tiempo, de nadie. Nadie puede cambiarlo individualmente, sólo se puede mutar a través de su uso por parte la población, éste va cambiando día a día. Lamentablemente, a mi modo de ver, los mas jóvenes son quienes incurren en este tipo de acciones, y no se reduce solamente al ingles, creo que este fenómeno se da tambien en otros lenguajes (supongo) impulsado por la deficiencia de los métodos de ingreso de texto de dispositivos moviles. ¿Por que utilizo el español? Después de todo hay una lista para ello. El mundo en internet esté en ingles y yo, como hispano-hablante debi pasar por un proceso de varios años para poder lograr entender, hablar y luego redactar en ingles. ¿pasaron ustedes por el mismo proceso para participar en esta lista? Aqui somos muchos, de diferentes paises y culturas, lo importante -a mi modo de ver- es la comunicación, no el medio o la forma. Con lo cual esta recriminación carece totalmente de sentido. Es realmente triste que en una lista de un lenguaje de codigo abierto que pregona la libre participación y el mutuo beneficio a través de compartir conocimiento se realize semejante acotación; aunque mucho mas triste es que una persona oficialmente perteneciente a dicha comunidad se sume a dicho reclamo. Please do not reply that It's a English based list. Or is it allowed to discriminate here? As a non-english speaker I feel very uncomfortable with this thread. With the best intentions for the community, sincerely yours, Martin Scotta Spanish Speaker
Re: [PHP] IRC and English
2009/9/1 Martin Scotta martinsco...@gmail.com On Tue, Sep 1, 2009 at 9:44 AM, tedd tedd.sperl...@gmail.com wrote: At 9:06 PM -0400 8/31/09, Paul M Foster wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Paul Paul: u r not the only 1. I h8 that 2! l8er :) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yo estoy de acuerdo en que respetar el idioma es importante, aunque claro, redactando sobre la computadora tiene ciertos beneficios. Yo, por ejemplo, evito utilizar acentos. Entiendo que pueda molestarles el hecho de las comunes abreviaturas. Eso es lo malo del lenguaje. Es de todos y, al mismo tiempo, de nadie. Nadie puede cambiarlo individualmente, sólo se puede mutar a través de su uso por parte la población, éste va cambiando día a día. Lamentablemente, a mi modo de ver, los mas jóvenes son quienes incurren en este tipo de acciones, y no se reduce solamente al ingles, creo que este fenómeno se da tambien en otros lenguajes (supongo) impulsado por la deficiencia de los métodos de ingreso de texto de dispositivos moviles. ¿Por que utilizo el español? Después de todo hay una lista para ello. El mundo en internet esté en ingles y yo, como hispano-hablante debi pasar por un proceso de varios años para poder lograr entender, hablar y luego redactar en ingles. ¿pasaron ustedes por el mismo proceso para participar en esta lista? Aqui somos muchos, de diferentes paises y culturas, lo importante -a mi modo de ver- es la comunicación, no el medio o la forma. Con lo cual esta recriminación carece totalmente de sentido. Es realmente triste que en una lista de un lenguaje de codigo abierto que pregona la libre participación y el mutuo beneficio a través de compartir conocimiento se realize semejante acotación; aunque mucho mas triste es que una persona oficialmente perteneciente a dicha comunidad se sume a dicho reclamo. Please do not reply that It's a English based list. Or is it allowed to discriminate here? As a non-english speaker I feel very uncomfortable with this thread. With the best intentions for the community, sincerely yours, Martin Scotta Spanish Speaker I don't think we were implicating anyone in particular for this kind of behaviour, Martin, I'm certainly not. I'm a 'young person' myself (being 17) and do not under any circumstances write in such a way purely because it's harder to understand. To be honest, on this list it is mostly the foreign people that tend to use 'u' and such, is it discriminatory to state a fact? -- Luke Slater :O) this text is protected by international copyright. it is illegal for anybody apart from the recipient to keep a copy of this text. dieser text wird von internationalem urheberrecht geschuetzt. allen ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes zu behalten.
Re: [PHP] IRC and English
On Tue, 2009-09-01 at 11:16 -0300, Martin Scotta wrote: On Tue, Sep 1, 2009 at 9:44 AM, tedd tedd.sperl...@gmail.com wrote: At 9:06 PM -0400 8/31/09, Paul M Foster wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Paul Paul: u r not the only 1. I h8 that 2! l8er :) tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yo estoy de acuerdo en que respetar el idioma es importante, aunque claro, redactando sobre la computadora tiene ciertos beneficios. Yo, por ejemplo, evito utilizar acentos. Entiendo que pueda molestarles el hecho de las comunes abreviaturas. Eso es lo malo del lenguaje. Es de todos y, al mismo tiempo, de nadie. Nadie puede cambiarlo individualmente, sólo se puede mutar a través de su uso por parte la población, éste va cambiando día a día. Lamentablemente, a mi modo de ver, los mas jóvenes son quienes incurren en este tipo de acciones, y no se reduce solamente al ingles, creo que este fenómeno se da tambien en otros lenguajes (supongo) impulsado por la deficiencia de los métodos de ingreso de texto de dispositivos moviles. ¿Por que utilizo el español? Después de todo hay una lista para ello. El mundo en internet esté en ingles y yo, como hispano-hablante debi pasar por un proceso de varios años para poder lograr entender, hablar y luego redactar en ingles. ¿pasaron ustedes por el mismo proceso para participar en esta lista? Aqui somos muchos, de diferentes paises y culturas, lo importante -a mi modo de ver- es la comunicación, no el medio o la forma. Con lo cual esta recriminación carece totalmente de sentido. Es realmente triste que en una lista de un lenguaje de codigo abierto que pregona la libre participación y el mutuo beneficio a través de compartir conocimiento se realize semejante acotación; aunque mucho mas triste es que una persona oficialmente perteneciente a dicha comunidad se sume a dicho reclamo. Please do not reply that It's a English based list. Or is it allowed to discriminate here? As a non-english speaker I feel very uncomfortable with this thread. With the best intentions for the community, sincerely yours, Martin Scotta Spanish Speaker I disagree (and I did translate and read your Spanish message). This mailing list is English (I'm not sure if similar ones exist for Spanish-speaking people) so I wouldn't say that the people on the list can be accused of behaving the same way as these 'txt'ers. While Spanish is a very popular language, English is by far the most popular language of the world, being spoken as a main language (not necessarily the mother tongue though) in more countries than any other. It's also the most popular second language for those that don't speak it as a main language. I think the main point of this thread was to point out the issue of those who use 'txt spk' for normal conversations. It makes a bit of sense to do this for phone text messages, and is only natural that it came to be (character limits on a message, easier to type on a phone, etc) but there should be no excuse for posters on this list. It takes barely any more time to type 'you' instead of 'u', but trying to read a message full of stuff like that, I get a migrane and feel disinclined to help out purely because it takes too much effort to understand! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
At 3:27 PM +0100 9/1/09, Ashley Sheridan wrote: On Tue, 2009-09-01 at 11:16 -0300, Martin Scotta wrote: -snip- Martin Scotta Spanish Speaker I disagree (and I did translate and read your Spanish message). This mailing list is English (I'm not sure if similar ones exist for Spanish-speaking people) so I wouldn't say that the people on the list can be accused of behaving the same way as these 'txt'ers. While Spanish is a very popular language, English is by far the most popular language of the world, being spoken as a main language (not necessarily the mother tongue though) in more countries than any other. It's also the most popular second language for those that don't speak it as a main language. I think the main point of this thread was to point out the issue of those who use 'txt spk' for normal conversations. It makes a bit of sense to do this for phone text messages, and is only natural that it came to be (character limits on a message, easier to type on a phone, etc) but there should be no excuse for posters on this list. It takes barely any more time to type 'you' instead of 'u', but trying to read a message full of stuff like that, I get a migrane and feel disinclined to help out purely because it takes too much effort to understand! Thanks, Ash Ash: I agree with you -- this was not a slam against non-English speaking people but rather a compliant against those who are too lazy to type out you (instead shorten it to u). My take on this is, programming does not allow you to take liberties with syntax, you must spell exactly as you are required. Likewise, don't take such liberties with this list. In short, if you want us to take the time to understand your problem, then don't make our work harder by requiring us to first figure out the syntax of your question. I ignore anyone using shortened words, such as u instead of you. I figure that they don't want to take the time to ask correctly, then I don't want to take the time to figure out what they are asking. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: LoginShare | How to authenticate once, and login to different websites
Behzad wrote: Dear list, i'm trying to integrate two php-driven web applications, which both require the user to authenticate using a username and a password. Consider a situation where the user has logged-in to the 1st application. She clicks over a hyper-link, which directs her to the 2nd application. The challenge is to automatically authenticate the user on the 2nd application as well. i'm wondering how? Is it secure to store the username and password in the $_SESSION, and share the session between the two applications? Please let me know what do you think. Thank you in advance, -behzad Each application has a mechanism to tell whether the user is loggedin, and if so, who is loggedin. One of the most common is probably a uid or something saved in the session. If both apps are on the same domain and use the same session handler, then you just need to modify each apps login code to set the login stuff for the other app. Possibly create your own login code that sets the login for both apps. Either way, there's no need (and I wouldn't advise) to store the password in the session. If it's not too verbose you can post the login code for each. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IRC and English
From: Luke 2009/9/1 Martin Scotta martinsco...@gmail.com On Tue, Sep 1, 2009 at 9:44 AM, tedd tedd.sperl...@gmail.com wrote: At 9:06 PM -0400 8/31/09, Paul M Foster wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Paul Paul: u r not the only 1. I h8 that 2! l8er :) tedd Yo estoy de acuerdo en que respetar el idioma es importante, aunque claro, redactando sobre la computadora tiene ciertos beneficios. Yo, por ejemplo, evito utilizar acentos. Entiendo que pueda molestarles el hecho de las comunes abreviaturas. Eso es lo malo del lenguaje. Es de todos y, al mismo tiempo, de nadie. Nadie puede cambiarlo individualmente, sólo se puede mutar a través de su uso por parte la población, éste va cambiando día a día. Lamentablemente, a mi modo de ver, los mas jóvenes son quienes incurren en este tipo de acciones, y no se reduce solamente al ingles, creo que este fenómeno se da tambien en otros lenguajes (supongo) impulsado por la deficiencia de los métodos de ingreso de texto de dispositivos moviles. ¿Por que utilizo el español? Después de todo hay una lista para ello. El mundo en internet esté en ingles y yo, como hispano-hablante debi pasar por un proceso de varios años para poder lograr entender, hablar y luego redactar en ingles. ¿pasaron ustedes por el mismo proceso para participar en esta lista? Aqui somos muchos, de diferentes paises y culturas, lo importante -a mi modo de ver- es la comunicación, no el medio o la forma. Con lo cual esta recriminación carece totalmente de sentido. Es realmente triste que en una lista de un lenguaje de codigo abierto que pregona la libre participación y el mutuo beneficio a través de compartir conocimiento se realize semejante acotación; aunque mucho mas triste es que una persona oficialmente perteneciente a dicha comunidad se sume a dicho reclamo. Please do not reply that It's a English based list. Or is it allowed to discriminate here? As a non-english speaker I feel very uncomfortable with this thread. With the best intentions for the community, sincerely yours, Martin Scotta Spanish Speaker I don't think we were implicating anyone in particular for this kind of behaviour, Martin, I'm certainly not. I'm a 'young person' myself (being 17) and do not under any circumstances write in such a way purely because it's harder to understand. To be honest, on this list it is mostly the foreign people that tend to use 'u' and such, is it discriminatory to state a fact? -- Luke Slater But is it a fact that can be verified and documented or merely a common impression? Be that as it may, the purpose of this list is to communicate. We all come here to get or give help. It is difficult to do that when questions or answers are not expressed clearly. If it is too difficult to read the question, fewer people are likely to make an effort to understand it well enough to reply. So the more effort that goes into making a request readable, the more likely there will be useful replies. This is a trade off that many of us have to make every day, no matter what language(s) we are comfortable with. Ever hold a verbal conversation with a Texan, a Bostonian and an Australian all at once? But often even English speakers have problems expressing themselves in written form. It appears to me that most high schools in the USofA stopped teaching grammar sometime in the late 1970's. This is actually one of the better lists that I read regularly. Texting abbreviations are simply the most recent form of corruption. 133t 5p34k is even worse. Don't even get me started on homonyms. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IRC and English
On Tue, 2009-09-01 at 11:05 -0400, Bob McConnell wrote: From: Luke 2009/9/1 Martin Scotta martinsco...@gmail.com On Tue, Sep 1, 2009 at 9:44 AM, tedd tedd.sperl...@gmail.com wrote: At 9:06 PM -0400 8/31/09, Paul M Foster wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Paul Paul: u r not the only 1. I h8 that 2! l8er :) tedd Yo estoy de acuerdo en que respetar el idioma es importante, aunque claro, redactando sobre la computadora tiene ciertos beneficios. Yo, por ejemplo, evito utilizar acentos. Entiendo que pueda molestarles el hecho de las comunes abreviaturas. Eso es lo malo del lenguaje. Es de todos y, al mismo tiempo, de nadie. Nadie puede cambiarlo individualmente, sólo se puede mutar a través de su uso por parte la población, éste va cambiando día a día. Lamentablemente, a mi modo de ver, los mas jóvenes son quienes incurren en este tipo de acciones, y no se reduce solamente al ingles, creo que este fenómeno se da tambien en otros lenguajes (supongo) impulsado por la deficiencia de los métodos de ingreso de texto de dispositivos moviles. ¿Por que utilizo el español? Después de todo hay una lista para ello. El mundo en internet esté en ingles y yo, como hispano-hablante debi pasar por un proceso de varios años para poder lograr entender, hablar y luego redactar en ingles. ¿pasaron ustedes por el mismo proceso para participar en esta lista? Aqui somos muchos, de diferentes paises y culturas, lo importante -a mi modo de ver- es la comunicación, no el medio o la forma. Con lo cual esta recriminación carece totalmente de sentido. Es realmente triste que en una lista de un lenguaje de codigo abierto que pregona la libre participación y el mutuo beneficio a través de compartir conocimiento se realize semejante acotación; aunque mucho mas triste es que una persona oficialmente perteneciente a dicha comunidad se sume a dicho reclamo. Please do not reply that It's a English based list. Or is it allowed to discriminate here? As a non-english speaker I feel very uncomfortable with this thread. With the best intentions for the community, sincerely yours, Martin Scotta Spanish Speaker I don't think we were implicating anyone in particular for this kind of behaviour, Martin, I'm certainly not. I'm a 'young person' myself (being 17) and do not under any circumstances write in such a way purely because it's harder to understand. To be honest, on this list it is mostly the foreign people that tend to use 'u' and such, is it discriminatory to state a fact? -- Luke Slater But is it a fact that can be verified and documented or merely a common impression? Be that as it may, the purpose of this list is to communicate. We all come here to get or give help. It is difficult to do that when questions or answers are not expressed clearly. If it is too difficult to read the question, fewer people are likely to make an effort to understand it well enough to reply. So the more effort that goes into making a request readable, the more likely there will be useful replies. This is a trade off that many of us have to make every day, no matter what language(s) we are comfortable with. Ever hold a verbal conversation with a Texan, a Bostonian and an Australian all at once? But often even English speakers have problems expressing themselves in written form. It appears to me that most high schools in the USofA stopped teaching grammar sometime in the late 1970's. This is actually one of the better lists that I read regularly. Texting abbreviations are simply the most recent form of corruption. 133t 5p34k is even worse. Don't even get me started on homonyms. Bob McConnell I don't think homonyms are the main problem, I believe it's homophones. I see a lot of people use there, their and they're interchangeably. The one that really gets my goat though, is 'loose' and 'lose'. Very different words, but to many people, they might as well be the same! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date +30 comparison
I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today. The variable $nexteval must be greater than $today (which is today + 30 days) or a message is echoed. I'm finding this difficult to do, but I'm coming from an ASP background. Any help appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date +30 comparison
On Tue, 2009-09-01 at 12:19 -0400, David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today. The variable $nexteval must be greater than $today (which is today + 30 days) or a message is echoed. I'm finding this difficult to do, but I'm coming from an ASP background. Any help appreciated. PHP (like all languages I know) treats dates as numbers; and PHP specifically uses seconds since January 1st 1970 (other languages sometimes have different start points and can measure in milliseconds instead). With this in mind, you can compare dates directly as you would an integer, and the later date will be the higher value. To add 30 days to a given date, you could use the date_add function (http://uk2.php.net/manual/en/datetime.add.php ) which has various formats you can use to add different time units. Lastly, to turn a date like 8/26/2009, I would probably try to break it down into it's component parts (maybe using explode('/', $string_date) ) and then using those values as arguments in a mktime() function. PHP should automatically treat the values as integers if they are strings, because like ASP, it uses loose typing on variables. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] windows 5.2.10 PHP not working with phpinfo
thanks! I am new to this science! where is syslog? XP Prof event log? --- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- 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] Date +30 comparison
I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today. The variable $nexteval must be greater than $today (which is today + 30 days) or a message is echoed. I'm finding this difficult to do, but I'm coming from an ASP background. Any help appreciated. David, Look up date() and mktime() in the manual. To get today's date is easy: date('m/d/Y'); But when wanting to add days/months/years to a date, you need to use mktime() mktime() breaks apart a date into hours/minutes/seconds/months/days/years. Therefore I always break up my date into these types fo sections. $month = date('m'); $day = date('d'); $year = date('Y'); Now that I have them seperated I create a variable $future_date and assign it the value I want. In your case, 30 days in the future. $future_date = mktime(0,0,0,date($month),date($day)+30,date($year)); Now I put it back into a date format. $future_date = date('m/d/Y',$future_date); echo $future_date; Today is September 1st and the value of $future_date is October 1st because there are 30 days in Spetember. Now you can compare your dates. if ($nexteval $future_date) { echo This date has already passed; } else { *do some processing* } Hope that helps. Dan
Re: [PHP] Date +30 comparison
i prefer http://in3.php.net/strtotime it supports loads of other formats as well (including +30 days and 8/26/2009) above all it returns unix time stamp which can be used directly with date(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date +30 comparison
At 5:43 PM +0100 9/1/09, Ashley Sheridan wrote: On Tue, 2009-09-01 at 12:19 -0400, David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today. The variable $nexteval must be greater than $today (which is today + 30 days) or a message is echoed. I'm finding this difficult to do, but I'm coming from an ASP background. Any help appreciated. PHP (like all languages I know) treats dates as numbers; and PHP specifically uses seconds since January 1st 1970 (other languages sometimes have different start points and can measure in milliseconds instead). With this in mind, you can compare dates directly as you would an integer, and the later date will be the higher value. To add 30 days to a given date, you could use the date_add function (http://uk2.php.net/manual/en/datetime.add.php ) which has various formats you can use to add different time units. Lastly, to turn a date like 8/26/2009, I would probably try to break it down into it's component parts (maybe using explode('/', $string_date) ) and then using those values as arguments in a mktime() function. PHP should automatically treat the values as integers if they are strings, because like ASP, it uses loose typing on variables. David : First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); OR $next_date = strtotime('+30 days', strtotime($today_date)); Then take the seconds back to a date, like so: $the_date = date('m/d/Y', $next_date); Here's the example: http://www.webbytedd.com//future-date/ Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date +30 comparison
Ok, this is how I finally managed to get it to work - I'm sure there are other ways, but this works: //Check to make sure the next eval date is more than 30 days away $d1 = date('Y-m-d', strtotime($todays_date . '+30 day')); $d2 = date('Y-m-d', strtotime($nextdate)); if($d1$d2){ echo Sorry, your next evaluation date must be at least 30 days away, Click BACK to continue.; exit; } -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Tuesday, September 01, 2009 12:43 PM To: David Stoltz Cc: php-general@lists.php.net Subject: Re: [PHP] Date +30 comparison On Tue, 2009-09-01 at 12:19 -0400, David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today. The variable $nexteval must be greater than $today (which is today + 30 days) or a message is echoed. I'm finding this difficult to do, but I'm coming from an ASP background. Any help appreciated. PHP (like all languages I know) treats dates as numbers; and PHP specifically uses seconds since January 1st 1970 (other languages sometimes have different start points and can measure in milliseconds instead). With this in mind, you can compare dates directly as you would an integer, and the later date will be the higher value. To add 30 days to a given date, you could use the date_add function (http://uk2.php.net/manual/en/datetime.add.php ) which has various formats you can use to add different time units. Lastly, to turn a date like 8/26/2009, I would probably try to break it down into it's component parts (maybe using explode('/', $string_date) ) and then using those values as arguments in a mktime() function. PHP should automatically treat the values as integers if they are strings, because like ASP, it uses loose typing on variables. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date +30 comparison
David Stoltz wrote: I'm really struggling with dates in PHP. (Yes, I tried reading the manual)... Can someone provide code that does this: Takes current date, assigns it to a variable (let's say $today) Then adds 30 days to $today variable Takes a string ($nexteval) like '8/26/2009' and compare it to $today. The variable $nexteval must be greater than $today (which is today + 30 days) or a message is echoed. I'm finding this difficult to do, but I'm coming from an ASP background. Any help appreciated. Look at the date/time functions, they are very feature rich: $today = time(); $nexteval = strtotime('+30 days', $today); if ($today $nexteval) { echo 'Message'; } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
At 11:16 AM -0300 9/1/09, Martin Scotta wrote: As a non-english speaker I feel very uncomfortable with this thread. You shouldn't feel uncomfortable because no one is talking about you. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reading remote files
Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this??
Re: [PHP] IRC and English
On Tue, 2009-09-01 at 13:33 -0400, tedd wrote: At 11:16 AM -0300 9/1/09, Martin Scotta wrote: As a non-english speaker I feel very uncomfortable with this thread. You shouldn't feel uncomfortable because no one is talking about you. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I'll second that, I've not once seen you use txt spk, 744t speak, or any other abominable mess that passes for language these days! Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading remote files
On Tue, 2009-09-01 at 10:34 -0700, Grace Shibley wrote: Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this?? What sort of remote file is it, i.e. how are you remotely connecting to it? FTP, HTTP, SSH? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Reading remote files
From: Grace Shibley Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this?? Are you actually having a problem with memory, or simply that you have to transfer it over a network first? Depending on the protocol used, you may be able to read it in chunks, but those chunks will still have to be copied to the computer that is reading it before it can be processed. The other option is to run a process in the computer where the file resides and only send the results over the network. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading remote files
HTTP On Tue, Sep 1, 2009 at 10:36 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-09-01 at 10:34 -0700, Grace Shibley wrote: Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this?? What sort of remote file is it, i.e. how are you remotely connecting to it? FTP, HTTP, SSH? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Reading remote files
On Tue, 2009-09-01 at 10:43 -0700, Grace Shibley wrote: HTTP On Tue, Sep 1, 2009 at 10:36 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-09-01 at 10:34 -0700, Grace Shibley wrote: Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this?? What sort of remote file is it, i.e. how are you remotely connecting to it? FTP, HTTP, SSH? Thanks, Ash http://www.ashleysheridan.co.uk As far as I know then, HTTP doesn't support entering files at points specified by a remote user. A request is made for a file, and the server determines how to break it up in order to send. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date +30 comparison
At 1:28 PM -0400 9/1/09, David Stoltz wrote: Ok, this is how I finally managed to get it to work - I'm sure there are other ways, but this works: //Check to make sure the next eval date is more than 30 days away $d1 = date('Y-m-d', strtotime($todays_date . '+30 day')); $d2 = date('Y-m-d', strtotime($nextdate)); if($d1$d2){ echo Sorry, your next evaluation date must be at least 30 days away, Click BACK to continue.; exit; You got it. Just transform any date to seconds and then compare those seconds to other seconds (taken from other dates) and evaluate. Dead simple. Also note that the strtotime() and date() combination provides some very nice features like keeping track of the resultant date. You don't have to worry about leap years, or months having 28-31 days, or anything like that -- it's all taken care of for you, pretty neat huh? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading remote files
Are you actually having a problem with memory, or simply that you have to transfer it over a network first? Depending on the protocol used, you may be able to read it in chunks, but those chunks will still have to be copied to the computer that is reading it before it can be processed. The other option is to run a process in the computer where the file resides and only send the results over the network. Bob McConnell We haven't actually had a problem yet, but we don't want to run a risk of a server crash. We want to be able to call this PHP function from a standalone application that will get that particular chunk of data specified and save it to the local drive. But, so far, we have been told that any function we use (fopen/fread, file_get_contents) will first load the entire file into memory. As far as I know then, HTTP doesn't support entering files at points specified by a remote user. A request is made for a file, and the server determines how to break it up in order to send. Apparently, with file_get_contents, you can specify an offset and a datasize, but it still loads the whole file first. Is this true? On Tue, Sep 1, 2009 at 10:46 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-09-01 at 10:43 -0700, Grace Shibley wrote: HTTP On Tue, Sep 1, 2009 at 10:36 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-09-01 at 10:34 -0700, Grace Shibley wrote: Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this?? What sort of remote file is it, i.e. how are you remotely connecting to it? FTP, HTTP, SSH? Thanks, Ash http://www.ashleysheridan.co.uk As far as I know then, HTTP doesn't support entering files at points specified by a remote user. A request is made for a file, and the server determines how to break it up in order to send. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] IRC and English
On Tue, Sep 1, 2009 at 13:36, Ashley Sheridana...@ashleysheridan.co.uk wrote: I'll second that, I've not once seen you use txt spk, 744t speak, or any other abominable mess that passes for language these days! 744t speak is that like 733t speak 2.0? ;-P -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Install PHPMyAdmin with urpmi
Hi, hack. The result is: Failed. I don't know why my PHP module does not talk to my MySQL. Please keep telling me. On Tue, 1 Sep 2009 12:08:08 +0800 hack988 hack988 hack...@dev.htwap.com wrote: Use follow codes for test your php,php_mysql is work well. use your ip replace localhost,your mysql port replace 3306 and username,password to replace mysql_user, mysql_password. ?php error_reporting(2047); ini_set(display_error,On); if(mysql_connect('localhost:3306', 'mysql_user', 'mysql_password')){ echo Ok; }else{ echo Failed; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
On Tue, 2009-09-01 at 14:07 -0400, Daniel Brown wrote: On Tue, Sep 1, 2009 at 13:36, Ashley Sheridana...@ashleysheridan.co.uk wrote: I'll second that, I've not once seen you use txt spk, 744t speak, or any other abominable mess that passes for language these days! 744t speak is that like 733t speak 2.0? ;-P Yeah, but the newer version... Damnit, my typing has degraded a little after 11 hours! Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Fwd: Current PHP Global Network Statistics
Guys and gals (particularly those of you interested in the trends and metrics of PHP), here's a forwarded copy of an email I just fired off to the mirrors around the world after completion of the first of three phases of an upgrade operation. Where does your server stand? What about your development box(es)? Please share your thoughts with the class. ;-P -- Forwarded message -- From: Daniel Brown danbrown AT php DOT net Date: Tue, Sep 1, 2009 at 14:05 Subject: Current PHP Global Network Statistics To: PHP Mirrors List php-mirrors AT lists DOT php DOT net ALL: As you may now already know, after completing the first phase of the upgrade operation, all mirrors are running PHP5. Here is a breakdown of all versions, as well as some other statistics you may find interesting. Overall: Total Mirrors, World-Wide: 118 % of Mirrors with SQLite: 65.3% % of Mirrors with Stats: 37.3% % of Mirrors Running PHP5: 100.0% By version: 5.0.3: 1 5.0.4: 1 5.1.1: 1 5.1.2: 2 5.1.6: 20 5.2.0: 8 5.2.1: 3 5.2.3: 2 5.2.4: 7 5.2.5: 2 5.2.6: 17 5.2.8: 12 5.2.9: 23 5.2.10: 12 5.3.0: 6 5.3.1: 1 Subject to deletion in Phase II: 5 Running development versions: 1 Content Age Sampling: Oldest Mirror: 963096 Seconds (NOTE: Disabled, Pending Delete) Youngest Mirrors: 98 Seconds Most Common Ages: 1891 Seconds, 3699 Seconds Total Average Age: 26160.2 Seconds (7 Hours, 16 Minutes) Adjusted Average Age: 18083.2 Seconds (5 Hours, 1 Minute) [NOTE: Adjustment removes disabled mirror from calculation.] Thanks again, as always, for everyone's hard work and dedication. We're looking forward to working with all of you for a long time to come! -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Install PHPMyAdmin with urpmi
Ricky Tompu Breaky wrote: Hi, hack. The result is: Failed. I don't know why my PHP module does not talk to my MySQL. Please keep telling me. On Tue, 1 Sep 2009 12:08:08 +0800 hack988 hack988 hack...@dev.htwap.com wrote: Use follow codes for test your php,php_mysql is work well. use your ip replace localhost,your mysql port replace 3306 and username,password to replace mysql_user, mysql_password. ?php error_reporting(2047); ini_set(display_error,On); if(mysql_connect('localhost:3306', 'mysql_user', 'mysql_password')){ echo Ok; }else{ echo Failed; } ? In php.ini there must be a extension=mysql.so line. If there is, make sure that it isn't prefaced by a ; semicolon. Also, in the script it should be ini_set(display_errors,On); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CodeWorks 09
Hey all, Just wanted to make sure you knew about php|architect's upcoming CodeWorks conference, coming to 7 cities in 14 days: - San Francisco, CA: Sept 22-23 - Los Angeles, CA: Sept 24-25 - Dallas, TX: Sept 26-27 - Atlanta, GA: Sept 28-29 - Miami, FL: Sept 30 - Oct 1 - Washington, DC: Oct 2-3 - New York, NY: Oct 4-5 Each two-day event includes a day of *in-depth PHP tutorials* and a day of *PHP conference talks* arranged across three different tracks, all presented by the *best experts* in the business. Each event is limited to 300 attendees and prices increase the closer we get to each event. Get your tickets today before we run out or the price goes up! For more information and to register, you can go to http://cw.mtacon.com. Hope to see you there! -Elizabeth
Re: [PHP] Date +30 comparison
On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); No. Due to Daylight Saving Time, many time zones have two days each year when the number of seconds in a day is not 86400. OR $next_date = strtotime('+30 days', strtotime($today_date)); Then take the seconds back to a date, like so: $the_date = date('m/d/Y', $next_date); Yes. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Current PHP Global Network Statistics
On Tue, Sep 1, 2009 at 2:12 PM, Daniel Browndanbr...@php.net wrote: Guys and gals (particularly those of you interested in the trends and metrics of PHP), here's a forwarded copy of an email I just fired off to the mirrors around the world after completion of the first of three phases of an upgrade operation. Where does your server stand? What about your development box(es)? Please share your thoughts with the class. ;-P -- Forwarded message -- From: Daniel Brown danbrown AT php DOT net Date: Tue, Sep 1, 2009 at 14:05 Subject: Current PHP Global Network Statistics To: PHP Mirrors List php-mirrors AT lists DOT php DOT net ALL: As you may now already know, after completing the first phase of the upgrade operation, all mirrors are running PHP5. Here is a breakdown of all versions, as well as some other statistics you may find interesting. Overall: Total Mirrors, World-Wide: 118 % of Mirrors with SQLite: 65.3% % of Mirrors with Stats: 37.3% % of Mirrors Running PHP5: 100.0% By version: 5.0.3: 1 5.0.4: 1 5.1.1: 1 5.1.2: 2 5.1.6: 20 5.2.0: 8 5.2.1: 3 5.2.3: 2 5.2.4: 7 5.2.5: 2 5.2.6: 17 5.2.8: 12 5.2.9: 23 5.2.10: 12 5.3.0: 6 5.3.1: 1 Subject to deletion in Phase II: 5 Running development versions: 1 Content Age Sampling: Oldest Mirror: 963096 Seconds (NOTE: Disabled, Pending Delete) Youngest Mirrors: 98 Seconds Most Common Ages: 1891 Seconds, 3699 Seconds Total Average Age: 26160.2 Seconds (7 Hours, 16 Minutes) Adjusted Average Age: 18083.2 Seconds (5 Hours, 1 Minute) [NOTE: Adjustment removes disabled mirror from calculation.] Thanks again, as always, for everyone's hard work and dedication. We're looking forward to working with all of you for a long time to come! -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I'm not entirely sure what you're expecting here, but I'll take a stab, I suppose! We recently switched to 5.3.0 on production machines (a shame, I know) after some extensive testing in our development and staging environment deemed the release //stable for our uses//. Outside of that, I've one machine that's running latest SVN checkout of the 5.3 branch. Why is 5.1.6 such a popular release for the mirrors, just the fact it's the last release in the 5.1 series? Why is 5.1.6 such a popular release for the PHP mirrors? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date +30 comparison
On Tue, Sep 01, 2009 at 02:47:43PM -0400, Andrew Ballard wrote: On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); No. Due to Daylight Saving Time, many time zones have two days each year when the number of seconds in a day is not 86400. This and the 2038 bug are reasons to do this type of calculation with Julian days, as opposed to seconds. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fwd: Current PHP Global Network Statistics
On Tue, Sep 1, 2009 at 15:10, Eddie Drapkinoorza...@gmail.com wrote: Why is 5.1.6 such a popular release for the PHP mirrors? It's a common distro release, particular for RPM's (CentOS, Fedora, RHEL). In fact, that's why I set that as the minimum version in the requirements during the upgrade operation: http://news.php.net/php.mirrors/37555 -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading remote files
I think, this also depends on the oprating system. I would say that any development team would avoid loading file type data into fast memory. These problems are all over applications. From the PHP point of view, it could mean that file data have to be read into memory, but it could not mean that the data have to be necceserily in a memory chip. as smart as oprerating systems, apache and PHP are designed, I would expect some disk cashing mechanism for large data block fom the developers. so if u did not have any problem yet, do define a test with the average of traffic u are expecting and see what happens. I see a pretty good chance that there will be not so much a problem. ralph_def...@yahoo.de Grace Shibley shibl...@gmail.com wrote in message news:a4d1d5260909011055o55689189n4e42af2e319f...@mail.gmail.com... Are you actually having a problem with memory, or simply that you have to transfer it over a network first? Depending on the protocol used, you may be able to read it in chunks, but those chunks will still have to be copied to the computer that is reading it before it can be processed. The other option is to run a process in the computer where the file resides and only send the results over the network. Bob McConnell We haven't actually had a problem yet, but we don't want to run a risk of a server crash. We want to be able to call this PHP function from a standalone application that will get that particular chunk of data specified and save it to the local drive. But, so far, we have been told that any function we use (fopen/fread, file_get_contents) will first load the entire file into memory. As far as I know then, HTTP doesn't support entering files at points specified by a remote user. A request is made for a file, and the server determines how to break it up in order to send. Apparently, with file_get_contents, you can specify an offset and a datasize, but it still loads the whole file first. Is this true? On Tue, Sep 1, 2009 at 10:46 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-09-01 at 10:43 -0700, Grace Shibley wrote: HTTP On Tue, Sep 1, 2009 at 10:36 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-09-01 at 10:34 -0700, Grace Shibley wrote: Is there a way to read large (possibly 500 MB) remote files without loading the whole file into memory? We are trying to write a function that will return chunks of binary data from a file on our server given a file location, specified offset and data size. But, we have not been able to get around loading the whole file into memory first. Is there a way to do this?? What sort of remote file is it, i.e. how are you remotely connecting to it? FTP, HTTP, SSH? Thanks, Ash http://www.ashleysheridan.co.uk As far as I know then, HTTP doesn't support entering files at points specified by a remote user. A request is made for a file, and the server determines how to break it up in order to send. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CodeWorks 09
Elizabeth Naramore wrote: Hey all, Just wanted to make sure you knew about php|architect's upcoming CodeWorks conference, coming to 7 cities in 14 days: - San Francisco, CA: Sept 22-23 - Los Angeles, CA: Sept 24-25 - Dallas, TX: Sept 26-27 - Atlanta, GA: Sept 28-29 - Miami, FL: Sept 30 - Oct 1 - Washington, DC: Oct 2-3 - New York, NY: Oct 4-5 Each two-day event includes a day of *in-depth PHP tutorials* and a day of *PHP conference talks* arranged across three different tracks, all presented by the *best experts* in the business. Each event is limited to 300 attendees and prices increase the closer we get to each event. Get your tickets today before we run out or the price goes up! For more information and to register, you can go to http://cw.mtacon.com. Hope to see you there! -Elizabeth Is their anything like this in the Pacific NORTH WEST?? Seattle or Portland Oregon area would be great! -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Install PHPMyAdmin with urpmi
Dear my friend, Shawn... Hoorayit works Thank you very much Shawn Thank you...Thank you...Thank you...Thank you...1000x On Tue, 01 Sep 2009 13:14:56 -0500 Shawn McKenzie nos...@mckenzies.net wrote: Ricky Tompu Breaky wrote: Hi, hack. The result is: Failed. I don't know why my PHP module does not talk to my MySQL. Please keep telling me. On Tue, 1 Sep 2009 12:08:08 +0800 hack988 hack988 hack...@dev.htwap.com wrote: Use follow codes for test your php,php_mysql is work well. use your ip replace localhost,your mysql port replace 3306 and username,password to replace mysql_user, mysql_password. ?php error_reporting(2047); ini_set(display_error,On); if(mysql_connect('localhost:3306', 'mysql_user', 'mysql_password')){ echo Ok; }else{ echo Failed; } ? In php.ini there must be a extension=mysql.so line. If there is, make sure that it isn't prefaced by a ; semicolon. Also, in the script it should be ini_set(display_errors,On); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date +30 comparison
At 2:47 PM -0400 9/1/09, Andrew Ballard wrote: On Tue, Sep 1, 2009 at 1:27 PM, teddtedd.sperl...@gmail.com wrote: First get the date to seconds, like so: $today_date = '8/26/2009'; $next_date = strtotime($today_date) + (86400 * 30); No. Due to Daylight Saving Time, many time zones have two days each year when the number of seconds in a day is not 86400. Arrggg. But good to know. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP--on MyMarket can not get username variable value from session.
Dear my friends, I am learning a PHP implementation with MyMarket now. I got it from http://sourceforge.net/projects/mymarket/files/mymarket/mymarket-1.72/mymarket-1.72.tar.gz/download . I have installed and configured its '/var/www/html/mymarket/application.php' to the login account of my MySQL and I've been able to do login: ? /* $RCSfile: application.php,v $ (c) 2000 Ying Zhang (y...@zippydesign.com) * * $Revision: 1.7 $ * $Date: 2002/09/23 17:31:17 $ * $Author: yingz $ * error_reporting(15); class object {}; $CFG = new object; $CFG-dbhost = localhost; $CFG-dbname = mymarket; $CFG-dbuser = mymarket; $CFG-dbpass = mypassword; $CFG-wwwroot = http://127.0.0.1/mymarket;; $CFG-dirroot = dirname(__FILE__); $CFG-templatedir = $CFG-dirroot/templates; $CFG-libdir = $CFG-dirroot/lib; $CFG-imagedir= $CFG-wwwroot/images; $CFG-icondir = $CFG-imagedir/icons; $CFG-bannerdir = $CFG-imagedir/banners; $CFG-support = supp...@mymarket.org; $CFG-version = 1.71; $CFG-sessionname = mymarket; $CFG-showsponsor = true; // enabled banner advertising $CFG-currency = $; $CFG-currencyfirst = true; // show the currency symbol before the price tag $DB_DEBUG = true; $DB_DIE_ON_FAIL = true; require($CFG-libdir/stdlib.php); require($CFG-libdir/dblib.php); require($CFG-libdir/mymarket.php); require($CFG-libdir/cart.php); $ME = qualified_me(); ini_set(session.name, $CFG-sessionname); session_start(); session_register(USER); session_register(CART); if (! isset($_SESSION[USER])) { $_SESSION[USER] = array(); } if (! isset($_SESSION[CART])) { $_SESSION[CART] = new Cart; } $USER = $_SESSION[USER]; $CART = $_SESSION[CART]; db_connect($CFG-dbhost, $CFG-dbname, $CFG-dbuser, $CFG-dbpass); ? The default password of MyMarket for 'root' (administrator account) is 'password'. I have checked that my MySQL use 'md5()' as the default encryption method. I can do login. But the problem is, I can not change the password of root. The error message is: Errors Your old password is invalid . I've taken a look which script does the password replacement and I found it is '/var/www/html/mymarket/users/change_password.php' in that script I've found the function and edit it for investigating where the problem resides: ? /* change_password.php (c) 2000 Ying Zhang (y...@zippydesign.com) * */ include(../application.php); require_login(); if (match_referer() isset($_POST)) { $frm = $_POST; $errormsg = validate_form($frm, $errors); if (empty($errormsg)) { update_password($frm[newpassword]); $noticemsg = Password change successful; } } $DOC_TITLE = Change Password; include($CFG-templatedir/header.php); include($CFG-templatedir/form_header.php); include(templates/change_password_form.php); include($CFG-templatedir/footer.php); function validate_form($frm, $errors) { $errors = new Object; $msg = ; if (empty($frm[oldpassword])) { $errors-oldpassword = true; $msg .= You did not specify your old password; } elseif (! password_valid($frm[oldpassword])) { $errors-oldpassword = true; $msg .= Your old password is invalid; } elseif (empty($frm[newpassword])) { $errors-newpassword = true; $msg .= You did not specify your new password; } elseif (empty($frm[newpassword2])) { $errors-newpassword2 = true; $msg .= You did not confirm your new password; } elseif ($frm[newpassword] != $frm[newpassword2]) { $errors-newpassword = true; $errors-newpassword2 = true; $msg .= Your new passwords do not match; } return $msg; } function password_valid($password) { global $USER; $username = $SUSER[user][username]; $password = md5($password); $qid = db_query(SELECT 1 FROM users WHERE username = '$username' AND password = '$password'); /* Here my investigator */ echo db_num_rows($qid).--.SELECT 1 FROM users WHERE username = '$username' AND password = '$password'; /* end of my investigator */ return db_num_rows($qid); } function update_password($newpassword) { global $USER; $username = $USER[user][username]; $newpassword = md5($newpassword); $qid = db_query(UPDATE users SET password = '$newpassword' WHERE username = '$username'); } ? . And the result is: 0--SELECT 1 FROM users WHERE username = '' AND password = '5f4dcc3b5aa765d61d8327deb882cf99' . So the user variable is empty, that's why. Now, my problem is I don't know my the PHP Script on my Apache2 of Mandriva 2009.1 does not store the session variable? Anybody has ever found the same problem as mine? Please share it to me. Please tell me my mistake. Thank you very much in advance. -- PHP General Mailing List
[PHP] OO and Singleton class
I'm a little fuzzy on some of the PHP implementation details for some stuff. In PHP (5 = phpversion() 5.3), I'd like a configuration class which can only effectively be instantiated once. Will the following code do this? Any other suggestions or corrections? (Code is untested. Feel free to complain about syntax.) class config { private static $cfg; // Initializes the configuration from main config file function __construct() { if (!is_array(self::$cfg)) { if (defined('CFGFILE')) { include(CFGFILE); self::$cfg = $config; } else self::$cfg = array(); } } // Returns a config item or null if not found function item($index) { if (array_key_exists($index, self::$cfg)) return self::$cfg[$index]; else return null; } // Sets a config item, optionally overwriting. // Returns true on success, false on failure. function set($index, $value, $overwrite = true) { $write = false; if (array_key_exists($index, self::$cfg) and $overwrite) $write = true; elseif (!array_key_exists($index, self::$cfg)) $write = true; if ($write) { self::$cfg[$index] = $value; return true; } else return false; } }; Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP--on MyMarket can not get username variable value from session.
Ricky Tompu Breaky wrote: Dear my friends, I am learning a PHP implementation with MyMarket now. I got it from http://sourceforge.net/projects/mymarket/files/mymarket/mymarket-1.72/mymarket-1.72.tar.gz/download . I have installed and configured its '/var/www/html/mymarket/application.php' to the login account of my MySQL and I've been able to do login: ? /* $RCSfile: application.php,v $ (c) 2000 Ying Zhang (y...@zippydesign.com) * * $Revision: 1.7 $ * $Date: 2002/09/23 17:31:17 $ * $Author: yingz $ * error_reporting(15); class object {}; $CFG = new object; $CFG-dbhost = localhost; $CFG-dbname = mymarket; $CFG-dbuser = mymarket; $CFG-dbpass = mypassword; $CFG-wwwroot = http://127.0.0.1/mymarket;; $CFG-dirroot = dirname(__FILE__); $CFG-templatedir = $CFG-dirroot/templates; $CFG-libdir = $CFG-dirroot/lib; $CFG-imagedir= $CFG-wwwroot/images; $CFG-icondir = $CFG-imagedir/icons; $CFG-bannerdir = $CFG-imagedir/banners; $CFG-support = supp...@mymarket.org; $CFG-version = 1.71; $CFG-sessionname = mymarket; $CFG-showsponsor = true; // enabled banner advertising $CFG-currency = $; $CFG-currencyfirst = true; // show the currency symbol before the price tag $DB_DEBUG = true; $DB_DIE_ON_FAIL = true; require($CFG-libdir/stdlib.php); require($CFG-libdir/dblib.php); require($CFG-libdir/mymarket.php); require($CFG-libdir/cart.php); $ME = qualified_me(); ini_set(session.name, $CFG-sessionname); session_start(); session_register(USER); session_register(CART); if (! isset($_SESSION[USER])) { $_SESSION[USER] = array(); } if (! isset($_SESSION[CART])) { $_SESSION[CART] = new Cart; } $USER = $_SESSION[USER]; $CART = $_SESSION[CART]; db_connect($CFG-dbhost, $CFG-dbname, $CFG-dbuser, $CFG-dbpass); ? The default password of MyMarket for 'root' (administrator account) is 'password'. I have checked that my MySQL use 'md5()' as the default encryption method. I can do login. But the problem is, I can not change the password of root. The error message is: Errors Your old password is invalid . I've taken a look which script does the password replacement and I found it is '/var/www/html/mymarket/users/change_password.php' in that script I've found the function and edit it for investigating where the problem resides: ? /* change_password.php (c) 2000 Ying Zhang (y...@zippydesign.com) * */ include(../application.php); require_login(); if (match_referer() isset($_POST)) { $frm = $_POST; $errormsg = validate_form($frm, $errors); if (empty($errormsg)) { update_password($frm[newpassword]); $noticemsg = Password change successful; } } $DOC_TITLE = Change Password; include($CFG-templatedir/header.php); include($CFG-templatedir/form_header.php); include(templates/change_password_form.php); include($CFG-templatedir/footer.php); function validate_form($frm, $errors) { $errors = new Object; $msg = ; if (empty($frm[oldpassword])) { $errors-oldpassword = true; $msg .= You did not specify your old password; } elseif (! password_valid($frm[oldpassword])) { $errors-oldpassword = true; $msg .= Your old password is invalid; } elseif (empty($frm[newpassword])) { $errors-newpassword = true; $msg .= You did not specify your new password; } elseif (empty($frm[newpassword2])) { $errors-newpassword2 = true; $msg .= You did not confirm your new password; } elseif ($frm[newpassword] != $frm[newpassword2]) { $errors-newpassword = true; $errors-newpassword2 = true; $msg .= Your new passwords do not match; } return $msg; } function password_valid($password) { global $USER; $username = $SUSER[user][username]; $password = md5($password); $qid = db_query(SELECT 1 FROM users WHERE username = '$username' AND password = '$password'); /* Here my investigator */ echo db_num_rows($qid).--.SELECT 1 FROM users WHERE username = '$username' AND password = '$password'; /* end of my investigator */ return db_num_rows($qid); } function update_password($newpassword) { global $USER; $username = $USER[user][username]; $newpassword = md5($newpassword); $qid = db_query(UPDATE users SET password = '$newpassword' WHERE username = '$username'); } ? . And the result is: 0--SELECT 1 FROM users WHERE username = '' AND password = '5f4dcc3b5aa765d61d8327deb882cf99' . So the user variable is empty, that's why. Now, my problem is I don't know my the PHP Script on my Apache2 of Mandriva 2009.1 does not store the session variable? Anybody has ever found the same problem as mine? Please share it to me.
Re: [PHP] IRC and English
As a monolingual North American, I am also very uncomfortable with this thread. A rant about abbreviations/IRC jargon is an appropriate discussion for list, but criticizing how non-native English speakers write English is not. This thread began with a mention of the attitude that non-native English speakers have, as if non-native English speakers are a unified group that are are more likely to have a bad attitude than native English speakers. Of course such a generalization could make people uncomfortable. -jessi tedd wrote: At 11:16 AM -0300 9/1/09, Martin Scotta wrote: As a non-english speaker I feel very uncomfortable with this thread. You shouldn't feel uncomfortable because no one is talking about you. Cheers, tedd Daniel Brown wrote: On Mon, Aug 31, 2009 at 21:06, Paul M Fosterpa...@quillandmouse.com wrote: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? For example, substituting u for you. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. It's often accompanied by English so broken I don't even bother trying to decypher it, and sometimes an *attitude* (after which, I blacklist the poster). Am I the only one? It's okay if I am. Just wondering. Same here, Paul. You're correct in associating it primarily with non-native-English speakers, as well. Worse still: they use that same language in professional job proposals. Worse beyond that: they are selected for said jobs. I've dropped clients because they have put me onto a team with folks like that. Sort of cutting out the bottom of the barrel, really. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
On Tue, Sep 1, 2009 at 17:02, Jessi Berkelhammerjberkelham...@desc.org wrote: As a monolingual North American, I am also very uncomfortable with this thread. A rant about abbreviations/IRC jargon is an appropriate discussion for list, but criticizing how non-native English speakers write English is not. This thread began with a mention of the attitude that non-native English speakers have, as if non-native English speakers are a unified group that are are more likely to have a bad attitude than native English speakers. Of course such a generalization could make people uncomfortable. If you're going to quote me in your email, at least don't insinuate that I've said something that I haven't, Jessi. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO and Singleton class
On Tue, Sep 1, 2009 at 5:16 PM, Paul M Fosterpa...@quillandmouse.com wrote: I'm a little fuzzy on some of the PHP implementation details for some stuff. In PHP (5 = phpversion() 5.3), I'd like a configuration class which can only effectively be instantiated once. Will the following code do this? Any other suggestions or corrections? (Code is untested. Feel free to complain about syntax.) class config { private static $cfg; // Initializes the configuration from main config file function __construct() { if (!is_array(self::$cfg)) { if (defined('CFGFILE')) { include(CFGFILE); self::$cfg = $config; } else self::$cfg = array(); } } // Returns a config item or null if not found function item($index) { if (array_key_exists($index, self::$cfg)) return self::$cfg[$index]; else return null; } // Sets a config item, optionally overwriting. // Returns true on success, false on failure. function set($index, $value, $overwrite = true) { $write = false; if (array_key_exists($index, self::$cfg) and $overwrite) $write = true; elseif (!array_key_exists($index, self::$cfg)) $write = true; if ($write) { self::$cfg[$index] = $value; return true; } else return false; } }; Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The primary thing you need to do to make a class a singleton is disallow the instantiation of a class directly. Which means using visibility, which is conspicuously absent from your example above. So, to prevent normal instantiation, we make the constructor private. Also, we need a method to retrieve the instance. Static members serve this purpose: class Singleton { private static $instance; private function __construct() { } public static function getInstance() { if( ! self::$instance instanceof Singleton) //replace Singleton with class name self::$instance = new Singleton; //replace Singleton with class name return self::$instance; } public function __clone() { throw new Exception('Cannot clone a Singleton'); } } This class shell will prevent people from instantiating it ($foo = new Singleton is an error). Instead, deployment will look like `$foo = Singleton::getInstance()` which, as you can tell, always returns the same instance. Throwing an exception out of __clone() will prevent something like `$foo = Singleton::getInstance(); $bar = clone $foo;` which is something I see overlooked a lot. So, if you wanted to convert your full class to a singleton it would look something like: class config { private static $instance; private static $cfg; private function __construct() { if(!is_array(self::$cfg)) { if(defined('CFGFILE')) { include(CFGFILE); self::$cfg = $config; } else { self::$cfg = array(); } } } public function getInstance() { if(!(self::$instance instanceof config)) { self::$instance = new config(); } return self::$instance; } public function __clone() { throw new Exception(Cannot clone a Singleton.); } public function item($index) { if(array_key_exists($index, self::$cfg)) return self::$cfg[$index]; else return null; } // Sets a config item, optionally overwriting. // Returns true on success, false on failure. function set($index, $value, $overwrite = true) { $write = false; if (array_key_exists($index, self::$cfg) and $overwrite) { $write = true; } elseif (!array_key_exists($index, self::$cfg)) { $write = true; } if ($write) { self::$cfg[$index] = $value; return true; } else { return false; } } } Note that this is also completely untested or anything of the sort. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
On Tue, Sep 01, 2009 at 02:02:31PM -0700, Jessi Berkelhammer wrote: As a monolingual North American, I am also very uncomfortable with this thread. A rant about abbreviations/IRC jargon is an appropriate discussion for list, but criticizing how non-native English speakers write English is not. This thread began with a mention of the attitude that non-native English speakers have, as if non-native English speakers are a unified group that are are more likely to have a bad attitude than native English speakers. Of course such a generalization could make people uncomfortable. I would argue that it's perfectly acceptable to criticize how non-native English speakers write English. But that's neither here nor there. You've clearly misread or misunderstood the original post, so let's parse it: I'm sorry, but is anyone else annoyed by people who attempt to use IRC jargon on mailing lists? Just a question, aimed at no one in particular, but expressing annoyance. For example, substituting 'u' for 'you'. Just a statement to clarify the original proposition. Oddly enough, I'm seeing this primarily in foreign language posters, not in native English speakers. Again, an observation. It does not say *all* foreign language posters are doing this. It only says that I've observed this *primarily* in foreign language posters. It doesn't say foreign language posters are bad or inferior, or even that they're part of al Qaeda. Just that I've noticed this trend in foreign language posters mostly. It's often accompanied by English so broken I don't even bother trying to decypher it, Another observation. It points out that where I've seen IRC-like idioms in foreign language posters, I've also *often* observed very poor English. Not *always*, but *often*. Again, I'm not disparaging all foreign language posters. and sometimes an *attitude* (after which, I blacklist the poster). Another observation. So we have the set of IRC-idiom posters. Of those (according to my post) *primarily* they are foreign language posters. So foreign language posters who post IRC-idioms are a large subset of IRC-idiom posters. Of *that* subset, I *often* see very broken English (a subset of the subset). And *sometimes* I see an attitude accompanying the posts (a subset of the subset of the subset). Okay? If your native language is English, the above should have been clear in the first place. And if it's not English, then I've just done you the favor of parsing it for you. (You can send cash to thank me. ;-) Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] safe_mode and inclusion of files don't work as documented
Safe mode is a bad idea. :) It's not safe; it may only have the effect of making you think you're safe. If you have a particular reason to use it then maybe it's OK, but just be aware that it will not exist in future versions of PHP and relying on it is not a good idea. Security, unfortunately, is not as simple as toggling a configuration variable. Yes -- and I always look askance at shared-hosting providers who rely on safe_mode and call it a security measure. Then when I'm done looking askance, I take my business elsewhere. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC and English
At 2:02 PM -0700 9/1/09, Jessi Berkelhammer wrote: As a monolingual North American, I am also very uncomfortable with this thread. A rant about abbreviations/IRC jargon is an appropriate discussion for list, but criticizing how non-native English speakers write English is not. This thread began with a mention of the attitude that non-native English speakers have, as if non-native English speakers are a unified group that are are more likely to have a bad attitude than native English speakers. Of course such a generalization could make people uncomfortable. -jessi tedd wrote: At 11:16 AM -0300 9/1/09, Martin Scotta wrote: As a non-english speaker I feel very uncomfortable with this thread. You shouldn't feel uncomfortable because no one is talking about you. As a fellow monolingual North American, I feel very uncomfortable about your statement as well. Does any other monolingual North American feel the same way as I do? Please expound on your feelings about this most disheartening and distasteful topic. (Boy has this thread degenerated into some politically correct bullsh#t, huh?) Look if you are not the one using u as a substitute for you, then I don't see any support for the discomfort you may feel about this thread. But you are free to feel as it is your nature (shudder). If non-English users (or anyone else for that matter) want to use u for you that's fine -- but I'll refrain from helping them as well. I am sure that if I were writing in their language and shortened it to uncomprehending gibberish, I would receive the same treatment from them. Why is this so hard to understand -- am I using words that are two lengthy? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP--on MyMarket can not get username variable value from session.
Dear Shawn. Hooray, you've solved my problem. Thank youveryverymuch. I really appreciate it. Thanks, Buddy. === On Tue, 01 Sep 2009 16:22:39 -0500 Shawn McKenzie nos...@mckenzies.net wrote: Ricky Tompu Breaky wrote: Dear my friends, I am learning a PHP implementation with MyMarket now. I got it from http://sourceforge.net/projects/mymarket/files/mymarket/mymarket-1.72/mymarket-1.72.tar.gz/download . I have installed and configured its '/var/www/html/mymarket/application.php' to the login account of my MySQL and I've been able to do login: ? /* $RCSfile: application.php,v $ (c) 2000 Ying Zhang (y...@zippydesign.com) * * $Revision: 1.7 $ * $Date: 2002/09/23 17:31:17 $ * $Author: yingz $ * error_reporting(15); class object {}; $CFG = new object; $CFG-dbhost = localhost; $CFG-dbname = mymarket; $CFG-dbuser = mymarket; $CFG-dbpass = mypassword; $CFG-wwwroot = http://127.0.0.1/mymarket;; $CFG-dirroot = dirname(__FILE__); $CFG-templatedir = $CFG-dirroot/templates; $CFG-libdir = $CFG-dirroot/lib; $CFG-imagedir= $CFG-wwwroot/images; $CFG-icondir = $CFG-imagedir/icons; $CFG-bannerdir = $CFG-imagedir/banners; $CFG-support = supp...@mymarket.org; $CFG-version = 1.71; $CFG-sessionname = mymarket; $CFG-showsponsor = true; // enabled banner advertising $CFG-currency = $; $CFG-currencyfirst = true; // show the currency symbol before the price tag $DB_DEBUG = true; $DB_DIE_ON_FAIL = true; require($CFG-libdir/stdlib.php); require($CFG-libdir/dblib.php); require($CFG-libdir/mymarket.php); require($CFG-libdir/cart.php); $ME = qualified_me(); ini_set(session.name, $CFG-sessionname); session_start(); session_register(USER); session_register(CART); if (! isset($_SESSION[USER])) { $_SESSION[USER] = array(); } if (! isset($_SESSION[CART])) { $_SESSION[CART] = new Cart; } $USER = $_SESSION[USER]; $CART = $_SESSION[CART]; db_connect($CFG-dbhost, $CFG-dbname, $CFG-dbuser, $CFG-dbpass); ? The default password of MyMarket for 'root' (administrator account) is 'password'. I have checked that my MySQL use 'md5()' as the default encryption method. I can do login. But the problem is, I can not change the password of root. The error message is: Errors Your old password is invalid . I've taken a look which script does the password replacement and I found it is '/var/www/html/mymarket/users/change_password.php' in that script I've found the function and edit it for investigating where the problem resides: ? /* change_password.php (c) 2000 Ying Zhang (y...@zippydesign.com) * */ include(../application.php); require_login(); if (match_referer() isset($_POST)) { $frm = $_POST; $errormsg = validate_form($frm, $errors); if (empty($errormsg)) { update_password($frm[newpassword]); $noticemsg = Password change successful; } } $DOC_TITLE = Change Password; include($CFG-templatedir/header.php); include($CFG-templatedir/form_header.php); include(templates/change_password_form.php); include($CFG-templatedir/footer.php); function validate_form($frm, $errors) { $errors = new Object; $msg = ; if (empty($frm[oldpassword])) { $errors-oldpassword = true; $msg .= You did not specify your old password; } elseif (! password_valid($frm[oldpassword])) { $errors-oldpassword = true; $msg .= Your old password is invalid; } elseif (empty($frm[newpassword])) { $errors-newpassword = true; $msg .= You did not specify your new password; } elseif (empty($frm[newpassword2])) { $errors-newpassword2 = true; $msg .= You did not confirm your new password; } elseif ($frm[newpassword] != $frm[newpassword2]) { $errors-newpassword = true; $errors-newpassword2 = true; $msg .= Your new passwords do not match; } return $msg; } function password_valid($password) { global $USER; $username = $SUSER[user][username]; $password = md5($password); $qid = db_query(SELECT 1 FROM users WHERE username = '$username' AND password = '$password'); /* Here my investigator */ echo db_num_rows($qid).--.SELECT 1 FROM users WHERE username = '$username' AND password = '$password'; /* end of my investigator */ return db_num_rows($qid); } function update_password($newpassword) { global $USER; $username = $USER[user][username]; $newpassword = md5($newpassword); $qid = db_query(UPDATE users SET password = '$newpassword' WHERE username = '$username'); } ? . And the result is: 0--SELECT 1 FROM users WHERE username = '' AND password =
[PHP] Generic decorators and type hinting
I'm looking for a way to implement a generic Timing class as a decorator or come up with a solution for timing code execution without cluttering the code. In my web app, there is a perceived need to measure the execution time of many function calls and database queries using ZFDebug and its timing plugin. An initial crack at this resulted in lots and lots of timing code interspersed with real code, which made modification and debugging a bit nightmarish. As a solution, I wrote a very bare-bones Timing class, a decorator that would encapsulate an object, intercept calls to the object via the __call method, start a timer, pass the call through to the encapsulated object, then stop the timer. My interface went like this: $obj = new Thing(); Timer::time( $obj ); // $obj becomes a Timer obj with $obj inside it $obj-thingMethod(); // Timer passes call to Timer-obj This worked great (and if anyone's interested I can pass on the code) -- my timers worked, and the code originally written for $obj didn't even notice -- except in cases where a function used type hinting and I got Unknown errors. I'm using Zend Framework, and (for instance) I was curious about the timing on my Initializer (a controller plugin), so I thought the following would do the trick: $initializer = new Initializer($env); Timer::time( $initializer ); $frontController-registerPlugin( $initializer ); But machinery deep in the bowels of Zend does type hinting for a Zend_Controller_Plugin_Abstract object, not a Timer, and so an error is raised. Whole point is that I want to be able to use this Timer class on anything. Seems like I should be able to if it weren't for the type hinting. Is there any way to fool a function into thinking my Timer is the same class as Timer-obj? Is there another way to cleanly wrap method calls for timing/logging purposes? Any other good patterns for measuring code execution time without cluttering the code? I found this discussion from last December, asking a very similar question, but it seemed unresolved: http://www.mail-archive.com/php-general@lists.php.net/msg238889.html -- David Kurtz dku...@technorati.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: LoginShare | How to authenticate once, and login to different websites
why not use ready available php library OAuth? http://oauth.net/ On 9/1/09, Shawn McKenzie nos...@mckenzies.net wrote: Behzad wrote: Dear list, i'm trying to integrate two php-driven web applications, which both require the user to authenticate using a username and a password. Consider a situation where the user has logged-in to the 1st application. She clicks over a hyper-link, which directs her to the 2nd application. The challenge is to automatically authenticate the user on the 2nd application as well. i'm wondering how? Is it secure to store the username and password in the $_SESSION, and share the session between the two applications? Please let me know what do you think. Thank you in advance, -behzad Each application has a mechanism to tell whether the user is loggedin, and if so, who is loggedin. One of the most common is probably a uid or something saved in the session. If both apps are on the same domain and use the same session handler, then you just need to modify each apps login code to set the login stuff for the other app. Possibly create your own login code that sets the login for both apps. Either way, there's no need (and I wouldn't advise) to store the password in the session. If it's not too verbose you can post the login code for each. -- Thanks! -Shawn http://www.spidean.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] windows 5.2.10 PHP not working with phpinfo
I looked high and low but no syslog I am currently working under XP Prof SP3 --- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- 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] Re: LoginShare | How to authenticate once, and login to different websites
Thank you all for your answers. i was looking for a simple and fast answer - I'm going to store the a unique id in the database, and pass it between applications using the $_SESSION. Shawn and Martin, Thank you very much for your help. Kind regards, -behzad
Re: [PHP] OO and Singleton class
On Tue, Sep 01, 2009 at 06:06:24PM -0400, Eddie Drapkin wrote: On Tue, Sep 1, 2009 at 5:16 PM, Paul M Fosterpa...@quillandmouse.com wrote: I'm a little fuzzy on some of the PHP implementation details for some stuff. In PHP (5 = phpversion() 5.3), I'd like a configuration class which can only effectively be instantiated once. Will the following code do this? Any other suggestions or corrections? (Code is untested. Feel free to complain about syntax.) snip The primary thing you need to do to make a class a singleton is disallow the instantiation of a class directly. Which means using visibility, which is conspicuously absent from your example above. So, to prevent normal instantiation, we make the constructor private. Also, we need a method to retrieve the instance. Static members serve this purpose: Good explanation. Thanks. I'll try it out. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] a doubt with class DOM
if my xml is something big, how reliable is saving changes to my xml this way: $doc-save('file.xml'); or another shape of save changes of my xml? Sorry my english is bad =P.- Thanks.- Best regards, Karl.- Carlos A. Garcia Hernandez José Clemente Orozco Mza. 7 Lt. 14 Pedro Ojeda Paullada Ecatepec, Edo. De México / T: +(52 55) 57809620 / E: carlos.gar...@imkarl.net / W: www.imkarl.net Por favor considere sus responsabilidades ecológicas, no imprima este documento a menos que sea realmente necesario. / Please consider your ecological responsibilities. Don't print this e-mail unless you really need to. AVISO DE CONFIDENCIALIDAD: Este mensaje de correo electrónico incluyendo en su caso los archivos adjuntos al mismo, pueden contener información de carácter confidencial y/o privilegiada, y se envían única y exclusivamente a la atención de la persona y/o entidad a quien va dirigido. La copia, revisión, uso, revelación y/o distribución de dicha información, sin autorización por escrito de Carlos A. García Hernández está prohibida. Si usted no es el destinatario a quien se dirige el presente correo, favor de contactar al remitente respondiendo al presente correo y eliminar el original incluyendo los archivos, así como cualesquiera copia del mismo. Mediante la recepción del presente correo usted reconoce y acepta que en caso de incumplimiento de su parte y/o de sus representantes a los términos antes descritos, Carlos A. García Hernández tendrá derecho a los daños y perjuicios que esto le ocasione. CONFIDENTIALITY NOTICE: This e-mail message including attachments, may contain confidential and/or privileged material and only for the person or entity to which it is addressed. Any use, review, disclosure or distribution of such confidential information without the written authorization of Carlos A. García Hernández is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message including attachments. By receiving this e-mail you acknowledge that a breach by you and/or your representatives of the above provisions may entitle Carlos A. García Hernández to seek for damages. _ Feliz aniversario Messenger! www.aniversariomessenger.com.mx
Re: [PHP] OO and Singleton class
Hi, After PHP 5.3, there is better implements for Singleton. http://d.hatena.ne.jp/Yudoufu/20090811/1250021010 This entry was written by Japanese, but you may understand php code. :-) On Wed, Sep 2, 2009 at 07:06, Eddie Drapkinoorza...@gmail.com wrote: On Tue, Sep 1, 2009 at 5:16 PM, Paul M Fosterpa...@quillandmouse.com wrote: I'm a little fuzzy on some of the PHP implementation details for some stuff. In PHP (5 = phpversion() 5.3), I'd like a configuration class which can only effectively be instantiated once. Will the following code do this? Any other suggestions or corrections? (Code is untested. Feel free to complain about syntax.) class config { private static $cfg; // Initializes the configuration from main config file function __construct() { if (!is_array(self::$cfg)) { if (defined('CFGFILE')) { include(CFGFILE); self::$cfg = $config; } else self::$cfg = array(); } } // Returns a config item or null if not found function item($index) { if (array_key_exists($index, self::$cfg)) return self::$cfg[$index]; else return null; } // Sets a config item, optionally overwriting. // Returns true on success, false on failure. function set($index, $value, $overwrite = true) { $write = false; if (array_key_exists($index, self::$cfg) and $overwrite) $write = true; elseif (!array_key_exists($index, self::$cfg)) $write = true; if ($write) { self::$cfg[$index] = $value; return true; } else return false; } }; Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The primary thing you need to do to make a class a singleton is disallow the instantiation of a class directly. Which means using visibility, which is conspicuously absent from your example above. So, to prevent normal instantiation, we make the constructor private. Also, we need a method to retrieve the instance. Static members serve this purpose: class Singleton { private static $instance; private function __construct() { } public static function getInstance() { if( ! self::$instance instanceof Singleton) //replace Singleton with class name self::$instance = new Singleton; //replace Singleton with class name return self::$instance; } public function __clone() { throw new Exception('Cannot clone a Singleton'); } } This class shell will prevent people from instantiating it ($foo = new Singleton is an error). Instead, deployment will look like `$foo = Singleton::getInstance()` which, as you can tell, always returns the same instance. Throwing an exception out of __clone() will prevent something like `$foo = Singleton::getInstance(); $bar = clone $foo;` which is something I see overlooked a lot. So, if you wanted to convert your full class to a singleton it would look something like: class config { private static $instance; private static $cfg; private function __construct() { if(!is_array(self::$cfg)) { if(defined('CFGFILE')) { include(CFGFILE); self::$cfg = $config; } else { self::$cfg = array(); } } } public function getInstance() { if(!(self::$instance instanceof config)) { self::$instance = new config(); } return self::$instance; } public function __clone() { throw new Exception(Cannot clone a Singleton.); } public function item($index) { if(array_key_exists($index, self::$cfg)) return self::$cfg[$index]; else return null; } // Sets a config item, optionally overwriting. // Returns true on success, false on failure. function set($index, $value, $overwrite = true) { $write = false; if (array_key_exists($index, self::$cfg) and $overwrite) { $write = true; } elseif (!array_key_exists($index, self::$cfg)) { $write = true; } if ($write) { self::$cfg[$index] = $value; return true; } else { return false; } } } Note that this is also completely untested or anything of the sort. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 小山哲志@テックスタイル