php-general Digest 9 Mar 2008 15:58:07 -0000 Issue 5338
php-general Digest 9 Mar 2008 15:58:07 - Issue 5338 Topics (messages 271168 through 271177): Re: include() and current working directory 271168 by: Jim Lucas Re: Links hierarchy maintenance 271169 by: Per Jessen 271176 by: Adil Drissi 271177 by: Per Jessen Re: Message 271170 by: cadaver.planethalflife.com Re: send form by email with image spam controler 271171 by: Per Jessen 271173 by: Richard Heyes 271174 by: Per Jessen 271175 by: Stut path_info in fastcgi setting 271172 by: Ian M. Evans 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--- [EMAIL PROTECTED] wrote: Hi, I'm using include to display a html file from a different directory to the current working directory. This page displays, but is missing all the CSS formating. I'm assuming this is because it can't find the CSS because it's in the different directory to the CWD. So, the easy way out is to move the CSS, but I've got heaps of these, and it makes it really messy. The PHP looks like this: include(xxx/index.htm); the css is saved in the xxx folder. I'm open to any suggestions, ideas? Many thanks Matt I think your problem has to do with the difference between relative and absolute URL references. Do some googling about those and I think you might get your answer. If you do not, and since this really has nothing to do with PHP, you can email off list and I can assist you with the problem. Thanks Jim Lucas ---End Message--- ---BeginMessage--- Adil Drissi wrote: Hi, Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. CSS ? If that's not enough to alter the display, you need to make your includes sensitive to or aware of the context they're being included in. /Per Jessen, Zürich ---End Message--- ---BeginMessage--- Hi Jessen, The question is how to make it aware of the context. Do you know any work dealing with that? Thanks --- Per Jessen [EMAIL PROTECTED] wrote: Adil Drissi wrote: Hi, Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. CSS ? If that's not enough to alter the display, you need to make your includes sensitive to or aware of the context they're being included in. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ---End Message--- ---BeginMessage--- Adil Drissi wrote: Hi Jessen, The question is how to make it aware of the context. Do you know any work dealing with that? Variables? Set a variable $context= before you include, then have your include check on $context. /Per Jessen, Zürich ---End Message--- ---BeginMessage--- Important message, do not show this anyone! ---End Message--- ---BeginMessage--- tedd wrote: Here's a few. http://webbytedd.com/aa/assorted-captcha/ BUT, all can be broke by a spammer. There is no solution. How about this one - http://jessen.ch/articles/captcha Well, of course it can be broken too - it's only a matter of money and time, both of which are critical to spammers. (for the moment it has a limited number of questions and only in English). /Per Jessen, Zürich ---End Message--- ---BeginMessage--- How about this one - http://jessen.ch/articles/captcha Well, of course it can be broken too - it's only a matter of money and time, both of which are critical to spammers. (for the moment it has a limited number of questions and only in English). Interesting. How
Re: [PHP] Links hierarchy maintenance
Adil Drissi wrote: Hi, Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. CSS ? If that's not enough to alter the display, you need to make your includes sensitive to or aware of the context they're being included in. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Message
Important message, do not show this anyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send form by email with image spam controler
tedd wrote: Here's a few. http://webbytedd.com/aa/assorted-captcha/ BUT, all can be broke by a spammer. There is no solution. How about this one - http://jessen.ch/articles/captcha Well, of course it can be broken too - it's only a matter of money and time, both of which are critical to spammers. (for the moment it has a limited number of questions and only in English). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] path_info in fastcgi setting
Greetings all. Making the transition to PHP 5.2.5 operating as FastCGI through Nginx. Seem to be having a bit o' weirdness with path_info. Under Apache and the PHP module: a) test.php path_info is blank b) test.php/ppp path_info=/ppp Under PHP FastCGI: c) test.php path_info is test.php d) test.php/ppp path_info=/ppp Not sure why it's not blank in 'c' and instead equals the filename. I need coffee. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send form by email with image spam controler
How about this one - http://jessen.ch/articles/captcha Well, of course it can be broken too - it's only a matter of money and time, both of which are critical to spammers. (for the moment it has a limited number of questions and only in English). Interesting. How well does this work? I'm interested because I wrote a number to text converter which could be used as a CAPTCHA and it was eventually broken, so I resorted to the more traditional image based CAPTCHA. For example: Enter the following in numbers: Four thousand and twenty two. And of course the answer is 4022. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send form by email with image spam controler
Richard Heyes wrote: How about this one - http://jessen.ch/articles/captcha Well, of course it can be broken too - it's only a matter of money and time, both of which are critical to spammers. Interesting. How well does this work? Well - it's an idea I've had for a while, but I only just implemented it this morning. The key thing is that in order to read the question, you need to render the HTML in an engine or browser with javascript support. Just parsing the page won't help you. Like I said, it can be broken too (given sufficient effort). I'm interested because I wrote a number to text converter which could be used as a CAPTCHA and it was eventually broken, so I resorted to the more traditional image based CAPTCHA. For example: Enter the following in numbers: Four thousand and twenty two. And of course the answer is 4022. Did you use javascript to do that too? Seems to me it should work just as well as what I proposed. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send form by email with image spam controler
On 9 Mar 2008, at 12:47, Per Jessen wrote: Richard Heyes wrote: How about this one - http://jessen.ch/articles/captcha Well, of course it can be broken too - it's only a matter of money and time, both of which are critical to spammers. Interesting. How well does this work? Well - it's an idea I've had for a while, but I only just implemented it this morning. The key thing is that in order to read the question, you need to render the HTML in an engine or browser with javascript support. Just parsing the page won't help you. Like I said, it can be broken too (given sufficient effort). It's not much effort - you just need to request a second URL after you've got the form. It's not hard and really doesn't really put anything more in the way of a bot than an image-based captcha. In fact I'd argue that parsing the text in your questions is significantly easier than doing OCR on an image. I'm interested because I wrote a number to text converter which could be used as a CAPTCHA and it was eventually broken, so I resorted to the more traditional image based CAPTCHA. For example: Enter the following in numbers: Four thousand and twenty two. And of course the answer is 4022. Did you use javascript to do that too? Seems to me it should work just as well as what I proposed. Text-based captchas will never be a big hurdle for bots. Anything you can convert from a number or numbers into text can also be parsed back to the numbers. Fact. The key thing to remember when securing a form is that if you do something that's never been seen before it's unlikely that the generic bots will be able to get past it. If someone decides to target your site then a text-based captcha will never be good enough, and chances are nothing you do will work. If someone is willing to put in the effort you've got no chance. As an example I used to have a simple text-based captcha on the comment form on my blog. It was pitifully simple to get past because all it asked you to do was type 'human' into a text box, but since my blog is not very popular it's not worth the bad guys investing time to mod their bots to get past it. I had zero spam comments while that was in place. I've since switched to Wordpress and I have to say that Akismet kicks the crap out of any captcha in terms of effectiveness. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Links hierarchy maintenance
Hi Jessen, The question is how to make it aware of the context. Do you know any work dealing with that? Thanks --- Per Jessen [EMAIL PROTECTED] wrote: Adil Drissi wrote: Hi, Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. CSS ? If that's not enough to alter the display, you need to make your includes sensitive to or aware of the context they're being included in. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Links hierarchy maintenance
Adil Drissi wrote: Hi Jessen, The question is how to make it aware of the context. Do you know any work dealing with that? Variables? Set a variable $context= before you include, then have your include check on $context. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unexcepted $this
I can't under stood but PHP gaves me an error: UnExcepted $this for || $this-getFileExtension($file) == 'jpg' When I removed jpg extension check it's okay... PHP script runs well. What is the problem :) public function loadImages($folder) { $result = $this-filemanager-fecthFiles($folder); $images = array(); if (sizeof($result)=1 $result !== false) { foreach ($result as $file) { if ($this-getFileExtension($file) == 'gif' || $this-getFileExtension($file) == 'png' || $this-getFileExtension($file) == 'jpg') { $images[] = array('name'=$file); } } } return $images; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send form by email with image spam controler
Stut wrote: On 9 Mar 2008, at 12:47, Per Jessen wrote: Like I said, it can be broken too (given sufficient effort). It's not much effort - you just need to request a second URL after you've got the form. It's not hard and really doesn't really put anything more in the way of a bot than an image-based captcha. In fact I'd argue that parsing the text in your questions is significantly easier than doing OCR on an image. Ah, yes, I see what you mean. The key thing to remember when securing a form is that if you do something that's never been seen before it's unlikely that the generic bots will be able to get past it. Which will still get rid of most of the attacks. But then so will something that automatically monitors accesses to your form, and selective bans IP-addresses (e.g. after too many attempts during N minutes). If someone decides to target your site then a text-based captcha will never be good enough, and chances are nothing you do will work. If someone is willing to put in the effort you've got no chance. Absolutely. Same goes for encryption etc. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexcepted $this
Murat BEŞER wrote: I can't under stood but PHP gaves me an error: UnExcepted $this for || $this-getFileExtension($file) == 'jpg' When I removed jpg extension check it's okay... PHP script runs well. What is the problem :) public function loadImages($folder) { $result = $this-filemanager-fecthFiles($folder); $images = array(); if (sizeof($result)=1 $result !== false) { foreach ($result as $file) { if ($this-getFileExtension($file) == 'gif' || $this-getFileExtension($file) == 'png' || $this-getFileExtension($file) == 'jpg') { if ( ($this-getFileExtension($file) == 'gif') || ($this-getFileExtension($file) == 'png') || ($this-getFileExtension($file) == 'jpg') ) { ... rest of your code ... } $images[] = array('name'=$file); } } } return $images; } -- Regards, Anup Shukla -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SMTP
Hi, i know that this is not necessary the best forum for that, but i need to get a real feedback and i guess you already faced the same issue as mine. basically, i develop php web application on windows XP platform. So i have apache 2.24 installed and PHP 5.2.4. now i would like to test if my application send emails, so i've checked my php.ini file and it seems ok. i tried to use IIS from windows to define a default SMTP server, but as my emails are not sent, i guess something is wrong with IIS. so does it exist a free SMTP server (similar that linux daemon) but running on windows XP ? if yes, where can i find it and what steps should i perform to be sure my emails are sent ? i do not want to transfer all my web application each time i want to test email sending... i would like to test it locally. thanks for your feedback. -- Alain Windows XP SP2 PostgreSQL 8.2.4 / MS SQL server 2005 Apache 2.2.4 PHP 5.2.4 C# 2005-2008
Re: [PHP] SMTP
Alain Roger wrote: Hi, i know that this is not necessary the best forum for that, but i need to get a real feedback and i guess you already faced the same issue as mine. basically, i develop php web application on windows XP platform. So i have apache 2.24 installed and PHP 5.2.4. now i would like to test if my application send emails, so i've checked my php.ini file and it seems ok. i tried to use IIS from windows to define a default SMTP server, but as my emails are not sent, i guess something is wrong with IIS. so does it exist a free SMTP server (similar that linux daemon) but running on windows XP ? if yes, where can i find it and what steps should i perform to be sure my emails are sent ? i do not want to transfer all my web application each time i want to test email sending... i would like to test it locally. thanks for your feedback. I could be wrong, but I thought that you had to specify the SMTP server in the php.ini file. http://us2.php.net/manual/en/ref.mail.php#ini.smtp now i would like to test if my application send emails, so i've checked my php.ini file and it seems ok. Maybe that means you already did that. The second issue might be that your SMTP server is MS Exchange, and it requires authentication. If that is the case, then search for php SMTP authentication: http://www.google.com/search?q=php+smtp+authenticationie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a -- Ray Hauge www.primateapplications.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexcepted $this
Thank you Anup, But why I getting this error ? is this a bug ? I have changed my code like this if (in_array($this-getFileExtension($file), array('gif', 'jpg', 'png'))) { } but I can't understand. Anup Shukla yazmış: Murat BEŞER wrote: I can't under stood but PHP gaves me an error: UnExcepted $this for || $this-getFileExtension($file) == 'jpg' When I removed jpg extension check it's okay... PHP script runs well. What is the problem :) public function loadImages($folder) { $result = $this-filemanager-fecthFiles($folder); $images = array(); if (sizeof($result)=1 $result !== false) { foreach ($result as $file) { if ($this-getFileExtension($file) == 'gif' || $this-getFileExtension($file) == 'png' || $this-getFileExtension($file) == 'jpg') { if ( ($this-getFileExtension($file) == 'gif') || ($this-getFileExtension($file) == 'png') || ($this-getFileExtension($file) == 'jpg') ) { ... rest of your code ... } $images[] = array('name'=$file); } } } return $images; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SMTP
-Original Message- From: Ray Hauge [mailto:[EMAIL PROTECTED] Sent: Sunday, March 09, 2008 5:17 PM To: Alain Roger Cc: PHP General List Subject: Re: [PHP] SMTP Alain Roger wrote: Hi, i know that this is not necessary the best forum for that, but i need to get a real feedback and i guess you already faced the same issue as mine. basically, i develop php web application on windows XP platform. So i have apache 2.24 installed and PHP 5.2.4. now i would like to test if my application send emails, so i've checked my php.ini file and it seems ok. i tried to use IIS from windows to define a default SMTP server, but as my emails are not sent, i guess something is wrong with IIS. so does it exist a free SMTP server (similar that linux daemon) but running on windows XP ? if yes, where can i find it and what steps should i perform to be sure my emails are sent ? i do not want to transfer all my web application each time i want to test email sending... i would like to test it locally. thanks for your feedback. I could be wrong, but I thought that you had to specify the SMTP server in the php.ini file. http://us2.php.net/manual/en/ref.mail.php#ini.smtp now i would like to test if my application send emails, so i've checked my php.ini file and it seems ok. Maybe that means you already did that. The second issue might be that your SMTP server is MS Exchange, and it requires authentication. If that is the case, then search for php SMTP authentication: http://www.google.com/search?q=php+smtp+authenticationie=utf-8oe=utf- 8aq=trls=org.mozilla:en-US:officialclient=firefox-a -- Ray Hauge www.primateapplications.com Hi Alain, I think you have two options: 1 - Install a MTA in your windows box, such as Mercury Mail (if you install XAMPP, you get Apache, PHP, MySQL, Filezilla FTP Server and Mercury Mail - use google to know what XAMPP is). To use the mail function on windows, you will NEED a MTA (correct me if I'm wrong, but sendmail is not available in PHP for Windows, the mail function will try to reach an MTA on port 25 or the port you have set up in your php.ini). 2 - Use SMTP Authentication to send out emails on behalf of an existing authenticated email box (or a relay server if you find one). If you choose the second option (SMTP authentication) you will likely also use PHPMailer (or PEAR_Mail, or any of the featured classes at http://www.phpclasses.org that support SMTP authentication) unless you are willing to write your own class for SMTP stuff through sockets. So let's say you have an email box with the following information: User: [EMAIL PROTECTED] Password: mypassword SMTP Server: smtp.mydomain.com Your PHPMailer code will look like: $mail = new PHPMailer(); $mail-Mailer = 'smtp'; $mail-SMTPAuth = true; $mail-Username = '[EMAIL PROTECTED]'; $mail-Password = 'mypassword'; $mail-Host = 'smtp.mydomain.com'; $mail-From = '[EMAIL PROTECTED]'; $mail-FromName = 'My beautiful website'; $mail-Subject = 'You know what this is'; $mail-Body = 'Your email message'; $mail-AddAddress('[EMAIL PROTECTED]', 'Mr X-Man'); $mail-AddReplyTo('[EMAIL PROTECTED]', 'My Beautiful Website'); $mail-Send(); Hope this helps. This issue drove me crazy on my first month with PHP... what is worse, I asked in the office I worked for at that time. They said it was not possible (great I don't work there anymore). As The Rock said... NEVER SAY NO :). Cheers, Rob(inet) Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | TEL 954-607-4207 | FAX 954-337-2695 | Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace | Web: bestplace.biz | Web: seo-diy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Links hierarchy maintenance
Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. I hope the problem i posted is clearer now Two menus, do you mean like this: http://webbytedd.com/clients/beckyscan/about-company.php It's still just css and php -- simply a logic problem. 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] Links hierarchy maintenance
Yes like that, but you can consider also that the vertical menu has different style for the link of the current page. Anyway it does not matter for this problem. Can you show us how your php function looks like? Or maybe you are just doing a test for each link for your function to know if it is the link that should be displayed differently. I was wondering if there is a way to do the same thing without the overhead of all that if statements. --- tedd [EMAIL PROTECTED] wrote: Yes this is the correct way to do things. As i said, i'm using different styles for the menus links indicating the current page. Suppose my page has one horiontal menu at the top and one vertical menu at the left. In this case, one element of the horizontal menu and one from the vertical menu will be displayed differently from the other elements. So the function that will be inluded will be more complex to handle this. I was just wondering, how other poeple are dealing with that. Of course it is feasable, but i want to do it the best way. I hope the problem i posted is clearer now Two menus, do you mean like this: http://webbytedd.com/clients/beckyscan/about-company.php It's still just css and php -- simply a logic problem. 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 Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php