You are here: Re: PHP srnd two emails « PHP Programming Language « IT news, forums, messages
Re: PHP srnd two emails

Posted by shimmyshack on 06/28/07 10:08

On Jun 28, 7:56 am, "Pablo" <p...@nospam.com> wrote:
> "shimmyshack"
> wrote
>
>
>
> > try showing us the code that does the emailing, rather than the code
> > that tries 5 times to add a serial number to the end of a string.
>
> <?PHP
>
> function serialize()
>
> {
>
> $file="serial.txt";
>
> for ($try = 0; $try < 5; $try++)
>
> {
>
> $fp = fopen($file, "a+");
>
> if (flock($fp, LOCK_EX)) { // do an exclusive lock
>
> fseek($fp, 0);
>
> $id = fread($fp, 1024);
>
> $id++;
>
> ftruncate($fp, 0);
>
> fwrite($fp, strval($id));
>
> flock($fp, LOCK_UN); // release the lock
>
> break;
>
> }
>
> else
>
> {
>
> sleep(1);
>
> continue;
>
> }
> }
>
> fclose($fp);
>
> return $id;
>
> }
>
> $mail_text="Dear Sirs,\nthis is my question for you...........\n\r";
>
> $mail_text.=$_REQUEST['body_of_question']."\n\n";
>
> $mail_text.="Serial n.".serialize()."\n\n";
>
> $mail_subject="Questions";
>
> $mail_to=$_REQUEST['mailto'];
>
> $mail_from=$_REQUEST['_mailfrom'];
>
> $sended=@mail( $mail_to, $mail_subject, $mail_text, "From:
> {$mail_from}\n" );
>
> ?>

from that I can't see why, however you are encouraged to use PhpMailer
or some other email class tp send your mail. At least that way will
know that the implementation is ok, the way you are currently using
the mail() call could lead to problems as you dont appear to be
santitising the input.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация