SV: [PHP] URL data decoding problem
> On Tue, 2009-04-21 at 08:39 +0200, Anders Norrbring wrote: > > I'm working on a PayPal IPN module, and PayPal returns a lot of data > in a > > GET call. > > The problem is that international characters entered by a user on the > PayPal > > site gets encoded really weird, and I don't see an obvious way to > decode > > them, can someone please assist? > > My website is running utf-8 all over. > > > > The URL contains this variable: &memo=Pr%EF%BF%BDvar > > It should translate into &memo=Prövar > > > > I've run out of ideas on this really.. PayPal say the reply is > encoded in > > "windows-1252". > > > > Thanks, > > Anders. > > > > > You can use urldecode() to decode the %xx characters to their actual > character. > > > Ash > www.ashleysheridan.co.uk Well, that doesn't work here.. Also, according to docs, all $_GET variables are already urldecoded when they're accessed in the script. Nevertheless, urldecode doesn't give the result I was looking for. I've also tried mb_convert_encoding, html_entity_decode and combinations all over... And I can't see why there are THREE characters in the URL, the original is only one 'ö'. If I simply do a echo urlencode('ö') it shows %C3%B6. Anders. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MAIL Error
Hi All, While using $m=new MAIL; I get an error "Fatal error: Class 'MAIL' not found in...". Can anyone help on this? regards, -ramesh P Save a tree...please don't print this e-mail unless you really need to Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
RE: [PHP] MAIL Error
Isn't mail a function and not a class? Warren > -Original Message- > From: ramesh.marimu...@wipro.com [mailto:ramesh.marimu...@wipro.com] > Sent: Tuesday, April 21, 2009 12:29 AM > To: php-general@lists.php.net > Subject: [PHP] MAIL Error > > Hi All, > > While using $m=new MAIL; I get an error "Fatal error: Class > 'MAIL' not found in...". > > Can anyone help on this? > > regards, > -ramesh > > P Save a tree...please don't print this e-mail unless you > really need to > > > Please do not print this email unless it is absolutely necessary. > > The information contained in this electronic message and any > attachments to this message are intended for the exclusive > use of the addressee(s) and may contain proprietary, > confidential or privileged information. If you are not the > intended recipient, you should not disseminate, distribute or > copy this e-mail. Please notify the sender immediately and > destroy all copies of this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The > recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any > damage caused by any virus transmitted by this email. > > www.wipro.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] MAIL Error
you don't include the mail class? or the include path is incorrect . 2009-04-21 zhoo 发件人: Warren Vail 发送时间: 2009-04-21 15:41:25 收件人: ramesh.marimu...@wipro.com; php-general@lists.php.net 抄送: 主题: RE: [PHP] MAIL Error Isn't mail a function and not a class? Warren > -Original Message- > From: ramesh.marimu...@wipro.com [mailto:ramesh.marimu...@wipro.com] > Sent: Tuesday, April 21, 2009 12:29 AM > To: php-general@lists.php.net > Subject: [PHP] MAIL Error > > Hi All, > > While using $m=new MAIL; I get an error "Fatal error: Class > 'MAIL' not found in...". > > Can anyone help on this? > > regards, > -ramesh > > P Save a tree...please don't print this e-mail unless you > really need to > > > Please do not print this email unless it is absolutely necessary. > > The information contained in this electronic message and any > attachments to this message are intended for the exclusive > use of the addressee(s) and may contain proprietary, > confidential or privileged information. If you are not the > intended recipient, you should not disseminate, distribute or > copy this e-mail. Please notify the sender immediately and > destroy all copies of this message and any attachments. > > WARNING: Computer viruses can be transmitted via email. The > recipient should check this email and any attachments for the > presence of viruses. The company accepts no liability for any > damage caused by any virus transmitted by this email. > > www.wipro.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] self in inherited methods
2009/4/19 Alex S Kurilo aka Kamazee : > Is it right that 'self' in inherited method still points to the parent? > If it is, can you explain it? It makes me worry :) > > A piece of code below for example > > class MyParent { > const NAME = 'MyParent'; > public function get_instance() { > return new self; > } > public function get_another_instance() { > $class_name = get_class($this); > return new $class_name; > } > public function get_name() { > return self::NAME; > } > } > > class MyClass extends MyParent { > const NAME = 'MyClass'; > } > > $a = new MyClass; > $b = $a->get_instance(); > $c = $a->get_another_instance(); > > echo $a->get_name(),"\n"; > echo get_class($b),"\n"; > echo get_class($c),"\n"; > ?> Up until 5.3 this was just the way it was. It has been "fixed" in 5.3. See here for more info: http://php.net/lsb -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
2009/4/20 Nitsan Bin-Nun : > Hi Guys, > > I have created few chats in the past, but I'm trying to create a new one > which saves on HTTP requests and do not become an overkill to the server as > more users get in. > > The chat is a one on one, I'm trying to achieve this: > * A user sends a message > * The message is not saved/save temporarily on the server > * The message is showed to the other user > > Any ideas how i should implement this? > > I have no idea how to build it in the most efficiency way, any notes or > recommendations or > anything that I should pay attention to during development will be very > appreciated. Not sure what you mean by "chats" but is it anything like this... http://pnotes.org/ If so then I'm happy to talk about how I implemented it. Unfortunately I can't release the code because it was developed for a client, but it's pretty simple in concept. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
Hi Stuart, Indeed, in order to create a chat, you need to be able to push messages from the server to the browser. There are several techniques in order to do that. One is the long polling technique (or Reverse Ajax). It requires a lot of Javascript. The other is going through a Flash server. In both cases, it is quite time consuming to implement correctly those, especially for all browsers. I would advice you to use existing libraries or services in order to implement your chat. Here are 2 solutions: You can try Xaja (http://www.thecodingmachine.com/ext/xaja). This is an open-source Reverse Ajax framework. Or you can use Apideo (http://www.apideo.com). This is service including a Javascript library that can be used to send events across browsers. The service is free for non commercial use. Disclaimer: I've been involved in both project, so this is not a definitive list. There might be other projects allowing you to do so. Regards, David. On Tue, 21 Apr 2009 11:57:08 +0100, Stuart wrote: > 2009/4/20 Nitsan Bin-Nun : >> Hi Guys, >> >> I have created few chats in the past, but I'm trying to create a new one >> which saves on HTTP requests and do not become an overkill to the server >> as >> more users get in. >> >> The chat is a one on one, I'm trying to achieve this: >> * A user sends a message >> * The message is not saved/save temporarily on the server >> * The message is showed to the other user >> >> Any ideas how i should implement this? >> >> I have no idea how to build it in the most efficiency way, any notes or >> recommendations or >> anything that I should pay attention to during development will be very >> appreciated. > > Not sure what you mean by "chats" but is it anything like this... > > http://pnotes.org/ > > If so then I'm happy to talk about how I implemented it. Unfortunately > I can't release the code because it was developed for a client, but > it's pretty simple in concept. > > -Stuart > > -- > http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
Please read things more carefully before responding... I was answering the question, not asking it. -Stuart 2009/4/21 David Négrier : > > Hi Stuart, > > Indeed, in order to create a chat, you need to be able to push messages > from the server to the browser. > There are several techniques in order to do that. > One is the long polling technique (or Reverse Ajax). It requires a lot of > Javascript. > The other is going through a Flash server. > > In both cases, it is quite time consuming to implement correctly those, > especially for all browsers. > I would advice you to use existing libraries or services in order to > implement your chat. > > Here are 2 solutions: > > You can try Xaja (http://www.thecodingmachine.com/ext/xaja). This is an > open-source Reverse Ajax framework. > > Or you can use Apideo (http://www.apideo.com). This is service including a > Javascript library that can be used to send events across browsers. The > service is free for non commercial use. > > Disclaimer: I've been involved in both project, so this is not a definitive > list. There might be other projects allowing you to do so. > > Regards, > David. > > > > > On Tue, 21 Apr 2009 11:57:08 +0100, Stuart wrote: >> 2009/4/20 Nitsan Bin-Nun : >>> Hi Guys, >>> >>> I have created few chats in the past, but I'm trying to create a new one >>> which saves on HTTP requests and do not become an overkill to the server >>> as >>> more users get in. >>> >>> The chat is a one on one, I'm trying to achieve this: >>> * A user sends a message >>> * The message is not saved/save temporarily on the server >>> * The message is showed to the other user >>> >>> Any ideas how i should implement this? >>> >>> I have no idea how to build it in the most efficiency way, any notes or >>> recommendations or >>> anything that I should pay attention to during development will be very >>> appreciated. >> >> Not sure what you mean by "chats" but is it anything like this... >> >> http://pnotes.org/ >> >> If so then I'm happy to talk about how I implemented it. Unfortunately >> I can't release the code because it was developed for a client, but >> it's pretty simple in concept. >> >> -Stuart >> >> -- >> http://stut.net/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems with gnupg extension.
On 20 Apr 2009 at 11:37, Ray wrote: > Any suggestions, Anyone? > Ray Hi, I adapted these scripts for my own user and have not had any problems: http://www.theoslogic.com/scripts/php-gpg/ It does not use the gnupg extension at all but popen() or proc_open(). Regards Ian -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL, MD5 and SHA1
provided I want to store hash of a password in MySQL ... Using MySQL, the whole check can be achieved with a SQL query, since the MD5 function is provided as part of the database query language ... Can I use also SHA1 or must I use MD5? Thanks in advance, -- When the sun rises I receive and when it sets I forgive -> http://users.skavt.net/~gleskovs/ All the Love, Grega Leskov'sek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL, MD5 and SHA1
Grega Leskovsek wrote: > provided I want to store hash of a password in MySQL ... Using MySQL, > the whole check can be achieved with a SQL query, since the MD5 > function is provided as part of the database query language ... > Can I use also SHA1 or must I use MD5? > You could have just checked the mysql manual? But yes, there is also a SHA1 function. /Per -- Per Jessen, Zürich (19.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encrypting email
I have been asked by a product manager what our options are for encrypting email messages with sensitive information. We are currently using PHPMailer to send email. What can be done to encrypt those messages? Can it be done without OOP? Server configuration: RHEL 5 Apache 2.0 PHP 5.2.3 PHPMailer 1.73 Thank you, Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encrypting email
Bob McConnell wrote: > I have been asked by a product manager what our options are for > encrypting email messages with sensitive information. We are currently > using PHPMailer to send email. What can be done to encrypt those > messages? Can it be done without OOP? > Yes, that's no problem. Look up "openssl smime -encrypt" /Per -- Per Jessen, Zürich (19.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MAIL Error
On Tue, Apr 21, 2009 at 03:28, wrote: > Hi All, > > While using $m=new MAIL; I get an error "Fatal error: Class 'MAIL' not > found in...". > > Can anyone help on this? Maybe if you provided the relevant code and not just a single variable instantiation. Also, per the rules of the list (not to mention the RFC's on "Netiquette," et al), please trim your signature when posting to the official PHP mailing lists. There's probably no reason it even needs to be 450% the size of your email body. ;-P -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encrypting email
At 8:39 AM -0400 4/21/09, Bob McConnell wrote: I have been asked by a product manager what our options are for encrypting email messages with sensitive information. We are currently using PHPMailer to send email. What can be done to encrypt those messages? Can it be done without OOP? Server configuration: RHEL 5 Apache 2.0 PHP 5.2.3 PHPMailer 1.73 Thank you, From within a php script, it's not a problem to encrypt a text string and send it as email. The sending of the email and the encrypting the contents are two different issues. You may want to look at it that way. 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] MAIL Error
At 12:58 PM +0530 4/21/09, wrote: P Save a tree...please don't print this e-mail unless you really need to Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com ramesh: Could you trim your signature a bit? What's this "Save a tree" nonsense??? The paper industry plants more trees than it uses but this is not a topic for the PHP list. How about saving bandwidth or saving us the time to review the same long-ass signature over and over that tells us nothing but what everyone already knows AND does absolutely nothing to protect the company you work for. It's just a excessive length of garbage and misinformation that tells everyone your company is totally clueless about list etiquette. 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] Encrypting email
From: tedd > At 8:39 AM -0400 4/21/09, Bob McConnell wrote: >>I have been asked by a product manager what our options are for >>encrypting email messages with sensitive information. We are currently >>using PHPMailer to send email. What can be done to encrypt those >>messages? Can it be done without OOP? > > From within a php script, it's not a problem to encrypt a text string > and send it as email. The sending of the email and the encrypting the > contents are two different issues. You may want to look at it that > way. But can it be done so the recipient's email client will automatically open and decrypt the message? How do you make it as seamless as possible for them, preferably so they don't even realize the message was encrypted? Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Encrypting email
At 9:49 AM -0400 4/21/09, Bob McConnell wrote: From: tedd At 8:39 AM -0400 4/21/09, Bob McConnell wrote: I have been asked by a product manager what our options are for encrypting email messages with sensitive information. We are currently using PHPMailer to send email. What can be done to encrypt those messages? Can it be done without OOP? From within a php script, it's not a problem to encrypt a text string and send it as email. The sending of the email and the encrypting the contents are two different issues. You may want to look at it that way. But can it be done so the recipient's email client will automatically open and decrypt the message? How do you make it as seamless as possible for them, preferably so they don't even realize the message was encrypted? Bob McConnell Bob: At some point both parties (sender/receiver) must know (agree) what the encrypting mechanism is. If I was writing a script to do this for a client, I must have control over both the send and receive scripts and then I could deliver the email to the client seamlessly. They would never know what happened in the background. However, if your client wants to send stuff to anyone and have it encrypted without knowing who the receiver is going to be, then there is no way to do this. Both the sender and receiver must agree on the encrypting mechanism either by providing passwords OR by you having access to both the sending and receiving scripts. As I see it, there is no other way. 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] Check whether a page is Google Cached
Hi, everyone, I want to write a small PHP script test.php that can determine whether a webpage is Google Cached. Assuming it is uploaded to www.mysite.com, and I want to use it to check whether www.yoursite.com is google cached. It works as follows: The user input the query: http://www.mysite.com/test.php?site=www.yoursite.com The php script will send the following request to the browser http://www.google.com/search?q=cache:www.yoursite.com in the background. And if the returned result contains a string "This is Google's cache of", then the page is cached, so the php script can display "Your site is cached by Google" otherwise, it will say "Your site is not cached by Google" Just wonder how to implement such a feature, can anyone write a simple sample so that I can use as a startpoint as I am a totally new guy in PHP coding Thanks to all of you so much Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
At 11:57 AM +0100 4/21/09, Stuart wrote: Not sure what you mean by "chats" but is it anything like this... http://pnotes.org/ If so then I'm happy to talk about how I implemented it. Unfortunately I can't release the code because it was developed for a client, but it's pretty simple in concept. -Stuart -Stuart: This is just a form that takes in comments, filters them, puts them into a db and then displays today's comments when users visits? That's about it, isn't it? 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] Encrypting email
On Tue, Apr 21, 2009 at 10:14 AM, tedd wrote: > At 9:49 AM -0400 4/21/09, Bob McConnell wrote: > >> From: tedd >> >>> At 8:39 AM -0400 4/21/09, Bob McConnell wrote: >>> I have been asked by a product manager what our options are for encrypting email messages with sensitive information. We are currently using PHPMailer to send email. What can be done to encrypt those messages? Can it be done without OOP? >>> >>> From within a php script, it's not a problem to encrypt a text string >>> >> >> and send it as email. The sending of the email and the encrypting the >>> contents are two different issues. You may want to look at it that >>> way. >>> >> >> But can it be done so the recipient's email client will automatically >> open and decrypt the message? How do you make it as seamless as possible >> for them, preferably so they don't even realize the message was >> encrypted? >> >> Bob McConnell >> > > Bob: > > At some point both parties (sender/receiver) must know (agree) what the > encrypting mechanism is. > > If I was writing a script to do this for a client, I must have control over > both the send and receive scripts and then I could deliver the email to the > client seamlessly. They would never know what happened in the background. > > However, if your client wants to send stuff to anyone and have it encrypted > without knowing who the receiver is going to be, then there is no way to do > this. Both the sender and receiver must agree on the encrypting mechanism > either by providing passwords OR by you having access to both the sending > and receiving scripts. As I see it, there is no other way. > > 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 > > A number of our clients are moving towards secure webmail delivery and the mechanism is as Tedd describes. The only other option, if your clients are all on Outlook, is to use something like GPG for outlook to encrypt the transmission ( http://www.gpg4win.org/index.html ). -- Bastien Cat, the other other white meat
Re: [PHP] Let me google that for you.
On Fri, Apr 17, 2009 at 1:01 PM, 9el wrote: > If you play with jQuery its easy. > > And if you talk about JavaScript's urlencode functionality you wont ask > about 'how to remove the + sign' > > I'm not very good yet on jQuery or else I would have shown you the codes. jQuery doesn't make this much easier than vanilla Javascript in this case. I don't see why JS is necessary at all, in fact. search.html === Search http://lmgtfy.com"; method="get"> No URLEncoding necessary, no JS, no PHP... just HTML. Were you to pass pre-conceived search strings to it, it's as easy as this: index.php === http://lmgtfy.com?q=' . urlencode($s)); ?> And you're done! HTH, -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
On Tue, Apr 21, 2009 at 10:20 AM, tedd wrote: > At 11:57 AM +0100 4/21/09, Stuart wrote: > >> Not sure what you mean by "chats" but is it anything like this... >> >>http://pnotes.org/ >> >> If so then I'm happy to talk about how I implemented it. Unfortunately >> I can't release the code because it was developed for a client, but >> it's pretty simple in concept. >> >> -Stuart >> > > -Stuart: > > This is just a form that takes in comments, filters them, puts them into a > db and then displays today's comments when users visits? > > That's about it, isn't it? > > 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 > > It seemed pretty realtime when Stuart and I were exchanging comments this morning. -- Bastien Cat, the other other white meat
Re: [PHP] Creating A Chat?
2009/4/21 tedd : > At 11:57 AM +0100 4/21/09, Stuart wrote: >> >> Not sure what you mean by "chats" but is it anything like this... >> >> http://pnotes.org/ >> >> If so then I'm happy to talk about how I implemented it. Unfortunately >> I can't release the code because it was developed for a client, but >> it's pretty simple in concept. >> >> -Stuart > > -Stuart: > > This is just a form that takes in comments, filters them, puts them into a > db and then displays today's comments when users visits? > > That's about it, isn't it? You know me better than that ;-) It's a live chat system with no flash in sight. No DB either, the whole thing is stored in Memcached. When you post a message it should take no longer than a second to get to all other people present. On the server-side it has a tiny footprint of less than 2MB per 20 concurrent users. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL, MD5 and SHA1
On Tue, Apr 21, 2009 at 8:34 AM, Grega Leskovsek wrote: > provided I want to store hash of a password in MySQL ... Using MySQL, > the whole check can be achieved with a SQL query, since the MD5 > function is provided as part of the database query language ... > Can I use also SHA1 or must I use MD5? > > Thanks in advance, > > -- > When the sun rises I receive and when it sets I forgive -> > http://users.skavt.net/~gleskovs/ > All the Love, Grega Leskov'sek > I would encode the value in PHP and pass the hash to MySQL rather than passing the password in open text as part of the query and letting MySQL calculate the hash. That way the sensitive data has already been hashed and you don't have to worry about whether the communication between PHP and MySQL travels over an unencrypted network connection -- now or in the future. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Check whether a page is Google Cached
Alan Chen wrote: > Hi, everyone, > > I want to write a small PHP script test.php that can determine whether a > webpage is Google Cached. > > Assuming it is uploaded to www.mysite.com, and I want to use it to check > whether www.yoursite.com is google cached. > > It works as follows: > > The user input the query: > > http://www.mysite.com/test.php?site=www.yoursite.com > > The php script will send the following request to the browser > > http://www.google.com/search?q=cache:www.yoursite.com > > in the background. > > And if the returned result contains a string "This is Google's cache of", > then the page is cached, so the php script can display > > "Your site is cached by Google" > > otherwise, it will say > > "Your site is not cached by Google" > > Just wonder how to implement such a feature, can anyone write a simple > sample so that I can use as a startpoint as I am a totally new guy in PHP > coding > > Thanks to all of you so much > > Alan > > Assuming fopen wrappers are enabled, something like: $site = $_GET['site']; $cache = file_get_contents('http://www.google.com/search?q=cache:' . $site); if (strpos($cache, 'This is Google's cache of') !== false) { echo 'Your site is cached by Google'; } else { echo 'Nope'; } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check whether a page is Google Cached
On Tue, Apr 21, 2009 at 8:29 AM, Alan Chen wrote: > Hi, everyone, > > I want to write a small PHP script test.php that can determine whether a > webpage is Google Cached. > > Assuming it is uploaded to www.mysite.com, and I want to use it to check > whether www.yoursite.com is google cached. > > It works as follows: > > The user input the query: > > http://www.mysite.com/test.php?site=www.yoursite.com > > The php script will send the following request to the browser > > http://www.google.com/search?q=cache:www.yoursite.com > > in the background. > > And if the returned result contains a string "This is Google's cache of", > then the page is cached, so the php script can display > > "Your site is cached by Google" > > otherwise, it will say > > "Your site is not cached by Google" > > Just wonder how to implement such a feature, can anyone write a simple > sample so that I can use as a startpoint as I am a totally new guy in PHP > coding You've already laid out most of what needs to be done. I think the file_get_contents() function will be your best friend here, provided allow_url_fopen has been set to TRUE in your PHP configuration. Take the result you get back from that function and parse the 2nd line for ">This is Google's cache of <" (I have made this assumption by looking at the source of http://www.google.com/search?q=cache:www.php.net). example.php === http://www.google.com/search?q=cache:' . $url); if($res && strstr('>This is Google's cache of <', $res)) echo 'Your page is cached.'; else echo 'Your page is not cached.'; ?> UNTESTED. Hope this helps. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
At 3:27 PM +0100 4/21/09, Stuart wrote: 2009/4/21 tedd : > That's about it, isn't it? You know me better than that ;-) It's a live chat system with no flash in sight. No DB either, the whole thing is stored in Memcached. When you post a message it should take no longer than a second to get to all other people present. On the server-side it has a tiny footprint of less than 2MB per 20 concurrent users. -Stuart -Stuart: Yeah, I figured that you would complicate matters considerably. ;-) And there you go again talking about stuff I'm clueless about. Okay, so we all can agree it's a form, right? And visitors can enter stuff, right? So what happens then? Please give me an outline of what happens and use short words. 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] Encrypting email
From: tedd [mailto:tedd.sperl...@gmail.com] > At 9:49 AM -0400 4/21/09, Bob McConnell wrote: > >From: tedd > >> At 8:39 AM -0400 4/21/09, Bob McConnell wrote: > >>>I have been asked by a product manager what our options are for > >>>encrypting email messages with sensitive information. We are currently > >>>using PHPMailer to send email. What can be done to encrypt those > >>>messages? Can it be done without OOP? > >> > >> From within a php script, it's not a problem to encrypt a text string > > > >> and send it as email. The sending of the email and the encrypting the > >> contents are two different issues. You may want to look at it that > >> way. > > > >But can it be done so the recipient's email client will automatically > >open and decrypt the message? How do you make it as seamless as possible > >for them, preferably so they don't even realize the message was > >encrypted? > > At some point both parties (sender/receiver) must know (agree) what > the encrypting mechanism is. > > If I was writing a script to do this for a client, I must have > control over both the send and receive scripts and then I could > deliver the email to the client seamlessly. They would never know > what happened in the background. > > However, if your client wants to send stuff to anyone and have it > encrypted without knowing who the receiver is going to be, then there > is no way to do this. Both the sender and receiver must agree on the > encrypting mechanism either by providing passwords OR by you having > access to both the sending and receiving scripts. As I see it, there > is no other way. These will be targeted emails for selected recipients, primarily in the Security and Public Safety offices. But they will be sent via public mail servers, so the content must be protected. Knowing the first site where this would go for field trials, I suspect most recipients are using some version of Microsoft Outlook. But other sites down the road are likely to have different clients. That end is completely outside of my control or influence. All I can do is recommend packages for them to download and install. I already know I need to get a public key from each recipient before I can encrypt their messages, but that's as far as I have gotten. I did glance at the GPG site earlier, and it appears they only support the version of Outlook in Office 2003. I have a feeling this is going to get messy, at least on the deployment end. Thanks for the pointers, Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
2009/4/21 tedd : > At 3:27 PM +0100 4/21/09, Stuart wrote: >> >> 2009/4/21 tedd : >> > That's about it, isn't it? >> >> You know me better than that ;-) >> >> It's a live chat system with no flash in sight. No DB either, the >> whole thing is stored in Memcached. >> >> When you post a message it should take no longer than a second to get >> to all other people present. On the server-side it has a tiny >> footprint of less than 2MB per 20 concurrent users. >> >> -Stuart > > -Stuart: > > Yeah, I figured that you would complicate matters considerably. ;-) > > And there you go again talking about stuff I'm clueless about. > > Okay, so we all can agree it's a form, right? > > And visitors can enter stuff, right? > > So what happens then? Please give me an outline of what happens and use > short words. I've asked the client if I can write a blog post with details of the implementation so I'm hesitant to say too much until I get a response from him (he's presenting in front of a pretty large crowd in London at the moment, don't think he'll get back to me until later today). Essentially it's a very lightweight and extremely simple implementation of Comet[1], the result of which is near-realtime communication from server to client. I should note that chat is not the use case for which it was created, but pnotes.org was the simplest chat implementation I could come up with for testing purposes. I've since had several ideas around how I might develop it further along these lines, but spare time is currently in short supply. -Stuart [1] http://en.wikipedia.org/wiki/Comet_(programming) -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encrypting email
On Tue, Apr 21, 2009 at 9:43 AM, Bob McConnell wrote: > From: tedd [mailto:tedd.sperl...@gmail.com] >> At 9:49 AM -0400 4/21/09, Bob McConnell wrote: >> >From: tedd >> >> At 8:39 AM -0400 4/21/09, Bob McConnell wrote: >> >>>I have been asked by a product manager what our options are for >> >>>encrypting email messages with sensitive information. We are > currently >> >>>using PHPMailer to send email. What can be done to encrypt those >> >>>messages? Can it be done without OOP? >> >> >> >> From within a php script, it's not a problem to encrypt a text > string >> > >> >> and send it as email. The sending of the email and the encrypting > the >> >> contents are two different issues. You may want to look at it that >> >> way. >> > >> >But can it be done so the recipient's email client will automatically >> >open and decrypt the message? How do you make it as seamless as > possible >> >for them, preferably so they don't even realize the message was >> >encrypted? >> >> At some point both parties (sender/receiver) must know (agree) what >> the encrypting mechanism is. >> >> If I was writing a script to do this for a client, I must have >> control over both the send and receive scripts and then I could >> deliver the email to the client seamlessly. They would never know >> what happened in the background. >> >> However, if your client wants to send stuff to anyone and have it >> encrypted without knowing who the receiver is going to be, then there >> is no way to do this. Both the sender and receiver must agree on the >> encrypting mechanism either by providing passwords OR by you having >> access to both the sending and receiving scripts. As I see it, there >> is no other way. > > These will be targeted emails for selected recipients, primarily in the > Security and Public Safety offices. But they will be sent via public > mail servers, so the content must be protected. > > Knowing the first site where this would go for field trials, I suspect > most recipients are using some version of Microsoft Outlook. But other > sites down the road are likely to have different clients. That end is > completely outside of my control or influence. All I can do is recommend > packages for them to download and install. I already know I need to get > a public key from each recipient before I can encrypt their messages, > but that's as far as I have gotten. I did glance at the GPG site > earlier, and it appears they only support the version of Outlook in > Office 2003. > > I have a feeling this is going to get messy, at least on the deployment > end. This may alleviate some of the mess: http://blog.cumps.be/gpg-in-outlook-2007-outlookgnupg/ -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
Here is a quick explanation of what is going on behind the scene: When a client loads the HTML page, a Javascript function is triggered. This function performs an Ajax call to the server. In the case of Stuart, I think he wrote a small fastCgi script that does trap this call (instead of forwarding the call to PHP I Guess). The server does not respond directly. Instead, it does not respond directly, but it keeps the connection to the browser open. When someone else types something in the form, an Ajax call is performed to the server. The fastcgi script receives this message, and sends the message on all the open connections. This technique is known as "Comet". You can find a more detailed explanation here: http://meteorserver.org/interaction-modes/ If you want to do the same, there are several options: 1- You do it yourself, like Stuart did. Believe me, this is painful, especially when you want compatibility with old browsers like IE 6, since this involves a lot of Javascript 2- You use a Javascript framework + a light server: Orbited (http://orbited.org) and Meteor-server (http://meteorserver.org) can help you do such a thing. You can also google for the "Bayeux" protocol that is a standardised implementation of Comet. I think Dojo (http://www.dojotoolkit.org) implements it (not sure though) 3- You use a server side framework that will write Javascript for you. There are several such frameworks in Java. In PHP, the only one I am aware of is Xaja (http://www.thecodingmachine.com/ext/xaja) 4- You decide to use Flash instead, or a framework that use Flash underneath (http://www.apideo.com) 5- You wait for HTML 5 that might, someday (2012?), provide a direct way to do this ;) Regards, David. On Tue, 21 Apr 2009 10:42:54 -0400, tedd wrote: > At 3:27 PM +0100 4/21/09, Stuart wrote: >>2009/4/21 tedd : >> > That's about it, isn't it? >> >>You know me better than that ;-) >> >>It's a live chat system with no flash in sight. No DB either, the >>whole thing is stored in Memcached. >> >>When you post a message it should take no longer than a second to get >>to all other people present. On the server-side it has a tiny >>footprint of less than 2MB per 20 concurrent users. >> >>-Stuart > > -Stuart: > > Yeah, I figured that you would complicate matters considerably. ;-) > > And there you go again talking about stuff I'm clueless about. > > Okay, so we all can agree it's a form, right? > > And visitors can enter stuff, right? > > So what happens then? Please give me an outline of what happens and > use short words. > > 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] Encrypting email
Bob McConnell wrote: > From: tedd >> At 8:39 AM -0400 4/21/09, Bob McConnell wrote: >>>I have been asked by a product manager what our options are for >>>encrypting email messages with sensitive information. We are >>>currently using PHPMailer to send email. What can be done to encrypt >>>those messages? Can it be done without OOP? >> >> From within a php script, it's not a problem to encrypt a text >> string > >> and send it as email. The sending of the email and the encrypting the >> contents are two different issues. You may want to look at it that >> way. > > But can it be done so the recipient's email client will automatically > open and decrypt the message? How do you make it as seamless as > possible for them, preferably so they don't even realize the message > was encrypted? See S/MIME. /Per -- Per Jessen, Zürich (20.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Encrypting email
tedd wrote: > However, if your client wants to send stuff to anyone and have it > encrypted without knowing who the receiver is going to be, then there > is no way to do this. As long as the intended receiver has the appropriate key to decrypt the email, the client does not need to know the intended receiver as such. > Both the sender and receiver must agree on the encrypting mechanism S/MIME. /Per -- Per Jessen, Zürich (20.5°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
At 5:14 PM +0200 4/21/09, David Négrier wrote: Here is a quick explanation of what is going on behind the scene: -snip- Regards, David. Thanks -- I think I know what's going on. I've done sufficient ajax to know what's going on. However, what I don't understand is: 1. Detecting who is currently online (i.e., all who are connected to THE server); 2. And then how to send all of them stuff. For example, if you have four people connected to the server at the same time and one sends something, then how do you forward that to each person so that their screen refreshes accordingly? 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] Creating A Chat?
2009/4/21 David Négrier : > > Here is a quick explanation of what is going on behind the scene: > > When a client loads the HTML page, a Javascript function is triggered. This > function performs an Ajax call to the server. In the case of Stuart, I > think he wrote a small fastCgi script that does trap this call (instead of > forwarding the call to PHP I Guess). > The server does not respond directly. Instead, it does not respond > directly, but it keeps the connection to the browser open. > > When someone else types something in the form, an Ajax call is performed to > the server. The fastcgi script receives this message, and sends the message > on all the open connections. > > This technique is known as "Comet". > > You can find a more detailed explanation here: > > http://meteorserver.org/interaction-modes/ The plumbing on the server-side of pnotes.org does not work like that, but that is the way the client <-> server comms works. > If you want to do the same, there are several options: > 1- You do it yourself, like Stuart did. Believe me, this is painful, > especially when you want compatibility with old browsers like IE 6, since > this > involves a lot of Javascript I beg to differ. pnotes.org uses jQuery to handle the AJAX stuff and it works quite happily on IE6. > 2- You use a Javascript framework + a light server: Orbited > (http://orbited.org) and Meteor-server (http://meteorserver.org) can help > you do such a thing. You can also google for the "Bayeux" protocol that is > a > standardised implementation of Comet. I think Dojo > (http://www.dojotoolkit.org) implements it (not sure though) > 3- You use a server side framework that will write Javascript for you. > There are several such frameworks in Java. In PHP, the only one I am aware > of is Xaja (http://www.thecodingmachine.com/ext/xaja) > 4- You decide to use Flash instead, or a framework that use Flash > underneath (http://www.apideo.com) > 5- You wait for HTML 5 that might, someday (2012?), provide a direct way to > do this ;) The reason I developed my own server-side FastCGI process is scalability. Most solutions I've seen so far are pretty heavy-weight server-side, whereas for a lot of applications it's far more than is necessary. The lightweight options out there, orbited included, usually rely on some kind of runtime (python in the case of orbited) which gives them a fairly large footprint per connected user. In the interests of scalability the server-side of pnotes.org is tiny and in using FastCGI it can hang off any web server that supports it. I wouldn't recommend Apache but both lighttpd and nginx work very well. As a consequence of that goal it's pretty limited in what it can do, but was designed in such a way that a fair number of use cases can be implemented. -Stuart > On Tue, 21 Apr 2009 10:42:54 -0400, tedd wrote: >> At 3:27 PM +0100 4/21/09, Stuart wrote: >>>2009/4/21 tedd : >>> > That's about it, isn't it? >>> >>>You know me better than that ;-) >>> >>>It's a live chat system with no flash in sight. No DB either, the >>>whole thing is stored in Memcached. >>> >>>When you post a message it should take no longer than a second to get >>>to all other people present. On the server-side it has a tiny >>>footprint of less than 2MB per 20 concurrent users. >>> >>>-Stuart >> >> -Stuart: >> >> Yeah, I figured that you would complicate matters considerably. ;-) >> >> And there you go again talking about stuff I'm clueless about. >> >> Okay, so we all can agree it's a form, right? >> >> And visitors can enter stuff, right? >> >> So what happens then? Please give me an outline of what happens and >> use short words. >> >> 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
Re: [PHP] Creating A Chat?
Hi Tedd, This is where there is a need for some "magic". In the case of Stuart, he wrote a "fastcgi" script. Basiacally, this handles the Ajax calls. Each call uses "long polling": the server is not responding directly. Instead, it keeps the connection open to the fast-cgi script. In order to know how many users are online, you just have to count how many connections are open to the fastcgi script. Then, since the connections are open, still waiting for a reply, the fastcgi script just forwards the message it receives on all open connections. This message is parsed by the Javascript script on the client side, and the Javascript script on the client side adds the message on the screen. There are other ways to do this. I've been doing this in a pure PHP way with Xaja (without the need of using fastcgi, with just PHP and Apache). There is an explanation going on here: http://www.thecodingmachine.com/ext/xaja/doc/about/architecture.html Maybe it will make things more clear. Regards, David. On Tue, 21 Apr 2009 12:10:48 -0400, tedd wrote: > At 5:14 PM +0200 4/21/09, David Négrier wrote: >>Here is a quick explanation of what is going on behind the scene: >> >>-snip- >> >>Regards, >>David. > > Thanks -- I think I know what's going on. I've > done sufficient ajax to know what's going on. > However, what I don't understand is: > > 1. Detecting who is currently online (i.e., all > who are connected to THE server); > > 2. And then how to send all of them stuff. > > For example, if you have four people connected to > the server at the same time and one sends > something, then how do you forward that to each > person so that their screen refreshes accordingly? > > Cheers, > > tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] error with hosting
I have a littli application in PHP that I do with appserv, in my local server work ok but when I upload de page.php to the hosting server don't work, the hosting say in your page that support php and the web server is apache because the directory is httpdocs, and why my page dond;t work in the hosting and work ok in my local server ?? //before I have a html form Your Company Name: Your E-Mail Address: Find by Zip Code: // I try with this application in find.php Enter your Company Name."; } elseif (!ereg("^[a-za-z0-9_\...@[a-za-z0-9\-]+\.[a-za-z0-9\-\.]+$", $email)) { echo "Enter a Valid E-Mail Address."; } elseif (strlen($zip)<5) { echo "Enter a Valid Zip Code."; } elseif (ereg("[^0-9]", $zip)) { echo "Enter a Valid Zip Code."; } else { echo "Find an Agent close to you."; } ?> Thanks to all. -- salu2 ®0L¥
Re: [PHP] Creating A Chat?
2009/4/21 tedd : > At 5:14 PM +0200 4/21/09, David Négrier wrote: >> >> Here is a quick explanation of what is going on behind the scene: >> >> -snip- >> >> Regards, >> David. > > Thanks -- I think I know what's going on. I've done sufficient ajax to know > what's going on. However, what I don't understand is: > > 1. Detecting who is currently online (i.e., all who are connected to THE > server); > > 2. And then how to send all of them stuff. > > For example, if you have four people connected to the server at the same > time and one sends something, then how do you forward that to each person so > that their screen refreshes accordingly? There are a number of ways to approach this. In essence all Comet does is move that problem from the client to the server which opens up a whole cupboard full of options. The "best" options is probably something like pub-sub in XMPP. In this scenario each connected user "subscribes" to another end point within the XMPP network, which basically means it will receive any messages that end point sends. The end point in the case of chat would be a central phantom user who in turn subscribes to everyone else. Beyond that you have traditional polling of some resource (database, files, etc) or any other mechanism for finding new stuff to send to the client. The client makes the AJAX request and the server holds on to it doing nothing for up to n seconds (in phones case it's 55 seconds). If nothing has been received by then it simply returns an empty response. When something does arrive to be sent the server sends the response and the connection closes. The client then deals with the data it's just received and then starts another connection. Hence the name, long polling. I've had a response from my client and he's happy to open source the whole thing but it needs a bit of work before it's ready for that so it may be a little while before I have something, but I'll be sure to post a link here and on my blog when it's released. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
2009/4/21 David Négrier : > There are other ways to do this. I've been doing this in a pure PHP way > with Xaja (without the need of using fastcgi, with just PHP and Apache). > There is an explanation going on here: > http://www.thecodingmachine.com/ext/xaja/doc/about/architecture.html > Maybe it will make things more clear. Apache has a very big footprint per user, especially when it's using mod_php, so I'd guess you're pretty limited in terms of concurrent connections. The actual use case for the pnotes.org code is expecting several thousand concurrent connections at peak, potentially more. Xaja looks interesting tho, will be looking further into that. Thanks. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Let me google that for you.
Thanks so much for your reply and your help. I had recieved the same advice and solution from stuart just this morning. So thank you very much to both! Gary "haliphax" wrote in message news:952625160904210725j5aa0d50bvbc258d1103357...@mail.gmail.com... > On Fri, Apr 17, 2009 at 1:01 PM, 9el wrote: >> If you play with jQuery its easy. >> >> And if you talk about JavaScript's urlencode functionality you wont ask >> about 'how to remove the + sign' >> >> I'm not very good yet on jQuery or else I would have shown you the codes. > > jQuery doesn't make this much easier than vanilla Javascript in this > case. I don't see why JS is necessary at all, in fact. > > search.html > === > > Search > > http://lmgtfy.com"; method="get"> > > > > > > > > No URLEncoding necessary, no JS, no PHP... just HTML. Were you to pass > pre-conceived search strings to it, it's as easy as this: > > index.php > === > $s = 'search for this'; > header('Location: http://lmgtfy.com?q=' . urlencode($s)); > ?> > > > And you're done! > > HTH, > > -- > // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
Yes, indeed, the Apache footprint is quite large. Furthermore, with Xaja design, I'm starting 2 processes per connected user. Basically, it requires about 10Mo / user, so the footprint is really bigger than what you are having with pnotes. Currently, it scales quite well up to 100 users (I've never been testing further). The whole interest with Xaja in my opinion is that you can do some Reverse Ajax and Comet stuff without writing a single line of Javascript. And since it uses only Apache and PHP, it's cross-platform. I'll keep an eye on pnotes too, if you plan to keep evolving it. There is only a demo on the web site right now. Do you plan to release it some day? David. On Tue, 21 Apr 2009 17:25:29 +0100, Stuart wrote: > 2009/4/21 David Négrier : >> There are other ways to do this. I've been doing this in a pure PHP way >> with Xaja (without the need of using fastcgi, with just PHP and Apache). >> There is an explanation going on here: >> http://www.thecodingmachine.com/ext/xaja/doc/about/architecture.html >> Maybe it will make things more clear. > > Apache has a very big footprint per user, especially when it's using > mod_php, so I'd guess you're pretty limited in terms of concurrent > connections. The actual use case for the pnotes.org code is expecting > several thousand concurrent connections at peak, potentially more. > > Xaja looks interesting tho, will be looking further into that. Thanks. > > -Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating A Chat?
2009/4/21 David Négrier : > I'll keep an eye on pnotes too, if you plan to keep evolving it. There is > only a demo on the web site right now. Do you plan to release it some day? Yes. Hopefully in the near future, but don't hold your breath. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: error with hosting
®0L¥ wrote: > I have a littli application in PHP that I do with appserv, in my local > server work ok but when I upload de page.php to the hosting server don't > work, the hosting say in your page that support php and the web server is > apache because the directory is httpdocs, and why my page dond;t work in the > hosting and work ok in my local server ?? > > > //before I have a html form > > > > style="text-align: left"> cellpadding="0"> > > class="text_1"> > Your Company > Name: > type="text" size="11" maxlength="20" align="right"> > > > > > border="0" cellspacing="0" cellpadding="0"> > > class="text_1"> > Your E-Mail > Address: > type="text" size="11" maxlength="40" align="right"> > > > > > border="0" cellspacing="0" cellpadding="0"> > > Find by > Zip Code: > size="9" maxlength="5" align="right"> > > >cellpadding="0"> > > > >src="images/find.jpg" width="33" height="20"> > > > > > > > // I try with this application in find.php > > > if (!$cname) > { > echo "Enter your Company > Name."; > } > elseif > (!ereg("^[a-za-z0-9_\...@[a-za-z0-9\-]+\.[a-za-z0-9\-\.]+$", $email)) > { > echo "Enter a Valid E-Mail > Address."; > } > elseif (strlen($zip)<5) > { > echo "Enter a Valid Zip > Code."; > } > elseif (ereg("[^0-9]", $zip)) > { > echo "Enter a Valid Zip > Code."; > } > else > { > echo "Find an Agent close to > you."; > } > ?> > > Thanks to all. > Your code is relying on register_globals which is bad and seems to be enabled on your local server but not on your hosting server. Use the $_POST superglobal array: if (!$_POST['cname']) //etc... -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] self in inherited methods
Is it right that 'self' in inherited method still points to the parent? If it is, can you explain it? It makes me worry :) Up until 5.3 this was just the way it was. It has been "fixed" in 5.3. See here for more info: http://php.net/lsb Thanks. It seems that 'static' keyword (instead of 'self') is the thing I actually need. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] escape your variables
2009/4/21 Chris : > How does one deal with that? Do you use mysql_real_escape_string? e.g. >>> $db_host = 'localhost'; $db_user = 'auser'; $db_pwd = 'apassword'; $database = 'adatabase'; $table = 'authorBook'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT * FROM {$table}"); >>> >>> Inputs are user supplied. >> >> Are you saying that I don't need to sanitize the variables above - >> $db_host, $db_user, $db_pwd, $database, $table ? > > No - they are essentially hardcoded. > > A user (through a form or any other method) cannot change which db you are > talking to. They cannot change the hostname either. > > If a variable comes from: > - a post variable > - a get variable > - a session variable > - a cookie > - an environment variable > > then it will need to be escaped & sanitized. > > If you are putting the variable at the top of the script and there's no way > for a user to change it, then no need to sanitize. > >> I would love to see an example somewhere that shows an unsanitized >> variable and the same variable sanitized. > > "Sanitizing" depends on what you need. > > An age field doesn't need anything except a number. > A name field should accept everything except html tags. > > They are going to be sanitized differently. > > $name = $_POST['name']; <-- unsanitized > $name = strip_tags($name); <-- sanitized. > Sorry to disturb, but you should never assume a string is sanitized when you've applied the function "strip_tags". That function *only* removes complete HTML-Markup. It *ignores* invalid HTML, unlike 99% of the browsers do. So, a site using strip_tags only to sanatize user_input is vulnerable to XSS! The second thing I'd like to mention is that you're mixing DB-escaping and output escaping for the browser, but both require different escaping. > A name field should accept everything except html tags. What the hell? Don't believe charsets only include [-a-Z0-9']. You might want to remove conrol characters as well as some other, printable characters. Or have you ever known a person called * 1234? * )("/)(%("%"&)()($#432+4 * ' OR 1=1/* * and so on. Greetings >> = >> Better: >> myql_query("INSERT INTO foo (`name`) VALUES ('". >> mysql_real_escape_string($name, $link) ."')"); >> >> This is better because we escape it in the sql statement itself. >> $name remains unchanged in case we want to use it later. >> >> Best: >> Use prepared statements! >> = >> What is meant by prepared stetements? Does that mean not using variables? > > It's a different way of putting the query together. Data can only mean one > thing - data. There's no escaping, the db will always know what it's going > to do. > > http://www.php.net/manual/en/pdo.prepare.php > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error with hosting
2009/4/21 ®0L¥ : > I have a littli application in PHP that I do with appserv, in my local > server work ok but when I upload de page.php to the hosting server don't > work, the hosting say in your page that support php and the web server is > apache because the directory is httpdocs, and why my page dond;t work in the > hosting and work ok in my local server ?? > > > //before I have a html form > > > > style="text-align: left"> cellpadding="0"> > > class="text_1"> > Your Company > Name: > type="text" size="11" maxlength="20" align="right"> > > > > > border="0" cellspacing="0" cellpadding="0"> > > class="text_1"> > Your E-Mail > Address: > type="text" size="11" maxlength="40" align="right"> > > > > > border="0" cellspacing="0" cellpadding="0"> > > Find by > Zip Code: > size="9" maxlength="5" align="right"> > > > cellpadding="0"> > > > > src="images/find.jpg" width="33" height="20"> > > > > > > > // I try with this application in find.php > > > if (!$cname) > { > echo "Enter your Company > Name."; > } > elseif > (!ereg("^[a-za-z0-9_\...@[a-za-z0-9\-]+\.[a-za-z0-9\-\.]+$", $email)) > { Do yourself a favour: * remopve that 1337 hax0r name - it makes you look like a dumbass * buy a PHP related book * change your code to work with register_globals OFF * don't rely on regular expressions to validate an email without reading the email RFC nor knowing regular expressions * don't use ereg! preg is what you want instead you can check out filter_input() on http://php.net/manual .. Look out for FILTER_VALIDATE_EMAIL * Have a nice day [optional] >:-) > echo "Enter a Valid E-Mail > Address."; > } > elseif (strlen($zip)<5) > { > echo "Enter a Valid Zip > Code."; > } > elseif (ereg("[^0-9]", $zip)) > { > echo "Enter a Valid Zip > Code."; > } > else > { > echo "Find an Agent close to > you."; > } > ?> > > Thanks to all. > > -- > salu2 ®0L¥ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL, MD5 and SHA1
2009/4/21 Andrew Ballard : > On Tue, Apr 21, 2009 at 8:34 AM, Grega Leskovsek wrote: >> provided I want to store hash of a password in MySQL ... Using MySQL, >> the whole check can be achieved with a SQL query, since the MD5 >> function is provided as part of the database query language ... >> Can I use also SHA1 or must I use MD5? >> >> Thanks in advance, >> >> -- >> When the sun rises I receive and when it sets I forgive -> >> http://users.skavt.net/~gleskovs/ >> All the Love, Grega Leskov'sek >> > > I would encode the value in PHP and pass the hash to MySQL rather than > passing the password in open text as part of the query and letting > MySQL calculate the hash. That way the sensitive data has already been > hashed and you don't have to worry about whether the communication > between PHP and MySQL travels over an unencrypted network connection > -- now or in the future. Well, It's a point. But regarding that in most setups the database server is only accessible in a local subnet or is only listening on the loopback device of the same server hosting the webserver, you must not think about someone sniffing your traffic. A web application that uses an external db server would be quite ... uhm... slow! Anyone did this, yet? ;) I'm using md5()/sha1() in several stored procedures and I feel quite safe with it. Regards > > Andrew > > -- > 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] Encrypting email
Bob McConnell wrote: > These will be targeted emails for selected recipients, primarily in > the Security and Public Safety offices. But they will be sent via > public mail servers, so the content must be protected. The question is - to what extent? You can use TLS for server-to-server encryption, which is easy, but if you need person-to-person encryption, I think your best option is still S/MIME. > Knowing the first site where this would go for field trials, I suspect > most recipients are using some version of Microsoft Outlook. But other > sites down the road are likely to have different clients. That end is > completely outside of my control or influence. Use S/MIME. It's standard, and it's supported by e.g. both outlook and thunderbird. -- Per Jessen, Zürich (18.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL, MD5 and SHA1
Jan G.B. wrote: > A web application that uses an external db server would be quite ... > uhm... slow! Anyone did this, yet? ;) Certainly, and it's not slow. It depends entirely on your connection to the public internet. -- Per Jessen, Zürich (18.2°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] collation
I am getting some weird results on some pages output to browser. Many of the listings on the site are in different languages (English, French, Spanish, German, Portugese, Swedish and Italian) - Some author's names are in those languages and some comments or reviews as well. That means that some of the characters have those weird accents on them. The problem I am encountering is this - the same browser displays some pages differently even if the db is the same for the data on all pages. What is not clear to me is why a page would display the whole text including the é type of stuff and other pages show the character. How could this be fixed? Does the collation have anything to do with this. My tables are all InnoDB with Collation as latin1_swedish_ci. Should this be changed to utf8 ? phpMyAdmin shows in the structure display of the database at the bottom of the list of tables that there are 7 tables, Sum, 529 (Records), MyISAM (Type), latin1_swedish_ci (Collation) Why does the summary show MyISAM when all the tables are shown as type InnoDB? I'm puzzled. Anybody know what's going on? -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re: Collation - Solved
Ok, here's where we see a problem with html sanitization. This was the guilty party: $aList = array_map('htmlspecialchars', $aList); Once commented out & deleted, things are back to normal. :-\ -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help me debug this
Patrick Moloney wrote: Some months ago I downloaded and installed Apache, PHP and MySql. With only light use they seem to be working. I have downloaded a Test Script from the VBulletin vendor that is supposed to determine if your setup could run their product. The Test Script is php and appears as a form that allows you to enter a Mysql database name, user and password. I fill it in and select the button. The large blue window remains but the entry boxes and a border disappear. It hasn't totally crashed and can be closed - but it has stopped. I've tried their help forum, but they keep telling me to create an empty database. Maybe the problem has something to do with Mysql, but for a test script, I'm getting zero feedback. I have an empty database and one with a couple of tables. I don't see a problem with Mysql. So, how does one begin to debug this php test script to see what's failing? I'm kind of new to php. Thanks all for the help. I fixed my problem. I thought I would save some time running the vendor's test script, but wound up spending most of the day on this. Not very proficient in PHP, but I learned an odd variety of things. Problem was I had PHP and Mysql installed and working, but not together. The PHP for Windows 5.2 no longer automatically installs Mysql. Actually have to go back to Windows Control Panel where it will let you change the install. It then installs the dlls and modifies php.ini -- which I had already done. Difficulty was because the vendor test script has errors disabled - maybe ok in a test script -- unless you don't handle the errors! This took longer than installing Apache, PHP and MySql in the first place. Thanks, the assistance helped. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to deal with $_SERVER['REQUEST_URI'] on IIS?
Hi all, Apparently, $_SERVER['REQUEST_URI'] doesn't get set the same way when running PHP on IIS as when running it on Apache. Specifically, it seems to contain the script name only, and not the query string part. I know I can rewrite my code to piece together a $_SERVER['REQUEST_URI'] from $_SERVER['SCRIPT_NAME'] and $_SERVER['QUERY_STRING'], but some instances of $_SERVER['REQUEST_URI'] are in third party scripts which would be a bit of a pain to fix every time they are updated. It is a known problem since there are several mentions and workarounds to be found on the Internet, but I'm wondering which is currently the "best" way to deal with it. I don't personally run PHP with IIS, so I haven't encountered this problem before...but now I have a user who does. I could potentially have more users who encounter the same thing, so the easier the instructions and the less tinkering, the better. Is there a php.ini setting, for instance? What have you found that works for you? Thanks, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to deal with $_SERVER['REQUEST_URI'] on IIS?
On Tue, Apr 21, 2009 at 4:04 PM, Mattias Thorslund wrote: > Hi all, > > Apparently, $_SERVER['REQUEST_URI'] doesn't get set the same way when > running PHP on IIS as when running it on Apache. Specifically, it seems to > contain the script name only, and not the query string part. > > I know I can rewrite my code to piece together a $_SERVER['REQUEST_URI'] > from $_SERVER['SCRIPT_NAME'] and $_SERVER['QUERY_STRING'], but some > instances of $_SERVER['REQUEST_URI'] are in third party scripts which would > be a bit of a pain to fix every time they are updated. > > It is a known problem since there are several mentions and workarounds to be > found on the Internet, but I'm wondering which is currently the "best" way > to deal with it. I don't personally run PHP with IIS, so I haven't > encountered this problem before...but now I have a user who does. I could > potentially have more users who encounter the same thing, so the easier the > instructions and the less tinkering, the better. Is there a php.ini setting, > for instance? What have you found that works for you? > > Thanks, > > Mattias It works just fine on the servers where I work. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to deal with $_SERVER['REQUEST_URI'] on IIS?
Andrew Ballard wrote: On Tue, Apr 21, 2009 at 4:04 PM, Mattias Thorslund wrote: Hi all, Apparently, $_SERVER['REQUEST_URI'] doesn't get set the same way when running PHP on IIS as when running it on Apache. Specifically, it seems to contain the script name only, and not the query string part. I know I can rewrite my code to piece together a $_SERVER['REQUEST_URI'] from $_SERVER['SCRIPT_NAME'] and $_SERVER['QUERY_STRING'], but some instances of $_SERVER['REQUEST_URI'] are in third party scripts which would be a bit of a pain to fix every time they are updated. It is a known problem since there are several mentions and workarounds to be found on the Internet, but I'm wondering which is currently the "best" way to deal with it. I don't personally run PHP with IIS, so I haven't encountered this problem before...but now I have a user who does. I could potentially have more users who encounter the same thing, so the easier the instructions and the less tinkering, the better. Is there a php.ini setting, for instance? What have you found that works for you? Thanks, Mattias It works just fine on the servers where I work. Andrew Thanks Andrew. I just read that there is supposedly a fix for this in FastCGI: http://ruslany.net/2008/08/update-for-iis-70-fastcgi-module/ You might have that update already. If this fix works, then it's obviously the best solution to the problem. Cheers, Mattias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to deal with $_SERVER['REQUEST_URI'] on IIS?
On Tue, Apr 21, 2009 at 4:21 PM, Mattias Thorslund wrote: > Andrew Ballard wrote: >> >> On Tue, Apr 21, 2009 at 4:04 PM, Mattias Thorslund >> wrote: >> >>> >>> Hi all, >>> >>> Apparently, $_SERVER['REQUEST_URI'] doesn't get set the same way when >>> running PHP on IIS as when running it on Apache. Specifically, it seems >>> to >>> contain the script name only, and not the query string part. >>> >>> I know I can rewrite my code to piece together a $_SERVER['REQUEST_URI'] >>> from $_SERVER['SCRIPT_NAME'] and $_SERVER['QUERY_STRING'], but some >>> instances of $_SERVER['REQUEST_URI'] are in third party scripts which >>> would >>> be a bit of a pain to fix every time they are updated. >>> >>> It is a known problem since there are several mentions and workarounds to >>> be >>> found on the Internet, but I'm wondering which is currently the "best" >>> way >>> to deal with it. I don't personally run PHP with IIS, so I haven't >>> encountered this problem before...but now I have a user who does. I could >>> potentially have more users who encounter the same thing, so the easier >>> the >>> instructions and the less tinkering, the better. Is there a php.ini >>> setting, >>> for instance? What have you found that works for you? >>> >>> Thanks, >>> >>> Mattias >>> >> >> It works just fine on the servers where I work. >> >> Andrew >> > > Thanks Andrew. I just read that there is supposedly a fix for this in > FastCGI: > http://ruslany.net/2008/08/update-for-iis-70-fastcgi-module/ > > You might have that update already. If this fix works, then it's obviously > the best solution to the problem. > > Cheers, > > Mattias > > > I'm pretty sure we're using ISAPI right now. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL, MD5 and SHA1
Andrew Ballard wrote: > On Tue, Apr 21, 2009 at 8:34 AM, Grega Leskovsek wrote: >> provided I want to store hash of a password in MySQL ... Using MySQL, >> the whole check can be achieved with a SQL query, since the MD5 >> function is provided as part of the database query language ... >> Can I use also SHA1 or must I use MD5? >> >> Thanks in advance, >> >> -- >> When the sun rises I receive and when it sets I forgive -> >> http://users.skavt.net/~gleskovs/ >> All the Love, Grega Leskov'sek >> > > I would encode the value in PHP and pass the hash to MySQL rather than > passing the password in open text as part of the query and letting > MySQL calculate the hash. That way the sensitive data has already been > hashed and you don't have to worry about whether the communication > between PHP and MySQL travels over an unencrypted network connection > -- now or in the future. > > Andrew In addition, you don't want the password showing up in a general query log for the server. -- Micah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checkboxes
How to deactivate checkboxes when one in a series is checked? So that only 1 of the other inputs could be used in a search. Probably do the rest with switch stuff. Would be neat if the deactivated checkboxes would go grey. Is this an HTML question? Use onclick?But I think I need to either use a php string or function or would this be a CSS thingy? Thanks for any help. -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: checkboxes
PJ wrote: > How to deactivate checkboxes when one in a series is checked? > > > > > So that only 1 of the other inputs could be used in a search. Probably > do the rest with switch stuff. > Would be neat if the deactivated checkboxes would go grey. > Is this an HTML question? Use onclick?But I think I need to either use a > php string or function or would this be a CSS thingy? > Thanks for any help. > Actually, you would use javascript to do this. You may use CSS with it, but javascript would trigger/do the deactivation/graying out. Better to use radio buttons here. Only one in a group can be selected. Use the same name for all in a group but assign a different value. You can use numbers as the values or use the actual value from the DB maybe. So on submit the value of $_POST['choice'] would be 1, 2, 3, or 4. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check whether a page is Google Cached
Thank you so much. "haliphax" дÈëÏûÏ¢ÐÂÎÅ:952625160904210738k494b892dlac3bb1b8e809f...@mail.gmail.com... > On Tue, Apr 21, 2009 at 8:29 AM, Alan Chen wrote: >> Hi, everyone, >> >> I want to write a small PHP script test.php that can determine whether a >> webpage is Google Cached. >> >> Assuming it is uploaded to www.mysite.com, and I want to use it to check >> whether www.yoursite.com is google cached. >> >> It works as follows: >> >> The user input the query: >> >> http://www.mysite.com/test.php?site=www.yoursite.com >> >> The php script will send the following request to the browser >> >> http://www.google.com/search?q=cache:www.yoursite.com >> >> in the background. >> >> And if the returned result contains a string "This is Google's cache of", >> then the page is cached, so the php script can display >> >> "Your site is cached by Google" >> >> otherwise, it will say >> >> "Your site is not cached by Google" >> >> Just wonder how to implement such a feature, can anyone write a simple >> sample so that I can use as a startpoint as I am a totally new guy in PHP >> coding > > You've already laid out most of what needs to be done. I think the > file_get_contents() function will be your best friend here, provided > allow_url_fopen has been set to TRUE in your PHP configuration. Take > the result you get back from that function and parse the 2nd line for > ">This is Google's cache of <" (I have made this assumption by > looking at the source of > http://www.google.com/search?q=cache:www.php.net). > > example.php > === > $url = $_GET['url']; > $res = file_get_contents('http://www.google.com/search?q=cache:' . $url); > if($res && strstr('>This is Google's cache of <', $res)) > echo 'Your page is cached.'; > else > echo 'Your page is not cached.'; > ?> > > UNTESTED. Hope this helps. > > > -- > // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unable to send mail from PHP to AT&T e-mail address
I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an AT&T address, such as my own as an AT&T ISP customer, the mail never gets to me. If the 'to' address is anything other than an AT&T address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Some From Name '; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg."\r\n\r\n",$headers)) echo "good"; else echo "bad"; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns "good", so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an AT&T address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own AT&T address also. I have also checked my AT&T mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but AT&T $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
On Apr 21, 2009, at 20:32, Edward Diener wrote: I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an AT&T address, such as my own as an AT&T ISP customer, the mail never gets to me. If the 'to' address is anything other than an AT&T address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Some From Name '; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg."\r\n\r\n",$headers)) echo "good"; else echo "bad"; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns "good", so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an AT&T address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own AT&T address also. I have also checked my AT&T mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but AT&T $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It might be that the server IP has been blacklisted with at&t as a domain from which spam is sent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: checkboxes
yeh an onclick event handler is required to achieve this. but as Shawn has suggested radio buttons are better in this case. but then again if u want to disable/greyout the other input(like textboxes, other than the radio button itself) u'll hav to use onclick event handler for the radio buttons -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
kranthi wrote: of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server Somehow I doubt AT&T gives out that sort of access ;) The idea is right if you have access to both servers though. -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] MySQL, MD5 and SHA1
Oops, meant to copy the list. -- Forwarded message -- From: Steve Holmes Date: Tue, Apr 21, 2009 at 10:13 PM Subject: Re: [PHP] MySQL, MD5 and SHA1 To: Per Jessen On Tue, Apr 21, 2009 at 1:35 PM, Per Jessen wrote: > Jan G.B. wrote: > > > A web application that uses an external db server would be quite ... > > uhm... slow! Anyone did this, yet? ;) > > Certainly, and it's not slow. It depends entirely on your connection to > the public internet. > > > > -- > Per Jessen, Zürich (18.2°C) > > Ditto. No problem at all for us. Steve Holmes Purdue University -- Pride, like laudanum and other poisonous medicines, is beneficial in small, though injurious in large, quantities. No man who is not pleased with himself, even in a personal sense, can please others. -Frederick Saunders, librarian and essayist (1807-1902) Truth never damages a cause that is just. -Mohandas Karamchand Gandhi (1869-1948)
Re: [PHP] Logging out of a SSL / https:// site using PHP? (or JS?), Client Side Cache
""Michael A. Peters"" wrote in message news:49e4d4ca.7060...@mac.com... > scubak1w1 wrote: >> ""Michael A. Peters"" wrote in message >> news:49e41267.5010...@mac.com... >>> scubak1w1 wrote: I have a series of web sites which use https:// authentication (using AD integration to 'check the credentials' as it were) - all seems to be working well.. [snip] > > I don't know much about active directory but I thought one of the points > of AD was to eliminate the need for a user to log in since they are > already authenticated by the centralized AD system. Thanks Micheal for helping me clarify the situation, I appreciate your expertise... and sorry for the delay in replying, it has been a busy week so far! I am usings AD, as mentioned and as you probably inferred, so I don't have to sync credentials on "my" system with the 500± users in the AD... (i.e., when someone leaves the company, new hires, password changes, etc, etc) > If you want to use active directory as the only user authentication method > then as long as the browser sends the credentials it will verify and the > user is logged in. Yep, that is it - not forgetting that users may use the intranet site from the company internet site on PCs not logged on to the network... > You could probably use password _in addition to_ active directory to > authenticate a php session, allowing you increased security over just a > session token (IE browser has to send valid php session AND active > directory credentials) but if you want a user to have to login in addition > to active directory credentials, use php sessions on your server, and upon > succesful login w/ proper AD credentials set a session variable that says > they are authenticated. OK, that is where I am at now... glad to see I am following 'standard procedure' > When they log out, unset the session variable that says they are logged in > and expire the session. Then regardless of their AD credentials, they will > have to log in again to be verified by the session system. Now HERE is where I think I have having the issues... I can use PHP to log them off my site, server side, and hence "demand" to see their AD credentials again... BUT from my reading and understanding, the browser is caching this info - and so when it "sees" the request for AD credentials it says "oh, I have those from a few minutes ago, here you go..." (i.e., the same browser session on the clients side if they haven't closed their browser in the meantime...), thereby relogging them on server side - but I > SSL doesn't do anything magic as far as user authentication is concerned, > it simply provides a public/private key encryption so that (theoretically) > only the browser can decrypt what the server sends and only the server can > decrypt what the browser sends. That distinction is useful to know / be reminded about, thank you - since IIS integrates SSL and AD transparently to me as a non-IT-admin person, I guess I was not making that distinction clearly enough... So (assuming I have this right) is there a way to have PHP clear the user's browser cache of the appropiate AD credentials if the user is in the same browser session and then move to, say, www.google.com? Or should I be looking at some JS? Or expending my efforts on other 'projects'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Suggestions of some good, simple file upload 'in progress' code?
Hello, Can someone pass on some suggestions of some good, simple file upload 'in progress' code? Maybe as simple as changing the cursor icon for the duration? I have am HTML form that gathers some data and allows for a file upload of up to 80Mb (on a secure site, and limited to *.zip files) - all works well, pretty simple stuff... ... ... {uses array_key_exists, various checks to make sure a file is selected, has a ZIP extension, etc) ... //store the $_FILES 'final' file name in a variable for later use... $_SESSION['final_uploaded_zip_file_name'] = $_FILES['new_module_zip_file']['name']; //DRAFT @ 04/06/09 --> change cursor icon whilst the file is uploading and/or use a progress bar //save the temp file that $_FILES creates to it's "upload" home, ready for the site manager to process move_uploaded_file($_FILES['new_module_zip_file']['tmp_name'],$default_upload_directory.$_SESSION['final_uploaded_zip_file_name']); ... The user can look in the the lower left, say, to see they upload progress (sic) that is part of the browser. BUT it would be nice to have some page specific visual prompt for the user, depending on their connection 80Mbs might take a while! As mentioned, even something as simple as changing the cursor to an hourglass for the duration might help... I have found a few examples of upload meters, but was looking for something simpler - and, to be frank, something more within the grasp of my current PHP coding abilities (or lack thereof!) *Thanks in advance*: GREG... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
Phpster wrote: On Apr 21, 2009, at 20:32, Edward Diener wrote: I have a PHP script which uses the PHP 'mail' function. When the script's 'to' address is an AT&T address, such as my own as an AT&T ISP customer, the mail never gets to me. If the 'to' address is anything other than an AT&T address, the mail gets to the recipient. The PHP code for sending the mail is essentially: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Some From Name '; $to = 'mybellsouthaddress.net'; $subject = 'Some Subject'; $msg = 'Some Message'; if(mail($to,$subject,$msg."\r\n\r\n",$headers)) echo "good"; else echo "bad"; In the actual PHP script the $to, $subject, and $msg are successfully passed to the script from the client side as $_POST, $_POST and $_FILES parameters respectively. I have just filled them in above so that they can be seen as if they were part of the script. The script always returns "good", so the mail function must be successful. In my project, testing has reported that any attempt to use the 'mail' function on the server to send to an AT&T address fails to reach the recipient, while all other addresses used in the testing succeed in reaching the recipient. I can assert this to be the case with my own AT&T address also. I have also checked my AT&T mailbox online to make sure the mail is not being received as Spam. Does anybody have an idea why using the 'mail' function succeeds with all but AT&T $to addresses ? Naturally in the client-server application on which I am working, sending mail from the server must work for all $to addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It might be that the server IP has been blacklisted with at&t as a domain from which spam is sent. In that case I would have expected the spam to show up in my web mail spam folder. If AT&T is blacklisting the sending server IP without even delivering the mail to me as spam, I know of no way to find this out other than trying to talk to an AT&T representative. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
kranthi wrote: of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server I doubt AT&T will give me access to the log files on their incoming mail server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
Chris wrote: kranthi wrote: of u are sure that the mail was not received as spam... check the log files of the mail server on the server to be sure that the mail actually reached the mail server from the http server Somehow I doubt AT&T gives out that sort of access ;) Exactly. The idea is right if you have access to both servers though. As you suggested, I can check my own server but I doubt I can get access to AT&T's incoming mail server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Suggestions of some good, simple file upload 'in progress' code?
""scubak1w1"" wrote in message news:cf.13.21597.2ee8e...@pb1.pair.com... > Hello, > > Can someone pass on some suggestions of some good, simple file upload 'in > progress' code? > > Maybe as simple as changing the cursor icon for the duration? [self snip!] http://www.johnboy.com/about-us/news/a-useful-php-file-upload-progress-meter seems to be the "cleanest" example I can find - would this be fair to say? Cheers... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to AT&T e-mail address
"Edward Diener" wrote in message news:d9.64.21597.c829e...@pb1.pair.com... > Chris wrote: >> kranthi wrote: >>> of u are sure that the mail was not received as spam... >>> >>> check the log files of the mail server on the server to be sure that >>> the mail actually reached the mail server from the http server >> >> Somehow I doubt AT&T gives out that sort of access ;) > > Exactly. > >> >> The idea is right if you have access to both servers though. > > As you suggested, I can check my own server but I doubt I can get access > to AT&T's incoming mail server. AT&T is potentially using one of the BLs such as SCBLs... Try going to, say, http://www.senderbase.org/, enter the IP and then on the listings page try the DNS-based blocklists [Show/Hide all] links If you are comfortable, email me the IP back channel, I am a user of SpamCop and can put it in their parser - it checks a bunch of BLs in oone swoop... (OR sign up for free at http://spamcop.net/anonsignup.shtml(I am just a user, in no way prompting their services...)) Here is the output for 121.185.154.247 for instance: Parsing input: 121.185.154.247 [report history] Routing details for 121.185.154.247 [refresh/show] Cached whois for 121.185.154.247 : kornet...@kt.co.kr ab...@kornet.net Using abuse net on kornet...@kt.co.kr abuse net kt.co.kr = postmas...@kt.co.kr, kornet...@kt.com, ab...@kornet.net, spam...@kisa.or.kr, ab...@kt.com, c...@certcc.or.kr, webmas...@kt.com Using best contacts postmas...@kt.co.kr kornet...@kt.com ab...@kornet.net spam...@kisa.or.kr ab...@kt.com c...@certcc.or.kr webmas...@kt.com c...@certcc.or.kr redirects to spamre...@certcc.or.kr Statistics: 121.185.154.247 listed in bl.spamcop.net (127.0.0.2) More Information.. 121.185.154.247 not listed in dnsbl.njabl.org ( 127.0.0.8 ) 121.185.154.247 not listed in dnsbl.njabl.org ( 127.0.0.9 ) 121.185.154.247 listed in cbl.abuseat.org ( 127.0.0.2 ) Reporting addresses: postmas...@kt.co.kr kornet...@kt.com ab...@kornet.net spamre...@certcc.or.kr spam...@kisa.or.kr ab...@kt.com webmas...@kt.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Suggestions of some good, simple file upload 'in progress' code?
On Tue, Apr 21, 2009 at 9:02 PM, scubak1w1 wrote: > > ""scubak1w1"" wrote in message > news:cf.13.21597.2ee8e...@pb1.pair.com... >> Hello, >> >> Can someone pass on some suggestions of some good, simple file upload 'in >> progress' code? >> >> Maybe as simple as changing the cursor icon for the duration? > > [self snip!] > > http://www.johnboy.com/about-us/news/a-useful-php-file-upload-progress-meter > seems to be the "cleanest" example I can find - would this be fair to say? Google Gears makes it very easy and can make it very simple (no webserver configuration required) to basically slice the file up and send chunks via POST - I need to publish all the code and a howto, and Valery has written some code for nginx that might make it alleviate the need for PHP to be involved at all - I have still not tested that though, but the PHP code required is only like 10 lines or so, the Gears stuff is pretty basic Javascript and since it's Javascript you can make it match your UI perfectly by filling in div tags or whatever else you want (works great with jQuery) Actually I have a demo, not the cleanest code if you view the source but you get the idea. It also works over NFS with multiple webservers writing to the same file (I have 3 webservers behind LVS so technically your request could be going to any of them) http://mikehost.com/~mike/tmp/u/ <- frontend and view source to see gears + js http://mikehost.com/~mike/tmp/u/temp.php.txt <- server side piece I can't find the latest/cleanest code, but it gives you an idea. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MAIL Error
Yeah its all garbage. But its from the company. I don't know how to trim it. Can anyone suggest? -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: Tuesday, April 21, 2009 7:29 PM To: Ramesh Marimuthu (WT01 - Telecom Equipment); php-general@lists.php.net Subject: Re: [PHP] MAIL Error At 12:58 PM +0530 4/21/09, wrote: >P Save a tree...please don't print this e-mail unless you really need >to > > >Please do not print this email unless it is absolutely necessary. > >The information contained in this electronic message and any >attachments to this message are intended for the exclusive use of the >addressee(s) and may contain proprietary, confidential or privileged >information. If you are not the intended recipient, you should not >disseminate, distribute or copy this e-mail. Please notify the sender >immediately and destroy all copies of this message and any attachments. > >WARNING: Computer viruses can be transmitted via email. The recipient >should check this email and any attachments for the presence of >viruses. The company accepts no liability for any damage caused by any >virus transmitted by this email. > >www.wipro.com ramesh: Could you trim your signature a bit? What's this "Save a tree" nonsense??? The paper industry plants more trees than it uses but this is not a topic for the PHP list. How about saving bandwidth or saving us the time to review the same long-ass signature over and over that tells us nothing but what everyone already knows AND does absolutely nothing to protect the company you work for. It's just a excessive length of garbage and misinformation that tells everyone your company is totally clueless about list etiquette. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: checkboxes
On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote: > yeh an onclick event handler is required to achieve this. but as Shawn > has suggested radio buttons are better in this case. > > but then again if u want to disable/greyout the other input(like > textboxes, other than the radio button itself) u'll hav to use onclick > event handler for the radio buttons > Not necessarily, you could use CSS to change the background colour: input[checked=checked] { set styles here } Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MAIL Error
seems u r company mail server is adding this to all outgoing mails. if that is the case only option is to change configuration settings in the mail server. you can ask the anchorites to do that (i m not optimistic bout that, though). dont use this mail server to send mails to mailing lists Kranthi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MAIL Error
Thanks kranthi -Original Message- From: kranthi [mailto:kranthi...@gmail.com] Sent: Wednesday, April 22, 2009 11:02 AM To: Ramesh Marimuthu (WT01 - Telecom Equipment) Cc: tedd.sperl...@gmail.com; php-general@lists.php.net Subject: Re: [PHP] MAIL Error seems u r company mail server is adding this to all outgoing mails. if that is the case only option is to change configuration settings in the mail server. you can ask the anchorites to do that (i m not optimistic bout that, though). dont use this mail server to send mails to mailing lists Kranthi. Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: checkboxes
Ashley Sheridan wrote: > On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote: >> yeh an onclick event handler is required to achieve this. but as Shawn >> has suggested radio buttons are better in this case. >> >> but then again if u want to disable/greyout the other input(like >> textboxes, other than the radio button itself) u'll hav to use onclick >> event handler for the radio buttons >> > Not necessarily, you could use CSS to change the background colour: > > input[checked=checked] > { > set styles here > } I see that Shawn's suggested radio buttons will do just fine. I hadn't thought about that. Dummy me. But the real problem I have is to pass a form input value to a variable. For example: How can I pass the "text" input to a variable that could be used by the "radio" button? The idea is to have several inputs for a search page with the inputs limited by the radio button to one choice of several inputs. If I can get the input to a variable, I can then manipulate it to do a query for the search. :-\ Hope this is understandable? -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: checkboxes
PJ wrote: > Ashley Sheridan wrote: > >> On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote: >> >>> yeh an onclick event handler is required to achieve this. but as Shawn >>> has suggested radio buttons are better in this case. >>> >>> but then again if u want to disable/greyout the other input(like >>> textboxes, other than the radio button itself) u'll hav to use onclick >>> event handler for the radio buttons >>> >>> >> Not necessarily, you could use CSS to change the background colour: >> >> input[checked=checked] >> { >> set styles here >> } >> > I see that Shawn's suggested radio buttons will do just fine. I hadn't > thought about that. Dummy me. > But the real problem I have is to pass a form input value to a variable. > For example: > > > How can I pass the "text" input to a variable that could be used by the > "radio" button? > The idea is to have several inputs for a search page with the inputs > limited by the radio button to one choice of several inputs. If I can > get the input to a variable, I can then manipulate it to do a query for > the search. :-\ > Hope this is understandable? Here's something I found but don't understand if or how it could be used: (from php.net manual) |quote... snip... to reliably allow form data to be fed back into a form (for editing a record, for instance) is like this: echo ""; This assumes that variables have been escaped (such as addslashes) after being retrieved from the database or after being received from a (probably this) form. endquote >From this form??? How would you get the $existingvalue? from the form? How? I'm trying, I'm trying... Phil | -- unheralded genius: "A clean desk is the sign of a dull mind. " - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: checkboxes
On Wed, 2009-04-22 at 01:38 -0400, PJ wrote: > Ashley Sheridan wrote: > > On Wed, 2009-04-22 at 07:17 +0530, kranthi wrote: > >> yeh an onclick event handler is required to achieve this. but as Shawn > >> has suggested radio buttons are better in this case. > >> > >> but then again if u want to disable/greyout the other input(like > >> textboxes, other than the radio button itself) u'll hav to use onclick > >> event handler for the radio buttons > >> > > Not necessarily, you could use CSS to change the background colour: > > > > input[checked=checked] > > { > > set styles here > > } > I see that Shawn's suggested radio buttons will do just fine. I hadn't > thought about that. Dummy me. > But the real problem I have is to pass a form input value to a variable. > For example: > > > How can I pass the "text" input to a variable that could be used by the > "radio" button? > The idea is to have several inputs for a search page with the inputs > limited by the radio button to one choice of several inputs. If I can > get the input to a variable, I can then manipulate it to do a query for > the search. :-\ > Hope this is understandable? > > -- > unheralded genius: "A clean desk is the sign of a dull mind. " > - > Phil Jourdan --- p...@ptahhotep.com > http://www.ptahhotep.com > http://www.chiccantine.com/andypantry.php > Just accept all the text inputs from the form, and use a switch on the radio button to determine which of the text inputs you use. Alternatively, just use one text box for input and use the value of the radio button to determine what to do with the text. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php