????

Your IP : 18.223.108.134


Current Path : /home2/morganrand/backup.morganrand.com/
Upload File :
Current File : /home2/morganrand/backup.morganrand.com/easylet_m.php

<?php require_once("adminOnly.php");?>
<img border="0" src="logo-top2.jpg" width="880" height="158">
<br>
<?php
/*
	EasyLetter 1.2
	This script is part of Onlinetools 
	http://www.onlinetools.org/tools/easyletter.php
*/
$vars=explode(",","pw,send,subject,message,email,action"); 
foreach($vars as $v){ 
if ($HTTP_GET_VARS[$v]!=""){$$v=$HTTP_GET_VARS[$v];} 
if ($HTTP_POST_VARS[$v]!=""){$$v=$HTTP_POST_VARS[$v];} 
} 
# Set the password for the eMail List editor!
$pass="sec";

# Where is your newsletter located? (For deletion link)
$newsletterlocation="http://www.wanderfuls.com/easylet.php";

# Name of the datafile
$filelocation="subscribers.txt";

# Title of the newsletter, will be displayed in the FROM field of the mailclient
$lettername="info@wanderfuls.com";

# Your email, will be the reply-to mail, 
$youremail="info@wanderfuls.com";

# pattern for filtering out own emails
$pattern = "wanderfuls.com";

$welcomemessage = "Hello, stranger.";

# Sorrymessage for failed subscription, will be followed by the email!
$sorrysignmessage = "<div class=\"warning\">Sorry, but there is already an entry for $email</div>";

# Sorrymessage for blank email
$sorryblankmailmessage = "<div class=\"warning\">Sorry, but with a blank mail I get lost in cyberspace</div>";

# Sorrymessage for invalid emails
$sorryoddmailmessage = "<div class=\"warning\">Sorry, but \"$email\" that does not look like an email to me</div>";

# Sorrymessage if someone entered your own mail
$sorryownmailmessage = "<div class=\"warning\">Sorry, but I don't really want to get my own newsletter!</div>";

# Subscribemessage, will be shown when someone subscribes.
$subscribemessage = "<div class=\"thanks\">Thank you for subscribing to the newsletter, a confirmation email is on its way!</div>";

# Subscribemail, will be sent when someone subscribes.
$subscribemail = "Thank you for subscribing to the newsletter.";

# Unsubscribemessage for deletion, will be followed by the email!
$unsubscribemessage = "<div class=\"thanks\">We deleted the email</div>";

# Unsubscribemessage for failed deletion, will be followed by the email!
$failedunsubscriptionmessage = "<div class=\"warning\">Sorry, you cannot unsubscribe as we didn't find an entry for $email</div>";

if (!file_exists($filelocation)) {
	$newfile = fopen($filelocation,"w+");
	fclose($newfile);
	}
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
fclose($newfile);
$content=stripslashes($content);
$out="";
$lines = explode("%",$content);
foreach($lines as $l){
	if ($l != $email){$out .= "%".$l;}
	else{$found=1;}
}
if ($action=="sign"){			
	if ($found==1 or $email=="" or !checkmail($email) or preg_match("/".$pattern."/",$email)){
		if ($email==""){echo $sorryblankmailmessage;}
		else if ($found==1){echo $sorrysignmessage;}
		else if (!checkmail($email)){echo $sorryoddmailmessage;}
		else if (preg_match("/".$pattern."/",$email)){echo $sorryownmailmessage;}
		$disp="yes";
	}
	else {
		$disp="no";
		$newfile = fopen($filelocation,"a+");
		$add = "%".$email;
		fwrite($newfile, $add);
		fclose($newfile);
		echo $subscribemessage;
		mail ($youremail,"New newsletter subscriber.",$email."\nDelete? $newsletterlocation?action=delete&email=".$email,"From: Newsletter\nReply-To: $email\n");
		$submailheaders = "From: $lettername subscription form\n";
		$submailheaders .= "Reply-To: $youremail\n";
		mail ($email,$lettername." subscription",$subscribemail,$submailheaders);
	}
}
if ($action=="delete"){		
	$disp="no";
	if ($found == 1){
		$newfile = fopen($filelocation,"w+");
		fwrite($newfile, $out);
		fclose($newfile);
		echo $unsubscribemessage;
		$disp="no";
	}
	if ($found != 1){
		echo $failedunsubscriptionmessage;
		$disp="YES";
	}
}
if ($pw	== $pass){
	if ($send != "yes" && $send != "test"){
		print'<form method="post"><input type="hidden" name=pw value='.$pass.' /><input type="hidden" name="send" value="yes">
		<br /><b>Newsletter editor:</b><br /><br />
		Subject:<br />
		<input type="text" class="input" name="subject" size="20"><br />
		Message:<br />
		<textarea cols="50" rows="10" class="input" wrap="virtual" name="message"></textarea>&#160;
		<input type="submit" value="send" />
		</form>';
	}
	$mailheaders = "From: $lettername\n";
	$mailheaders .= "Reply-To:$youremail\n";

# If you want to send HTML mail, uncomment this line!
//
	$mailheaders .= "Content-Type: text/html; charset=iso-8859-1\n";
	if ($send == "yes"){
		$message="".stripslashes($message);
		$subject=stripslashes($subject);
		$lines = explode("%",$content);
##############################################################################
#		foreach ($lines as $l){mail ($l,$subject,$message,$mailheaders);}
#		print "<b>The following email has been sent!</b>";
#		print "<pre>$mailheaders\n$subject\n$message</pre>";
##############################################################################
		$fl = explode("<",$lines[0]);
		$fl_count = count($fl);
		foreach ($lines as $l){
			$message_v = $message;
			$fl = explode("<",$l);
			for ($i=1; $i<$fl_count; $i++){
				$search_v = sprintf("#%d#",$i);
				$message_v = str_replace($search_v,$fl[$i],$message_v);
			}
			mail ($fl[0],$subject,$message_v,$mailheaders);
		}
		print "<b>The following email has been sent!</b>";
		printf ("<b> %d times.</b>",count($lines));
		print "<pre>$mailheaders\n$subject\n$message</pre>";
##############################################################################
	}
}
if ($pw != $pass && $disp != "no"){
	print $welcomemessage;
	print'
	<form method="post">
	Your email:&#160;<input type="text" name="email" class="inputsmall" value="" size="20" />&#160;
	<input type="radio" name="action" value="sign" checked="checked" />subscribe 
	<input type="radio" name="action" value="delete" />unsubscribe&#160;
	<input type="submit" value=" Send! " class="button" /> 
	</form>
	';
}
print "<!-- Easyletter Newsletterscript by Chris Heilmann, get yours @ http://www.onlinetools.org/easyletter/ -->";

function checkmail($string){
	return preg_match("/^[^\s()<>@,;:\"\/\[\]?=]+@\w[\w-]*(\.\w[\w-]*)*\.[a-z]{2,}$/i",$string);
}
?>
<h2 align="center"><a href="contact-ctrl.php">BACK</a></h2>