Bir Posta Listesi Oluşturma (PHP)

3 Cevap

Ben bilgi girişi için iki metin kutuları bir web sitesi var. Benim iki metin kutularına bilgileri almak için bir PHP dosyası Düğme emir "Gönder" ve kopyalama / amaç metin kutuları bilgi alabilir ve bir e-posta listesi oluşturmak için "Members.txt" adlı bir metin dosyasına yapıştırın. Şimdi benim sorunum ben metin dosyası ben listenin dışında olmaya göndermeyi denemek aynı anda düzenlendi benim ftp görebilirsiniz, ben vurmak her zaman göndermek çünkü PHP dosyası metin dosyası için aradığını bilmek olduğunu . Bunun dışında ilave, metin dosyası her zaman Metin dosyaları girişi hatları düşük ve düşük olan, düğme vurmak "Gönder" gördüğünüz gibi metin dosyasına bilgileri yerleştirmek için çalışıyor. Başka bir deyişle tam bir çizgi girilir. ancak metin yok. Ve hayır, metin beyaz değildir. Ben yanlış ne yapıyorum?

<h2>Join our Mailing List</h2>
   <form method="post" action="add.php" name="signup">
   <input type="hidden" name="pommo_signup" value="true" />
   <table border="0" bordercolor="#000000"
    bordercolordark="#000000" bordercolorlight="#000000">
     <tr>
       <td width="203" bgcolor="#FFFFFF">&nbsp;</td>
       </tr>
     <tr>
       <td bgcolor="#FFFFFF"> NAME:  <font size="4">
         <input name="name"
            type="text" size="20" maxlength="100" />
       </font></td>
       </tr>
     <tr>
       <td height="26" bgcolor="#FFFFFF"> EMAIL: <font size="4">
         <input name="email"
            type="text" size="20" maxlength="100" />
         </font></td>
       </tr>
     <tr>
       <td height="31" bgcolor="#FFFFFF"><span style="text-align: left"></span><p align="middle">
         <input type="image" src="ok.jpg" />
       </p></td>
       </tr>
     </table>
   </form>

THEN BELOW IS THE FORM THAT IS SUPPOSED TO ADD TO THE TEXT BOX.

<?php
$filename = "members.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
if(strstr($contents,$email)) { 
print "You're already subscribed to this mailing list.";
}
else {
echo "Thank you $email for joining the mailing list";
if (!$save = fopen("members.txt","a")) {
exit;
}
fwrite($save,"$email\r\n");
fclose($save);
if (!$save = fopen("names.txt","a")) {
exit;
}
fwrite($save,"$name\r\n");
fclose($save);
mail("$email", "Fairview HiFi News Letter", "Welcome to the Fairview HiFi mailing list. Your exclusive source for product and promotional news and events.",
     "From: Newsletter@FairviewHiFi.com\r\n"
    ."Reply-To: NOREPLY@FairviewHiFi.com\r\n"
    ."X-Mailer: PHP/" . phpversion());
}
?>

3 Cevap

Kullan $_POST['email'] değil $email.

Sizin sunucusu $ _POST kullanmak zorunda formu girişleri (ve değişkenler GET), $formFieldName şeklinde otomatik DAİREMİZ olmadığı anlamına gelir, engelli kayıt küresellerle var / GET / COOKIE / ...

Ve küresellerle kayıt etkinleştirmek eğer büyük bir güvenlik delik, bu ayarı değiştirmeyin.

Yayınlanan değişkenler $_POST aracılığıyla başvurulan gerekir. Yani e-posta olacaktır:

print $_POST["email"];

Ve sadece $email. Eğer yeni hat ekleme yaptığınız beri Ayrıca, size hitap edecek bir az ayrıntılı bir çözüm bulabilirsiniz. file_put_contents() with the FILE_APPEND bayrağı bakınız:

<?php
  $file = 'people.txt';
  // The new person to add to the file
  $person = "John Smith\n";
  // Append the contents of $person to the file named by $file.
  file_put_contents($file, $person, FILE_APPEND);
?>

there are several open source alternatives to creating your own mailing list. Creating an industrial scale mailing list application is a non trivial task. If you want php mailing list scripts you can check out either of the following options. PHPList( http://www.phplist.com) Pros- • Its has built in email templates with a powerful WYSIWYG editor which makes creating and deploying newsletter applications a breeze even for someone with no prior php programming experience. • Furthermore it also supports features such as RSS,List segmentation ,click tracking ,attachments bounce management etc. Cons- • Buggy and difficult to customize UI • Difficult to customize the look and feel of the UI to match that of the existing website

poMMO(http://www.pommo.org) Pros • It is very easy to match the look and feel of the subscription form to that of the existing website or embed the subscription form to an existing webpage. • WYSIWYG HTML mailing editor • It also provides a limit of sending of mails and provides an option of throttle by hour ,bytes or domain limits. • Provides localization and support for 10 other languages besides English

OpenEMM (http://www.openemm.org)

Pros • Sophisticated features not seen in other open source email subscription lists managers such as bounce management, link tracking, real time statistics and support for scripting. • Uses and supports leading java frameworks such as Hibernate, Spring and Struts.

Cons- • Huge code base which may cause slower page load times. • Might be considered overkill if only a basic email newsletter management is required. • Might not be supported by all web servers.