php-general Digest 13 May 2008 07:07:15 -0000 Issue 5456
php-general Digest 13 May 2008 07:07:15 - Issue 5456 Topics (messages 274204 through 274226): Re: A Little Something. 274204 by: Eric Butera 274206 by: tedd Re: Replacing accented characters by non-accented characters 274205 by: tedd creating an xls file from mysql data 274207 by: Richard Kurth 274211 by: Chris 274212 by: Ray Hauge 274216 by: Chris 274225 by: Richard Kurth 274226 by: Chris Re: Permissions set on php script question 274208 by: David Jourard Re: convert query result to array 274209 by: Yi Wang 274210 by: Forcey using variable in php form before the form is POSTed 274213 by: milt 274214 by: Robert Cummings Good HTML parser needed 274215 by: Shelley 274217 by: Yi Wang 274218 by: Robert Cummings 274220 by: Shelley 274221 by: Yi Wang 274223 by: Robert Cummings 274224 by: Robert Cummings tracking Mials Which were bounced. 274219 by: Chetan Rane cn2 dot php.net can't be included in the mail. 274222 by: Yi Wang Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- On Mon, May 12, 2008 at 2:57 PM, tedd [EMAIL PROTECTED] wrote: Gentlemen: First, my apologies for publishing the page without checking it first for pet-peeves. Second, please educate me as to the statement that NoScript is blocking UrchinTracker. Where do I have declared NoScript and why would I want it? I have numerous sites and they all generate these same javascript warnings, but UrchinTracker still works and I have sites that are very popular. Third, the UrchinTracker code is Google's code and I do not think I have any control over the warnings generated by their code -- do I? Fourth, the site: http://webbytedd.com/bb/tribute/ Was set up originally as an ajax site (requiring javascript) and I did not give thought to what would happen if javascript was turned off -- in my haste I violated one of the prime directives of Graceful Degradation -- sorry! If you will review the page now, you will find that has been corrected -- the page works with javascript on or off. Now, with all of that said -- which of you javascript experts can tell me what I can do to stop the warnings that are generated by Google's UrchinTracker code? Thanks and 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 NoScript is a FireFox extension to protect users from malicious scripts. JS is indeed very dangerous right now especially as mashups continue to gain popularity and all of that personal information floating around. Subscribe to planet websecurity and see the truth. The way I deal with urchin is by /etc/hosts'ing out google's adservers. Then we all win, right? ;) Here is a fairly current rant: http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=819 ---End Message--- ---BeginMessage--- At 3:11 PM -0400 5/12/08, Eric Butera wrote: NoScript is a FireFox extension to protect users from malicious scripts. NoScript is also a tag for browsers to read and react to IF they do not accept javascript. http://www.w3schools.com/TAGS/tag_noscript.asp That's an unfortunate naming convention from FireFox. https://addons.mozilla.org/en-US/firefox/addon/722 JS is indeed very dangerous right now especially as mashups continue to gain popularity and all of that personal information floating around. Subscribe to planet websecurity and see the truth. The way I deal with urchin is by /etc/hosts'ing out google's adservers. Then we all win, right? ;) Here is a fairly current rant: http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=819 Okay, I read that -- but what does that have to do with urchin? Urchin is not an ad delivery system, but rather a way to keep track of visitors to your web site. Now, how is that a security threat? Or is the claim that any site that uses js is a security threat? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- Yannick: Considering that we just had a flurry of pet-peeves on the list, I rant on one of mine. At 1:25 PM -0500 5/12/08, Yannick Warnier wrote: I'm trying to give a universally-manageable directory name to an item using a free-text title. I want to avoid every type of accentuated character and everything outside of pure ASCII to make it the most portable possible. Generating a random hash is not acceptable as we want to be the most user-friendly possible. rant
Re: [PHP] creating an xls file from mysql data
Chris wrote: Richard Kurth wrote: This script will create an xls file from the data that is sent to it When I run this it only gets one recored and it is supposet to get all the records that are past by the $_POST[selectedcontactlist] I think I have a } in the wrong place but I can not figure it out anybody have a suggestion $_POST[selectedcontactlist]=3,45,65,23,12,4,56; //this is a sample of what is past $ExplodeIt = explode(,,rtrim($_POST[selectedcontactlist],,)); $Count = count($ExplodeIt); for ($i=0; $i $Count; $i++) { $sql = SELECT * FROM contacts WHERE id = '$ExplodeIt[$i]'; Instead of doing that, do this: /** * This section makes sure the id's you are going to use in your query are actually integer id's. * If they aren't, you'll get an sql error. * */ $ids = array(); foreach ($_POST['selectedcontactlist'] as $id) { if (!is_int($id)) { continue; } $ids[] = $id; } // all posted values are duds? show an error. if (empty($ids)) { echo No id's are numeric, try again; exit; } $sql = select * from contacts where id in ( . implode(',', $ids) . ); That'll get everything for all of those id's and then you can loop over it all once: // print out the header for the csv file here. // then loop over the results: while ($row = mysql_fetch_assoc($sql_result)) { // put it into file here. } // close the file // print it out. This is what the $_POST['selectedcontactlist'] looks like 121,17,97,123,243,52,138,114,172,170,64,49,60,256,176,244,201,42,95,4, it is not coming across as an array so the foreach is throwing an error how can I make this an array in the proper format. This number are selected in a checkbox and passed with a javascript to the script should I be converting them to an array in the javascript. this is the javascript that is passing the numbers. function exportContacts(theform) { //theform.action = cmexport.php; theform.action=cmexport.php; if (getSelectedContacts(theform) != ) { theform.submit(); } else { alert(Please select contacts to export by checking the boxes to the left of the contact's name.); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating an xls file from mysql data
This is what the $_POST['selectedcontactlist'] looks like 121,17,97,123,243,52,138,114,172,170,64,49,60,256,176,244,201,42,95,4, First question is why do you need to pass it through like that? it is not coming across as an array so the foreach is throwing an error I assume it always has a ',' in it if you only choose one box. if (strpos($_POST['selectedcontactlist'], ',') === false) { // no boxes were selected - or at least there is no comma. die(); } // turn it into an array $selected_contact_lists = explode(',', $_POST['selectedcontactlist']); This number are selected in a checkbox and passed with a javascript to the script should I be converting them to an array in the javascript. No need to do that either, just make the form variable an array: input type=checkbox name=selectedcontactlist[] value=X The [] turns it into an array which php can then process automatically as an array. You can check that some checkboxes are ticked using an idea similar to this: http://homepage.ntlworld.com/kayseycarvey/jss3p8.html Though I'd just either set a flag or counter instead of a message when you find one that is checked. If you're just checking that any are checked, as soon as you find one, return true out of the function. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tracking Mials Which were bounced.
Chetan Rane wrote: Hi All I am using a PHP Mailer to send mass mails. How can I Identify how mails have bounced. Hi, I guess you have to read some RFC's to get an idea about e-mail protocols. -- Aschwin Wesselius /'What you would like to be done to you, do that to the other'/
Re: [PHP] tracking Mials Which were bounced.
Seems like the general way is to create a mailbox (POP3 or IMAP) to accept the bounces, then check it periodically and mark the emails as invalid in your local database. I would set threshholds so you don't mark something failed that only bounced once - it could have been a mail setup error or something else; I'd say wait for 3 failures in a 7 day period at least. If you get 3 bounces by that point, the address is probably safely dead. You can use PHP's IMAP functions to check the mailbox (even for POP3) or a million classes or your own functions directly on the socket (POP3 is a simple protocol) - it also helps if you parse the bounced email message to process the return address and the mail code; perhaps build something better than just 3 failures = invalid, but actually determine if they're full out failures, or if they're just temporary bounces, etc. Another method: you could just parse mail logs, if you have access to them. Chetan Rane wrote: Hi All I am using a PHP Mailer to send mass mails. How can I Identify how mails have bounced. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A Little Something.
tedd wrote: At 3:11 PM -0400 5/12/08, Eric Butera wrote: NoScript is a FireFox extension to protect users from malicious scripts. NoScript is also a tag for browsers to read and react to IF they do not accept javascript. http://www.w3schools.com/TAGS/tag_noscript.asp That's an unfortunate naming convention from FireFox. https://addons.mozilla.org/en-US/firefox/addon/722 JS is indeed very dangerous right now especially as mashups continue to gain popularity and all of that personal information floating around. Subscribe to planet websecurity and see the truth. The way I deal with urchin is by /etc/hosts'ing out google's adservers. Then we all win, right? ;) Here is a fairly current rant: http://blog.360.yahoo.com/blog-TBPekxc1dLNy5DOloPfzVvFIVOWMB0li?p=819 Okay, I read that -- but what does that have to do with urchin? Urchin is not an ad delivery system, but rather a way to keep track of visitors to your web site. Now, how is that a security threat? Or is the claim that any site that uses js is a security threat? Cheers, tedd tedd, I don't expect anyone to second-guess pet peeves :) And, as you say, Urchin is not your code: I think the onus is on the coders of Urchin to document how to avoid errors when Javascript is disabled, not the site developer who uses it. Some of us are extremely cautious about how we expose our systems to unknowns. As far as I can tell, Urchin does me no favours so I don't need to allow it in. In addition, I might not want a site to know where I am or where I came from: that is a (very mild) form of surveillance. On a more rebellious note, I actively try to confound any attempts to target advertising at me - I hate all forms of advertising (except the really clever TV ads that make me laugh) and tend to choose what products I buy based on my own research, rather than what a marketing droid thinks I need to buy. Anyway, this is waaay off-topic: it was right from the start - sorry everyone :( I'll keep my pet peeves private from now on ... Cheers Pete -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good HTML parser needed
http://htmlpurifier.org/ -- /James On Tue, May 13, 2008 at 4:34 AM, Shelley [EMAIL PROTECTED] wrote: Hi all, The fact is that I have a site that allow users to post hypertext articles. However, I saw that sometimes, because of their careless input, the articles is not rendered correctly. I want to know whether there are some good HTML parsers written in PHP. That is, the parser checks whether html tags like table, tr, td, div, dt, dl, dd, script, ul, li, span, h1, h2, etc. are nested correctly. If any tags not matched, just remove them. Any suggection is greatly appreciated. -- Regards, Shelley
Re: [PHP] Re: A Little Something.
On 13 May 2008, at 09:04, Peter Ford wrote: I think the onus is on the coders of Urchin to document how to avoid errors when Javascript is disabled, not the site developer who uses it. Just to repeat a point I made yesterday which was clearly either misunderstood or ignored... Urchin *will not* cause Javascript errors if Javascript is disabled. Odd though it may seem, it's actually not possible to write Javascript code that will cause Javascript errors if Javascript is disabled. If you choose to use an addon that disables some Javascript but not all of it you need to be willing to live with the errors that may cause. It's like expecting something to run on Windows after you've removed user.dll - it's not a reasonable expectation. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calling rsync from php script
Hello, I have a bash script update.sh that contains: rsync -- delete -avz -e ssh ${files} [EMAIL PROTECTED]:/red when I use that script ./update.sh as root, it works like a charm as I set up the private/public key properly. When run from a php script through the apache webserver ?php exec(update.sh); ? The rsync line is ignored. I understand that the php script is called under the apache user, when the private/public key is for my root user. How can I set the the keys so that the apache user can run fully the php script? More generally, how do php users handles the ssh private/public keys when calling rsync? Thank you
Re: [PHP] Re: A Little Something.
2008/5/13 Stut [EMAIL PROTECTED]: On 13 May 2008, at 09:04, Peter Ford wrote: I think the onus is on the coders of Urchin to document how to avoid errors when Javascript is disabled, not the site developer who uses it. Just to repeat a point I made yesterday which was clearly either misunderstood or ignored... Urchin *will not* cause Javascript errors if Javascript is disabled. Odd though it may seem, it's actually not possible to write Javascript code that will cause Javascript errors if Javascript is disabled. If you choose to use an addon that disables some Javascript but not all of it you need to be willing to live with the errors that may cause. While I completely agree with everything you say there, I do think there is a point to the other side side of the argument as well; It *is* sloppy practice to assume that some resource has already been initialised without checking, especially when you're relying on a third-party script. This is a pretty trivial case, but it is a really good habit to get into. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A Little Something.
On 13 May 2008, at 10:32, Robin Vickery wrote: 2008/5/13 Stut [EMAIL PROTECTED]: On 13 May 2008, at 09:04, Peter Ford wrote: I think the onus is on the coders of Urchin to document how to avoid errors when Javascript is disabled, not the site developer who uses it. Just to repeat a point I made yesterday which was clearly either misunderstood or ignored... Urchin *will not* cause Javascript errors if Javascript is disabled. Odd though it may seem, it's actually not possible to write Javascript code that will cause Javascript errors if Javascript is disabled. If you choose to use an addon that disables some Javascript but not all of it you need to be willing to live with the errors that may cause. While I completely agree with everything you say there, I do think there is a point to the other side side of the argument as well; It *is* sloppy practice to assume that some resource has already been initialised without checking, especially when you're relying on a third-party script. I agree to a certain extend, but the Javascript spec specifies that it's executed in the order it's found on the page. So if you include an external file before calling the code it contains it's perfectly acceptable to assume that code has already been included, parsed and is available to you. Given that fact, checking for the existence of such things is a waste of CPU cycles, something that Javascript developers should never assume are available in abundance. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts slowing down?
René Leboeuf wrote: I'm running a large website. I have some mailing scripts that take days to run. I noticed these scripts slow down with time, sometimes going to an almost complete stop (no mail sent for several minutes). The source code is trivial and can't contain a loop. I monitored the memory usage and couldn't find a memory leak. Using APD, most of the time is reported to be spent in the fgets() function (script waiting for a sendmail reply). But sendmail still replies swiftly when this problem occurs. It sounds like you are using SMTP to talk directly to your sendmail daemon? Restarting sendmail has no effect on these scripts. Restarting the scripts makes them run like hell for some hours, until the problem rises again. So, if there is no loop in your script, what _does_ it contain? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A Little Something.
2008/5/13 Stut [EMAIL PROTECTED]: On 13 May 2008, at 10:32, Robin Vickery wrote: 2008/5/13 Stut [EMAIL PROTECTED]: On 13 May 2008, at 09:04, Peter Ford wrote: I think the onus is on the coders of Urchin to document how to avoid errors when Javascript is disabled, not the site developer who uses it. Just to repeat a point I made yesterday which was clearly either misunderstood or ignored... Urchin *will not* cause Javascript errors if Javascript is disabled. Odd though it may seem, it's actually not possible to write Javascript code that will cause Javascript errors if Javascript is disabled. If you choose to use an addon that disables some Javascript but not all of it you need to be willing to live with the errors that may cause. While I completely agree with everything you say there, I do think there is a point to the other side side of the argument as well; It *is* sloppy practice to assume that some resource has already been initialised without checking, especially when you're relying on a third-party script. I agree to a certain extend, but the Javascript spec specifies that it's executed in the order it's found on the page. So if you include an external file before calling the code it contains it's perfectly acceptable to assume that code has already been included, parsed and is available to you. There's so many things that are out of your control when you include a third-party script that could stop it loading; misconfigured servers on their end, network outages, corporate firewalls blocking their server, etc. You can't stop any of that. But you can check for it very simply. But hey, we basically agree. So I'm going to stop there, before I start getting too involved in arguing the point. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scripts slowing down?
Hi. I'm running a large website. I have some mailing scripts that take days to run. I noticed these scripts slow down with time, sometimes going to an almost complete stop (no mail sent for several minutes). The source code is trivial and can't contain a loop. I monitored the memory usage and couldn't find a memory leak. Using APD, most of the time is reported to be spent in the fgets() function (script waiting for a sendmail reply). But sendmail still replies swiftly when this problem occurs. Restarting sendmail has no effect on these scripts. Restarting the scripts makes them run like hell for some hours, until the problem rises again. I'm using PHP 5.2.5 I don't know where to look next for the source of this problem... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good HTML parser needed
Shelley wrote: I want to know whether there are some good HTML parsers written in PHP. That is, the parser checks whether html tags like table, tr, td, div, dt, dl, dd, script, ul, li, span, h1, h2, etc. are nested correctly. If any tags not matched, just remove them. Except for the last part, any XML parser will do. Sablotron, xalan, libxsl etc. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scripts slowing down?
René Leboeuf wrote: Hi. I'm running a large website. I have some mailing scripts that take days to run. I noticed these scripts slow down with time, sometimes going to an almost complete stop (no mail sent for several minutes). The source code is trivial and can't contain a loop. I monitored the memory usage and couldn't find a memory leak. Using APD, most of the time is reported to be spent in the fgets() function (script waiting for a sendmail reply). But sendmail still replies swiftly when this problem occurs. By this, I guesss you mean that other connections to sendmail reply swiftly: so the server is not just jamming up completely and refusing requests ? It might depend on the exact implementation of 'sendmail': for example, the Courier mail system which I use replaces the program 'sendmail' with it's own binary to do the job. Courier also has a 'tar-pitting' feature which is triggered by behaviour that looks like a spammer is trying to relay stuff: it atificially slows the response to the send requests if there is an unreasonably high rate of requests coming from a given source. At least that's how I understand the feature to work. Other mail system may implement a similar feature - it might just be that your mailing script looks like a spam engine to the mail server. Restarting sendmail has no effect on these scripts. Restarting the scripts makes them run like hell for some hours, until the problem rises again. I'm using PHP 5.2.5 I don't know where to look next for the source of this problem... I think you need to provide some more detail - you could start by explaining what method you use to send the messages. The next thing to do is to look at the mail logs and see if there are any messages written around the time that yourt script runs. Don't always assume that it is your code that is wrong (that's what managers are for) -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert query result to array
fetchAll() works if php version is greater than 5. As Wang suggested, we should write our own function. its easy... i have done so many times for larger database. Store earch rows of the resultset in the array (multidimensional ie. 2). and then work on the array using the loops conditions $query = select * from tablename; $result = mysql_query($query); while($arr = somefunction($result)){ $resultarray[] = $arr; } Hope it works! On 5/13/08, Forcey [EMAIL PROTECTED] wrote: I guess PDOStatement::fetchAll() should work? see http://www.php.net/manual/en/pdostatement.fetchall.php for details. - Forcey On Tue, May 13, 2008 at 9:55 AM, Yi Wang [EMAIL PROTECTED] wrote: I think flance's meaning is whether there is a build-in function that can convert the result set to an array. The short answer is: do it yourself. On 5/12/08, Stut [EMAIL PROTECTED] wrote: On 12 May 2008, at 15:56, It flance wrote: is there any function that can convert the result of query to an associative array? what i want is the following: $query = select * from tablename; $result = mysql_query($query); $arr = somefunction($result); where $arr should be an assoiative array whose indices have the same name as the fields names of table tablename. http://php.net/mysql_fetch_assoc Please please please read the manual: http://php.net/mysql -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Wang Yi -- 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 -- Regards, Sanjeev http://www.sanchanworld.com | http://webdirectory.sanchanworld.com - submit your site
Re: [PHP] Replacing accented characters by non-accented characters
Yannick Warnier wrote: That would probably work out if it wasn't too dependent on the locales to work. I'm developing an open-source product which could end up on a server without the locales for French but be used by some French people, which would make (as far as I can get out of one comment from Richie in the PHP manual) the transliteration somewhat wrong. With the kind of rough conversion/transformation you're doing, is the locale really very important anyway? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Permissions set on php script question
If your web-server is setup to read files with .php extension through PHP engine (it is I guess) than no body from outside (using HTTP) can't read content of original PHP file only the output of that particular script. The only concern you may have is that somebody else on that server can read that file. Eg anybody who can login to server can read all your files with permission set to read on 'other' On May 12, 2008, at 11:37 PM, David Jourard wrote: Bojan Tesanovic wrote: Heh you are really new to Linux permissions on linux are set per user/group/other bases so for most secure set permissions to read only for web-server user so chown 'webserveruser' file.php chmod 400 file.php make sure you have root access at server so you can change that file or make a group for web-server as your group and set read permissions on group level chmod 440 file.php Thank-you But most web sites are virtually hosted and do not have root access to set this up. Most people just take the package and install with default masks. So again I ask: Are there are any security concerns when the read permission is set on other. ie Couldn't one write a program to remotely read the contents of the file. Wouldn't it be better if the read permission was set for user only and the php engine could run the program as user like one can do for cgi using suEXEC. Again thanks David J. Bojan Tesanovic http://www.carster.us/
RES: [PHP] Re: Scripts slowing down?
I don't know... this looks like some mail server is greylisting¹ your connections and you have to wait to deliver this message and make more connections to it. As Peter said, probably your mail server is looking like a spam engine. 1 - Greylisting puts your email in a queue and tells you have to ask again to send it in X minutes. It's great for blocking spam, as they send only once and forget about it. The amount of time to wait is configurable, perhaps a admin set it too high. Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Peter Ford [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 07:42 Para: php-general@lists.php.net Assunto: [PHP] Re: Scripts slowing down? René Leboeuf wrote: Hi. I'm running a large website. I have some mailing scripts that take days to run. I noticed these scripts slow down with time, sometimes going to an almost complete stop (no mail sent for several minutes). The source code is trivial and can't contain a loop. I monitored the memory usage and couldn't find a memory leak. Using APD, most of the time is reported to be spent in the fgets() function (script waiting for a sendmail reply). But sendmail still replies swiftly when this problem occurs. By this, I guesss you mean that other connections to sendmail reply swiftly: so the server is not just jamming up completely and refusing requests ? It might depend on the exact implementation of 'sendmail': for example, the Courier mail system which I use replaces the program 'sendmail' with it's own binary to do the job. Courier also has a 'tar-pitting' feature which is triggered by behaviour that looks like a spammer is trying to relay stuff: it atificially slows the response to the send requests if there is an unreasonably high rate of requests coming from a given source. At least that's how I understand the feature to work. Other mail system may implement a similar feature - it might just be that your mailing script looks like a spam engine to the mail server. Restarting sendmail has no effect on these scripts. Restarting the scripts makes them run like hell for some hours, until the problem rises again. I'm using PHP 5.2.5 I don't know where to look next for the source of this problem... I think you need to provide some more detail - you could start by explaining what method you use to send the messages. The next thing to do is to look at the mail logs and see if there are any messages written around the time that yourt script runs. Don't always assume that it is your code that is wrong (that's what managers are for) -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- 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] tracking Mials Which were bounced.
Chetan Rane wrote: Hi All I am using a PHP Mailer to send mass mails. How can I Identify how mails have bounced. You send them with a bounce-address that uniquely identifies the recipient - when the email bounces, you know exactly which recipient it was. I typically have my mailserver do a quick database update to set a status for such bounces. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using variable in php form before the form is POSTed
At 2:44 PM -0700 5/12/08, milt wrote: I have a form that will be filled in by the user, I want to have access to the content of one of the fields in that form, in order to fill in an another variable that is not part of the form. this variable is used by a routine when the form is posted. Question - is the $_post[field name] availble before the submit button is pushed, or is there another way to get the contents of the field? thanks, Milt Use hidden, such as: input type=hidden name=step value=1 After the form is posted, $_POST['step'] will = 1. I use this technique all the time so that I can use the same script to present different forms based upon which step in the form processing the user is on (i.e., step=1, step=2, step=3 and so on). 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] Re: A Little Something.
At 9:04 AM +0100 5/13/08, Peter Ford wrote: I don't expect anyone to second-guess pet peeves :) Why not? That's the way things change. I still haven't had anyone address the concerns I posted. Instead, I feel like a kid watching two others play a game of keep-a-way with me in the middle. No big deal -- I'll just conclude that urchin isn't a security problem and there is nothing I can do about the warnings it generates. 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] calling rsync from php script
On Tue, May 13, 2008 at 4:32 AM, Jean-Christophe Roux [EMAIL PROTECTED] wrote: Hello, I have a bash script update.sh that contains: rsync -- delete -avz -e ssh ${files} [EMAIL PROTECTED]:/red when I use that script ./update.sh as root, it works like a charm as I set up the private/public key properly. When run from a php script through the apache webserver ?php exec(update.sh); ? The rsync line is ignored. You could use a combination of BASh and Expect shell code here, but it wouldn't be very secure, because that would automate the root login. I understand that the php script is called under the apache user, when the private/public key is for my root user. How can I set the the keys so that the apache user can run fully the php script? More generally, how do php users handles the ssh private/public keys when calling rsync? Generate keys for `nobody` or `apache` (whatever user as which Apache is being executed). Alternatively, install phpSuExec, Suhosin, or suPHP so that the scripts are run as the user for which they were called. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] validating textarea using php
hi i need to validate textarea of a html form using php textarea name=comments cols=26 rows=3 id=comments?php echo($comments);?/textarea presently my php code to validate the text area is if($comments == ) { $error.=brPlease enter your comments; } with this code if a user hits the space bar once or couple of times as a matter of fact there are no characters entered by the user i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. please advice how i can change the above php code. thanks.
Re: [PHP] validating textarea using php
Quoting Sudhakar [EMAIL PROTECTED]: hi i need to validate textarea of a html form using php textarea name=comments cols=26 rows=3 id=comments?php echo($comments);?/textarea presently my php code to validate the text area is if($comments == ) { $error.=brPlease enter your comments; } with this code if a user hits the space bar once or couple of times as a matter of fact there are no characters entered by the user i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. please advice how i can change the above php code. PHP is sevrer sided. So if you want to check if a user provided the textarea with input. You have to submit the page. and let PHP do the magic. If the textarea is not filled. You could send the user back to the form. With an apropriat warning message. It's probably easier to do it with client side javascript. Check the contents of the textarea on submit and preform some actions from there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] validating textarea using php
with this code if a user hits the space bar once or couple of times as a matter of fact there are no characters entered by the user i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. One thing you might consider is, first of all, there are many characters which do not print and spaces are one of them, but from a computer standpoint they are characters, tabs and new lines are some others, the list goes on. For this specific case you can trim the results and that often will eliminate most of these if they appear at either end of what was typed, in this case the entire thing. If(trim($_POST[textareaname]) == ) echo You didn't type anything significant!; HTH, Warren Vail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] validating textarea using php
You really should use htmlspecialchars before showing any user stipulated HTML to help prevent security holes. Also you can use short tags (popular...) to make the HTML more readable. Eg: snip ?=htmlspecialchars($comments)? Just to add, short tags are not recommended for conflicts with XMLs. Use ?php echo $htmlspecialchars($comments)? instead. Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Richard Heyes [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 11:45 Para: Sudhakar Cc: php-general@lists.php.net Assunto: Re: [PHP] validating textarea using php i need to validate textarea of a html form using php textarea name=comments cols=26 rows=3 id=comments?php echo($comments);?/textarea You really should use htmlspecialchars before showing any user stipulated HTML to help prevent security holes. Also you can use short tags (popular...) to make the HTML more readable. Eg: textarea name=comments cols=26 rows=3 id=comments ?=htmlspecialchars($comments)? /textarea presently my php code to validate the text area is if($comments == ) You should not rely on register_globals, and use either $_GET or $_POST instead depending on which methoed to send your form details back to the server. Eg: if($_POST['comments'] == '' ) { ... } with this code if a user hits the space bar once or couple of times as a matter of fact there are no characters entered by the user i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. You can use the trim() function to determine whether a variable is just whitespace. $comments = trim($_POST['comments']); if ($comments == '') { // Show error message } -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- 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] validating textarea using php
i need to validate textarea of a html form using php textarea name=comments cols=26 rows=3 id=comments?php echo($comments);?/textarea You really should use htmlspecialchars before showing any user stipulated HTML to help prevent security holes. Also you can use short tags (popular...) to make the HTML more readable. Eg: textarea name=comments cols=26 rows=3 id=comments ?=htmlspecialchars($comments)? /textarea presently my php code to validate the text area is if($comments == ) You should not rely on register_globals, and use either $_GET or $_POST instead depending on which methoed to send your form details back to the server. Eg: if($_POST['comments'] == '' ) { ... } with this code if a user hits the space bar once or couple of times as a matter of fact there are no characters entered by the user i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. You can use the trim() function to determine whether a variable is just whitespace. $comments = trim($_POST['comments']); if ($comments == '') { // Show error message } -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A Little Something.
Stut wrote: On 12 May 2008, at 09:39, Peter Ford wrote: tedd wrote: Hi gang: This is what I did this morning: http://webbytedd.com/bb/tribute/ It speaks for itself. Cheers, tedd tedd, Nothing to do with the subject matter, but I noticed because it is one of your more simple pages: I get a JS urchinTracker() not defined error on your site, almost certainly because NoScript is blocking UrchinTracker... Perhaps you should wrap that naked call to urchinTracker() in a conditional - maybe as simple as if (urchinTracker) urchinTracker(); pet-peeve I really hate seeing JS errors on published sites (i.e. not development sandboxes) /pet-peeve 'course, there are many sites that make the same call to urchinTracker(), and many many worse errors... I see your pet peeve and I'll raise you one of mine... pet-peeve People who use Javascript blockers, especially Javascript blockers that do a half-arsed job which causes errors. /pet-peeve If you're going to block Javascript, block it. Don't use something that tries (and apparently fails) to block it intelligently. What are you so afraid of? -Stut My main pet peeve is when my wife leaves empty clothes hangers on door knobs throughout the house. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can Safari 3 be forced to cache a large jpeg with PHP headers?
I am creating a touch-screen kiosk application, using a full-screen version of Safari 3.1, and was wondering if there's a way I can force Safari to cache a large background image JPEG. What I'm finding is that Safari 3 will sometimes cache my large 1.1 MB background image (1680x1050), and display perfectly fine, but on occassion Safari 3 will think about the cache and Flash the screen white for a millisecond and then draw the screen. Firefox doesn't seem to have this problem, so unfortunately this is a Safari 3 only issue. I really only want to cache this ONE image - - - nothing else. Is that possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A Little Something.
On Tue, May 13, 2008 at 10:55 AM, Shawn McKenzie [EMAIL PROTECTED] wrote: My main pet peeve is when my wife leaves empty clothes hangers on door knobs throughout the house. Mine is when the pre-wife leaves her clothes on. So we're pretty similar. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
On Tue, 13 May 2008, Sudhakar wrote: hi i need to validate textarea of a html form using php textarea name=comments cols=26 rows=3 id=comments?php echo($comments);?/textarea presently my php code to validate the text area is if($comments == ) { $error.=brPlease enter your comments; } with this code if a user hits the space bar once or couple of times as a matter of fact there are no characters entered by the user i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. please advice how i can change the above php code. thanks. if(chop($comments) == ) { ... } //hope that helps. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why doesn't working with array's ever stick in my thick head?
Hi Everyone, I am taking another stab at this problem, complete with code and an example... Here is the issue: I need to be able to display pounds and ounces of a given number of pieces, the code I have does this just fine for a single route... But what I can't seem to get through my head is how to do it for a variable number of routes? Here is the code I'm working with... ?PHP //Rural Route Weight Calculator by Jason Pruim 2008 $c = 0; $num= 1; //$num = $_POST['txtNum']; $PieceWeight = $_POST['txtPieceWeight']; $RoutePieces = $_POST['txtRoutePieces']; $RouteNumber = $_POST['txtRoute']; //self submitting forms $self = $_SERVER['PHP_SELF']; $totalWeight = ($PieceWeight * $RoutePieces) /16; $weightExplode = explode('.', $totalWeight); $weightOunces = ((float)('.' . $weightExplode[0])) * 16; // Use stut's method... Seems cleaner $explodeOunces = ($totalWeight - intval($totalWeight)) * 16; if($_POST) { echo HTML div class=weightbox h1Weight calculator/h1 form method ='post' action='{$self}' pWeight of a single piece:input type=text name=txtPieceWeight size=5 value={$PieceWeight}/p HTML; while ($c != $num) { echo HTML Route Number:input type=text name=txtRoute size=5 value={$RouteNumber} Number of pieces: input type=text name=txtRoutePieces value={$RoutePieces}size=5labelTotal weight of route: {$weightExplode[0]}# {$explodeOunces} Ounces/ labelBR HTML; $c++; } echo BRinput type='submit' value='Calculate'/form/div; //DEBUG dump_debug($RoutePieces); dump_debug($RouteNumber); dump_debug($_POST); print_debug($explodeOunces); dump_debug($weightExplode); //END DEBUG }else{ echo form method='post' action='{$self}'; echo Number of routes: input type='text' name='txtNum' size='2'BR input type='submit' value='GO'; echo /form; } ? The website is: HTTP://www.raoset.com/dev/weightcalc/ I need help! My brain is going to die tonight without it :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
if(chop($comments) == ) { ... } //hope that helps. Well, chop() is an alias of rtrim(), so it won't work here for, say, trimming control characters at the end of the string like line feeds. trim() is actually the best bit here. Regards, Usamah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
On Tue, May 13, 2008 at 12:02 PM, Usamah al-Amin [EMAIL PROTECTED] wrote: if(chop($comments) == ) { ... } //hope that helps. Well, chop() is an alias of rtrim(), so it won't work here for, say, trimming control characters at the end of the string like line feeds. trim() is actually the best bit here. Regards, Usamah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php There is always using substr to mimic the Perl chomp() function. Look thru the comments on http://us.php.net/chop and you'll find a few different ways of doing it. -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Reseller plans and Dedicated servers available. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] validating textarea using php
Richard Heyes wrote: Also you can use short tags (popular...) to make the HTML more readable. Eg: textarea name=comments cols=26 rows=3 id=comments ?=htmlspecialchars($comments)? /textarea It also makes the code less portable. -- 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] validating textarea using php
On Tue, 2008-05-13 at 19:02 +0300, Usamah al-Amin wrote: if(chop($comments) == ) { ... } //hope that helps. Well, chop() is an alias of rtrim(), so it won't work here for, say, trimming control characters at the end of the string like line feeds. trim() is actually the best bit here. Actually trim() is probably less efficient since both ends of the string will be examined whereas a string containing entirely whitespace characters will rtrim() (chop() if you will) to an empty string also but the second side won't need to be examined (even if only to check for 0 length). But maybe you didn't realize this because your assertion was wrong in the first place: so it won't work here for, say, trimming control characters at the end of the string like line feeds. When clearly looking at the online documentation for rtrim() we see: This function returns a string with whitespace stripped from the end of str . Without the second parameter, rtrim() will strip these characters: (ASCII 32 (0x20)), an ordinary space. \t (ASCII 9 (0x09)), a tab. \n (ASCII 10 (0x0A)), a new line (line feed). \r (ASCII 13 (0x0D)), a carriage return. \0 (ASCII 0 (0x00)), the NUL-byte. \x0B (ASCII 11 (0x0B)), a vertical tab. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A Little Something.
At 11:01 AM -0400 5/13/08, Daniel Brown wrote: On Tue, May 13, 2008 at 10:55 AM, Shawn McKenzie [EMAIL PROTECTED] wrote: My main pet peeve is when my wife leaves empty clothes hangers on door knobs throughout the house. Mine is when the pre-wife leaves her clothes on. So we're pretty similar. I think I'll name my next pet Peeve. That reminds me that my daughter, when she was a teenager, named our cat Meow. Our neighbors all thought I had lost my mind when I was outside calling the cat. 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
RES: [PHP] Re: A Little Something.
Our neighbors all thought I had lost my mind If they only knew you lost it long ago... ;) Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: tedd [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 15:03 Para: php-general@lists.php.net Assunto: Re: [PHP] Re: A Little Something. At 11:01 AM -0400 5/13/08, Daniel Brown wrote: On Tue, May 13, 2008 at 10:55 AM, Shawn McKenzie [EMAIL PROTECTED] wrote: My main pet peeve is when my wife leaves empty clothes hangers on door knobs throughout the house. Mine is when the pre-wife leaves her clothes on. So we're pretty similar. I think I'll name my next pet Peeve. That reminds me that my daughter, when she was a teenager, named our cat Meow. Our neighbors all thought I had lost my mind when I was outside calling the cat. 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_SESSION NOT WORKING
Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. // 1.php ?php session_register('tree'); $_SESSION['tree'] = This is tree number one; header(Location: 2.php); ? // 2.php ?php print_r($_SESSION, false); ? // php.ini (incomplete) session.save_handler = files session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows session.use_cookies = 1 session.name = cito session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 0 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset= The web server is Apache 2.2 with php 5.24 for both, Linux Windows. In Linux the Apache server is run by the 'apache' user, which has reading, writing and execution grants on /tmp/php/sessions/ The output for 2.php is: Array ( [tree] = This is tree number one ) is what I get on Windows, but on Linux I get: Notice: Undefined variable: _SESSION in /var/www/html/2.php on line 2 I don't know what the error is, but something evident is that on Linux session.auto_start = 1 is NOT working properly. On Windows it is not necessary to explicitly start the session to use the $_SESSION, so no need to session_start(). If on Linux I add session_start() at the top of each script, the script executes well. I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly smime.p7s Description: S/MIME Cryptographic Signature
Re: RES: [PHP] Re: A Little Something.
On Tue, 2008-05-13 at 15:22 -0300, Thiago Pojda wrote: Our neighbors all thought I had lost my mind If they only knew you lost it long ago... ;) Atenciosamente, www.softpartech.com.br I tried to hear your website... my screen reader had a lot of trouble :| ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION NOT WORKING
Try adding session_start() at top of the script Balpo wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. // 1.php ?php session_register('tree'); $_SESSION['tree'] = This is tree number one; header(Location: 2.php); ? // 2.php ?php print_r($_SESSION, false); ? // php.ini (incomplete) session.save_handler = files session.save_path = /tmp/php/sessions/ o ;C:/temp/php/sessions for Windows session.use_cookies = 1 session.name = cito session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 0 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset= The web server is Apache 2.2 with php 5.24 for both, Linux Windows. In Linux the Apache server is run by the 'apache' user, which has reading, writing and execution grants on /tmp/php/sessions/ The output for 2.php is: Array ( [tree] = This is tree number one ) is what I get on Windows, but on Linux I get: Notice: Undefined variable: _SESSION in /var/www/html/2.php on line 2 I don't know what the error is, but something evident is that on Linux session.auto_start = 1 is NOT working properly. On Windows it is not necessary to explicitly start the session to use the $_SESSION, so no need to session_start(). If on Linux I add session_start() at the top of each script, the script executes well. I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly -- Open Source ALL content management with streaming video http://wiki.sharedlog.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
Sudhakar wrote: i do not want this to happen, if a user simply hits the spacebar and does not type anything i should be able to display an alert message. From usability point of view such check will, in many cases, generate annoyance, and bring nothing. If I do not want to enter anything, and you error me to enter something, I'll do like this - asdlöfjasdpoöfja spdfj as fsdaölkjf And your check is dead. If you want something, you will get something. It is hard (from usability point of view) to validate textarea to that extent, and especially - to get reasonable answers... I work for a scientific database, where all content providers are very intelligent, well educated and very disciplined, and the content editors still have hard time thinking how to guide the content provider so that they provide reasonable input. Your problem is not so much php related, but a usability and editorial one. Iv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: RES: [PHP] Re: A Little Something.
Too bad I do not run that ;) BTW it's in aspx... I'm not that insane. Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Robert Cummings [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 15:51 Para: Thiago Pojda Cc: php-general@lists.php.net Assunto: Re: RES: [PHP] Re: A Little Something. On Tue, 2008-05-13 at 15:22 -0300, Thiago Pojda wrote: Our neighbors all thought I had lost my mind If they only knew you lost it long ago... ;) Atenciosamente, www.softpartech.com.br I tried to hear your website... my screen reader had a lot of trouble :| ;) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SESSION NOT WORKING
On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fsockopen on ssl://
Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. ?php $host = www.microsoft.com; $path = /; $fh = fsockopen(ssl://.$host, 443, $errno, $errstr, 5);//opens url for reading with a timeout of 2 seconds if (!$fh){ echo FAIL: $errno $errstr ; } else{ $out = GET $path HTTP/1.1\r\n; $out .= Host: $host\r\n; $out .= Connection: Close\r\n; $out .= \r\n; fwrite($fh, $out); stream_set_timeout($fh,2); $info = stream_get_meta_data($fh); if($info['timed_out']){ echo TIMEOUT\n; } else{ $haystack = ; while (!feof($fh)) { $haystack.= fgets($fh, 4096); } } print $haystack; fclose($fh); } ? if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. Thanks for any help in advance and it is greatly appreciated, this problem is driving me nuts!! Cheers Bob __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
RES: [PHP] $_SESSION NOT WORKING
Actually his question was about why session.auto_start is not working on Linux, I almost answered what you both did :) Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Daniel Brown [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 16:43 Para: Balpo Cc: PHP General Assunto: Re: [PHP] $_SESSION NOT WORKING On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- 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] $_SESSION NOT WORKING
Yes, that way it works. Thanx. But the Windows version of the same code and the same php.ini ***does not *** need the session_start() because it has the session.auto_start = 1 inside php.ini. The thing is, I think session.auto_start = 1 does not work on Linux. Is this a bug? Daniel Brown wrote: On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] $_SESSION NOT WORKING
Balpo schrieb: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. // 1.php ?php session_register('tree'); $_SESSION['tree'] = This is tree number one; header(Location: 2.php); ? // 2.php ?php print_r($_SESSION, false); ? session.auto_start = 1 I want to know why session.auto_start does not work on Linux. If you require the whole php.ini, I'll send it gladly Hi! Did you test with phpinfo() if the correct php.ini is used? regards, Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fsockopen on ssl://
Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. ?php $host = www.microsoft.com; $path = /; $fh = fsockopen(ssl://.$host, 443, $errno, $errstr, 5);//opens url for reading with a timeout of 2 seconds if (!$fh){ echo FAIL: $errno $errstr ; } else{ $out = GET $path HTTP/1.1\r\n; $out .= Host: $host\r\n; $out .= Connection: Close\r\n; $out .= \r\n; fwrite($fh, $out); stream_set_timeout($fh,2); $info = stream_get_meta_data($fh); if($info['timed_out']){ echo TIMEOUT\n; } else{ $haystack = ; while (!feof($fh)) { $haystack.= fgets($fh, 4096); } } print $haystack; fclose($fh); } ? if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. Thanks for any help in advance and it is greatly appreciated, this problem is driving me nuts!! Cheers Bob __ Sent from Yahoo! Mail. A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
Re: [PHP] validating textarea using php
Dan Joseph wrote: On Tue, May 13, 2008 at 12:02 PM, Usamah al-Amin [EMAIL PROTECTED] wrote: if(chop($comments) == ) { ... } //hope that helps. Well, chop() is an alias of rtrim(), so it won't work here for, say, trimming control characters at the end of the string like line feeds. trim() is actually the best bit here. Regards, Usamah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php There is always using substr to mimic the Perl chomp() function. Look thru the comments on http://us.php.net/chop and you'll find a few different ways of doing it. Or just use trim() :-) -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
Jim Lucas wrote: Richard Heyes wrote: Also you can use short tags (popular...) to make the HTML more readable. Eg: textarea name=comments cols=26 rows=3 id=comments ?=htmlspecialchars($comments)? /textarea It also makes the code less portable. If that's even a concern. A lot of the time, it's not. -- Richard Heyes ++ | Access SSH with a Windows mapped drive | |http://www.phpguru.org/sftpdrive| ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
2008/5/14 Richard Heyes [EMAIL PROTECTED]: It also makes the code less portable. If that's even a concern. A lot of the time, it's not. A lot of people think that, until their host upgrades php. Have you seen how many things are being removed for php6? Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
Re: [PHP] tracking Mials Which were bounced.
mike wrote: Seems like the general way is to create a mailbox (POP3 or IMAP) to accept the bounces, then check it periodically and mark the emails as invalid in your local database. I would set threshholds so you don't mark something failed that only bounced once - it could have been a mail setup error or something else; I'd say wait for 3 failures in a 7 day period at least. If you get 3 bounces by that point, the address is probably safely dead. You can use PHP's IMAP functions to check the mailbox (even for POP3) or a million classes or your own functions directly on the socket (POP3 is a simple protocol) - it also helps if you parse the bounced email message to process the return address and the mail code; perhaps build something better than just 3 failures = invalid, but actually determine if they're full out failures, or if they're just temporary bounces, etc. I use this method and it works reasonably well. The hard part is the last sentence - there are so many ways to say mailbox full - half don't include smtp error codes, the rest tell you the same thing in thousands of different ways. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tracking Mials Which were bounced.
On 5/13/08, Chris [EMAIL PROTECTED] wrote: I use this method and it works reasonably well. The hard part is the last sentence - there are so many ways to say mailbox full - half don't include smtp error codes, the rest tell you the same thing in thousands of different ways. exactly. that's why i try to make it spread out - if there's failures for 7 days, odds are that email account is dead/unused. worst case you lose one person on your mailing list who doesn't check their email often enough to be worthwhile :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good XML Parser
Ok, thanks so much for the help. I went with DOM-parsing to begin with, I'll explore XPath + SimpleXML later. Thanks, Waynn On Mon, May 12, 2008 at 5:23 AM, David Otton [EMAIL PROTECTED] wrote: 2008/5/12 Waynn Lue [EMAIL PROTECTED]: So if I'm looking to parse certain attributes out of an XML tree, if I use SAX, it seems that I would need to keep track of state internally. E.g., if I have a tree like head a b/b /a a b/b /a /head and say I'm interested in all that's between b underneath any a, I'd need to have a state machine that looked for an a followed by a b. If I'm doing that, though, it seems like I should just start using a DOM parser instead? Yeah, I think you've got it nailed, although your example is simple enough (you're only holding one state value - am I a child of a?) that I'd probably still reflexively reach for the lightweight solution). I use SAX for lightweight hacks, one step up from regexes - I know the information I want is between tag and /tag, and I don't care about the rest of the document. The more I need to navigate the document, the more likely I am to use DOM. I could build my own data structures on top of a SAX parser, but why bother reinventing the wheel? Of course, you have to factor document size into that - parsing a big XML document into a tree can be slow. You might also want to explore XPath (http://uk.php.net/manual/en/function.simplexml-element-xpath.php http://uk.php.net/manual/en/class.domxpath.php)... XPath is to XML as Regexes are to text files. There's a good chance you'll be able to roll all your parsing up into a couple of XPath queries. I probably should have added that simple parsers come in two flavours - Push Parsers and Pull Parsers. I tend to think (lazily) of Push and Pull as variations on SAX, but strictly speaking they are different. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
On Wed, 2008-05-14 at 00:32 +0300, Dotan Cohen wrote: 2008/5/14 Richard Heyes [EMAIL PROTECTED]: It also makes the code less portable. If that's even a concern. A lot of the time, it's not. A lot of people think that, until their host upgrades php. Have you seen how many things are being removed for php6? PHP6??? Pshaw... PHP5 just came out the other week ;D Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_SESSION NOT WORKING --SOLVED
After an all-evening debugging I found out what the problem is. Why? Please don't ask. I have no idea. The problem was php's extension php-colorer How I got to the problem. Eliminating every extension until I got the *bad* one. Thank you: Daniel, Thiago, Jens, Verny Dmitri for your concern. Balpo Thiago Pojda wrote: Actually his question was about why session.auto_start is not working on Linux, I almost answered what you both did :) Atenciosamente, www.softpartech.com.br Thiago Henrique Pojda Desenvolvimento Web +55 41 3033-7676 [EMAIL PROTECTED] Excelência em Softwares Financeiros -Mensagem original- De: Daniel Brown [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 13 de maio de 2008 16:43 Para: Balpo Cc: PHP General Assunto: Re: [PHP] $_SESSION NOT WORKING On Tue, May 13, 2008 at 2:38 PM, Balpo [EMAIL PROTECTED] wrote: Hi everyone, I'm having a problem moving my code to a linux computer. I won't post the whole code here, but an accurate example that reproduces exactly the error. [snip!] Modify 2.php as follows: ?php session_start(); print_r($_SESSION); ? You only missed instantiating the session. The rest looks good. smime.p7s Description: S/MIME Cryptographic Signature
Re: [PHP] Can Safari 3 be forced to cache a large jpeg with PHP headers?
Rob Gould wrote: I am creating a touch-screen kiosk application, using a full-screen version of Safari 3.1, and was wondering if there's a way I can force Safari to cache a large background image JPEG. What I'm finding is that Safari 3 will sometimes cache my large 1.1 MB background image (1680x1050), and display perfectly fine, but on occassion Safari 3 will think about the cache and Flash the screen white for a millisecond and then draw the screen. Firefox doesn't seem to have this problem, so unfortunately this is a Safari 3 only issue. I really only want to cache this ONE image - - - nothing else. Is that possible? How are you sending it? through a php script or through a normal html tag? If it's through a php script, try setting a far-future expiry header. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good XML Parser
On Tue, May 13, 2008 at 7:29 PM, Waynn Lue [EMAIL PROTECTED] wrote: Ok, thanks so much for the help. I went with DOM-parsing to begin with, I'll explore XPath + SimpleXML later. just fyi, youre likely to get more bang for your buck starting off w/ SimpleXML. DOM is a successor to DOMXML from php4. its a bulky, yet powerful interface into the DOM. SimpleXML is also a DOM parser, however the interface is simpler in exchange for less power. the good news is in php5 you can switch back and for between DOM and SimpleXML easily at virtually no cost. my modo in php5 is to use SimpleXML unless there is a real need for DOM, and in that case most likey, you can get away w/ converting to DOM at runtime (again very little cost there) and doing a few operations, then carrying on w/ SimpleXML. -nathan
[PHP] Re: fsockopen on ssl://
Hello, on 05/13/2008 04:37 PM bob pilly said the following: Hi all I have tried researching this issue but havent come up with any solution so im hoping someone has seen it before and can help. I have the following test script that uses fsockopen to connect to a https site, get the contents and outputs it. ?php $host = www.microsoft.com; $path = /; $fh = fsockopen(ssl://.$host, 443, $errno, $errstr, 5);//opens url for reading with a timeout of 2 seconds if (!$fh){ echo FAIL: $errno $errstr ; } else{ $out = GET $path HTTP/1.1\r\n; $out .= Host: $host\r\n; $out .= Connection: Close\r\n; $out .= \r\n; fwrite($fh, $out); stream_set_timeout($fh,2); $info = stream_get_meta_data($fh); if($info['timed_out']){ echo TIMEOUT\n; } else{ $haystack = ; while (!feof($fh)) { $haystack.= fgets($fh, 4096); } } print $haystack; fclose($fh); } ? if i run this script using php -f test.php it works fine. However if i try and run this on my loca apache server i get the following error: Warning: fsockopen() [function.fsockopen]:unable to connect to ssl://www.microsoft.com:443 (A connection attemptfailed because the connected party did not properly respond after aperiod of time, or established connection failed because connected hosthas failed to respond.) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4 FAIL: 10060 A connection attempt failed because the connected party didnot properly respond after a period of time, or established connectionfailed because connected host has failed to respond. As you can see from that error i am using windows and apache 2.2. My php version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tlsin my config. I suspect that you are giving a very short timeout but then you are not handling the timeout error properly. Anyway, before reinventing the wheel, you may to try this HTTP client class that supports many options including establishing SSL corrections and setting and handling timeouts correctly. http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] validating textarea using php
Dotan Cohen wrote: 2008/5/14 Richard Heyes [EMAIL PROTECTED]: It also makes the code less portable. If that's even a concern. A lot of the time, it's not. A lot of people think that, until their host upgrades php. Have you seen how many things are being removed for php6? From the article I read, that isn't one of them. -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] validating using php
thanks to everyone for providing the solution for validating textarea using php i have used the following and it worked $add = trim($_POST[add]); if(strlen(trim($add)) == 0 ) { $error.=brPlease enter your address ; } as part of the form the user has to fill in their name, assuming if the user simply presses the space bar i would like to display a message like the text area. presently my validation for name is $name = trim($_POST[name]); if( strlen(trim($name) == 0 ) || !preg_match('/^[a-zA-Z ]+$/x', $name) ) { $error.=Name is blank or has special characters ; } with the above code for validating the name if a user types only spaces then the error message is displayed however if there is a gap in the name example john smith the error message is appearing which should not be happening as i have given preg_match('/^[a-zA-Z ]+$/x', $name) which means the user can type small, upper case letters and also there can be a space in the name how can i change the php code = if( strlen(trim($name) == 0 ) || !preg_match('/^[a-zA-Z ]+$/x', $name) ) so that i can validate both a) blank spaces and also accept spaces between the name, i can validate individually for spaces and uses preg_match as 2 separate lines, instead i would like to validate in a single line of php please advice. thanks.