Her

Home Web Programming PHP Php Mailing List with no MySql

Php Mailing List with no MySql

Author: Iiro Krankka Author's URL: More by this author

Php Mailing List with no MySql
<?php
if(!isset($_GET["email"])) {
?>
<form action="maillist.php" method="get">
Your email: <input type="text" name="email" id="email"><input type="submit" value="Submit">
</form>
<?php
} else {

if(!$_GET["act"]) {
$fi = file("admin/elist.txt");
sort($fi);
for($i = 0; $i < count($fi); $i++) {
if(ereg($fi[$i], $_GET["email"])) {
print "You'r already in list!";
die();
}
}
$f = fopen("admin/elist.txt", "a+");
$kir = fwrite($f, " " . $_GET["email"]);
fclose($f);
mail($_GET["email"], "Mailing List", "Hi, You have succesfully joined our mailing list at mysite.com. You'll be getting mail when it comes updates. If you want to leave our list, simply click the link below: http://www.yoursite.com/maillist.php?act=us&id=" . $_GET["email"] . "&n=followedfromlinkatemail", "From:You <[email protected]>");
if($kir) {
print "You have now joined our mailing list, gongratulations!";
die();
} else {
print "Something went wrong please try again...";
}
}
}
if($_GET["act"] == "us") {
if($id != "") {
$em = file("admin/elist.txt");
for($i = 0; $i < count($em); $index++) {
if(eregi($id, $em[$i])) {
$em[$i] = "";
$file = fopen("admin/elist.txt", "w");
for($ni = 0; $ni < count($em); $ni++) {
if($em[$ni] != "") {
fwrite($file, $em[$ni]);
}
}
fclose($file);
}
}
}
print "You have unsubscribed succesfully.";
}
?>

Your email:  

<?php
$emailL = file("elist.txt");
if(!isset($_GET["title"])) {
?>
<form action="manage.php" method="get">
<table border="0" cellpadding="0" cellspacing="0" style="font-family:Arial; color:#FFFFFF; font-size:10pt">
<tr>
<td>
Title
</td>
<td>
<input type="text" name="title" id="title">
</td>
</tr>
<tr>
<td>
Your name
</td>
<td>
<input type="text" name="sendersname" id="sendersname">
</td>
</tr>
<tr>
<td>
To
</td>
<td>
<select name="to" id="to">
<option value="all">All</option>
<?php
for($i = 0; $i < count($emailL); $i++) {
print "<option value="" . $emailL[$i] . "">" . $emailL[$i] . "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td valign="top">
Message
</td>
<td>
<textarea name="msg" id="msg" rows="10" cols="25" style="font-size:8pt; overflow:auto"></textarea><br>
<input type="button" name="button" id="button" onclick="laheta()" value="Send">
</td>
</tr>
</table>
</form>
<?php
} else {
if($_GET["to"] == "all") { for($i = 0; $i < count($emailL); $i++) {mail($emailL[$i], $_GET["title"], $_GET["msg"] . " -------------------------------------------------------- This message is not spam. If you want to leave, simply follow link below: http://www.taikasilma.com/temekoo/maillist.php?act=us&id=" . $emailL[$i] . "&button=pressed -------------------------------------------------------- ", "From:" . $_GET["sendersname"] . "<[email protected]>, To:" . $emailL[$i]);} print "Mail sent succesfully.";} else {
mail($_GET["to"], $_GET["title"], $_GET["msg"] . " -------------------------------------------------------- This message is not spam. If you want to leave, simply follow link below: http://www.taikasilma.com/temekoo/maillist.php?act=us&id=" . $email . "&button=pressed -------------------------------------------------------- ", "From:" . $_GET["sendersname"] . "<[email protected]>, To:" . $_GET["to"]);
print "Mail sent succesfully.";
}
}
?>