HEX
Server: Apache/2.4.25 (Debian)
System: Linux server17 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User: web37 (1062)
PHP: 7.4.30
Disabled: show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, disk_total_space, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen
Upload Files
File: /var/www/web37/htdocs/topsex/admin/newsletter.php
<?php
############################################
### Top-XL - Newsletter newsletter.php 
############################################
/// 1. You are NOT entiteld to rent, lease, transfer, reproduce or distribute this Software.
/// 2. You are entiteld to adapt, and modify the Software to your need.
/// 3. You can use this Script on all of YOUR Domains.
/// 4. Any modification or removal to the links in the footer and member area shall terminate this license immediately .
/// 5. The Script has been tested on different Servers and found free of any notable errors by the author. The Author shall not in any case be liable for any special, incidental indirect or other similar damages arising from the use of this Script.
/// 6. Author: Simon Zehender - Contact: https://www.paddelberg.de
////////////////////////////////////////////
////////////////////////////////////////////
if ($scriptpath!=$_SERVER['DOCUMENT_ROOT'])
	{echo "Are you looking for something?";exit;}

$db2 = new db ($mysqli_config);
$db2 -> connect ();
$main_content = '';
$ids = '';
$urls = '';
$names = '';
$error10 = '';
$error11 = '';
$userdata = '';
$message = '';

$subject = !empty ($_POST["subject"]) ? safety ($_POST["subject"]) : '';
$bodymessage = !empty ($_POST["body"]) ? safety ($_POST["body"]) : '';
$what = !empty ($_POST["what"]) ? safety ($_POST["what"]) : '';

if (!empty ($_POST['submit']))	
	{
	if (empty ($subject))
		{$error10 = $errortext10;}

	if (empty ($bodymessage))
		{$error11 = $errortext11;}

	//// if an error happens
	if (!empty ($error10) || !empty ($error11))
		{$message=$messageerror;}

	else
		{
		$sendcount=0;
		$rowmarker=0;
	
		# choose recipients
		if ($what=="choose")
			{
			$main_content="
			<form name=\"form1\" method=\"post\" action=\"index.php?do=newsletter\">
			<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
				<tr>
					<td height=\"35\" bgcolor=\"#FFFFFF\" colspan=\"6\" class=\"top\"><strong class=\"heading\">".$text_newsletter."</strong></td>
				</tr>
				<tr>
					<td width=\"80\" bgcolor=\"#E4E4E4\">".$text_select."</td>
					<td width=\"190\" bgcolor=\"#E4E4E4\">".$text_email."</td>
					<td width=\"80\" bgcolor=\"#E4E4E4\">".$text_accountids."</td>
					<td width=\"369\" bgcolor=\"#E4E4E4\" colspan=\"2\">".$text_urls."</td>		
					<td width=\"149\" bgcolor=\"#E4E4E4\">".$text_name."</td>
				</tr>";	
	
			$db -> query ("SELECT * FROM ".$topxl_user_table." GROUP BY email");
			
			while ($usergetrows = $db -> fetch ())
				{
				$db2 -> query ("SELECT * FROM ".$topxl_user_table." WHERE email='".$usergetrows['email']."'");
				while ($userget1rows = $db2 -> fetch ())
					{
					$ids.=$userget1rows['id']." <br>";
					$urls.="<a href=\"".$userget1rows['url']."\" target=\"_blank\">".$userget1rows['url']."</a><br>";
					$names.=$userget1rows['name']." <br>";
					}
		
				$rowmarker++;
				if ($rowmarker==2)
					{
					$tdbgcolor="bgcolor=\"#F7F7F7\"";
					$rowmarker=0;
					}
		
				else
					{$tdbgcolor="bgcolor=\"#FFFFFF\"";}
		
				$main_content.="
				<tr>
					<td ".$tdbgcolor." valign=\"top\"><input type=\"checkbox\" name=\"sendmailto[]\" value=\"".$usergetrows['email']."\"></td>
					<td ".$tdbgcolor." valign=\"top\">".$usergetrows['email']."</td>
					<td ".$tdbgcolor." valign=\"top\">".$ids."</td>
					<td ".$tdbgcolor." nowrap colspan=\"2\" valign=\"top\"><div id=\"Layer1\" style=\"position:relativ; width:260px; z-index:1; overflow: hidden;\">".$urls."</div></td>
					<td ".$tdbgcolor." valign=\"top\">".$names."</td>
				</tr>";
	
				$ids = '';
				$urls = '';
				$names = '';
				}
	
			$whatholder="choosen Users";
			$main_content.="
				<tr>
					<td bgcolor=\"#FFFFFF\">".$text_subject."</td>
					<td bgcolor=\"#FFFFFF\" colspan=\"3\"><input type=\"text\" name=\"subject\" id=\"subject\"  class=\"inputs3\" value=\"".$subject."\"></td>
					<td bgcolor=\"#FFFFFF\" colspan=\"2\"><span class=\"error\">".$error10."</span> ".$text_nwlexp_subject."</td>
				</tr>
				 <tr>
					<td bgcolor=\"#FFFFFF\">".$text_message."</td>
					<td bgcolor=\"#FFFFFF\" colspan=\"3\"><textarea name=\"body\" id=\"body\" class=\"textarea3\">".$bodymessage."</textarea></td>
					<td bgcolor=\"#FFFFFF\" colspan=\"2\"><span class=\"error\">".$error11."</span> ".$text_nwlexp_message."</td>
				</tr>		 
				<tr>
					<td height=\"28\" bgcolor=\"#FFFFFF\" colspan=\"6\"><input name=\"what\" type=\"hidden\"  value=\"sendchoose\"><input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\"> <input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\"></td>
				</tr>
			</table>
			</form>";	
		
			/// Template 
			if(!file_exists($file))
				{echo "The template ".$file." does not exist."; exit;}
			$fp1=fopen($file,"r");  
			$zeile=fread ($fp1, filesize ($file));
			include("template.php");
			echo $zeile;
			exit;
			}
	
		else
			{
			$main_content="
			<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
				<tr>
					<td height=\"35\" bgcolor=\"#FFFFFF\" colspan=\"3\" class=\"top\"><strong class=\"heading\">".$text_newsletter."</strong></td>
				</tr>";
			}

		# send choosed recipients
		if ($what=="sendchoose")
			{
			$sitecounter=0;
			$sendmailto=$_POST["sendmailto"];
	
			foreach($sendmailto as $email) 
				{
				$sitecounter++;
				$db -> query ("SELECT * FROM ".$topxl_user_table." where email='".$email."'");
				$sitecounter=0;
	
				while ($datagetrows = $db -> fetch ())
					{
					$sitecounter++;
			
					if ($sitecounter>1)
						{$userdatahead=$text_ids.":     ".$text_youractsites;}
					else 
						{$userdatahead=$text_id.":     ".$text_youractsite;}
	
					$userdata .= $datagetrows['id']."      ".$datagetrows['url']." \n";
					}

				$body=$bodymessage."\n\n".$userdatahead."\n".$userdata."\n\n".$config['mailpromo']."\n\n".$commercialmailtext."\n\nTopsiteurl: ".$config['topsiteurl']."\n";
				$body = strip_tags (stripslashes ($body));
				mail($email,$subject,$body,"From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
				$body = '';
				$userdata = '';					
				$sendcount++;				
				$main_content.="
				<tr>
					<td width=\"210\" bgcolor=\"#FFFFFF\">".$text_mailsentto."</td>
					<td width=\"300\" bgcolor=\"#FFFFFF\">".$email."</td>
					<td width=\"241\" bgcolor=\"#FFFFFF\">V</td>
				</tr>";
				}
			$whatholder="Choosen Users";
			}

		# 
		elseif ($what=="valid" or $what=="invalid" or $what=="all" or $what=="new" or $what=="inactive" or $what=="active")
			{
			if ($what=="valid")
				{
				$sqlholder1="WHERE active='yes' GROUP BY email";
				$sqlholder2="and active='yes'";
				$textholder1=$text_yourvalidatedsites;
				$textholder2=$text_yourvalidatedsite;
				$whatholder="Valid Users";
				}
			elseif($what=="invalid")
				{
				$sqlholder1="WHERE active='no' GROUP BY email";
				$sqlholder2="and active='no'";
				$textholder1=$text_yournotvalidatedsites;
				$textholder2=$text_yournotvalidatedsite;
				$whatholder="Invalid Users";
				}
			elseif ($what=="all")
				{
				$sqlholder1="GROUP BY email";
				$sqlholder2="";
				$textholder1=$text_yoursites;
				$textholder2=$text_yoursite;
				$whatholder="All Users";
				}
			elseif ($what=="new")
				{
				$sqlholder1="WHERE active='no' and newentry='yes' GROUP BY email";
				$sqlholder2="and active='no' and newentry='yes'";
				$textholder1=$yournotvalidnewsites;
				$textholder2=$yournotvalidnewsite;
				$whatholder="New Users";
				}
			elseif ($what=="inactive")
				{
				$now=time();
				$inactivetime1=$now-$config['inactivetime'];
				$sqlholder1="WHERE active='yes' and lastactive<='".$inactivetime1."' GROUP BY email";
				$sqlholder2="";
				$textholder1=$text_yourinactivesites;
				$textholder2=$text_yourinactivesite;
				$whatholder="Inactive Users";
				}
			elseif ($what=="active")
				{
				$now=time();
				$inactivetime1=$now-$config['inactivetime'];
				$sqlholder1="WHERE active='yes' and lastactive>='".$inactivetime1."' GROUP BY email";
				$sqlholder2="";
				$textholder1=$textyouractivesites;
				$textholder2=$textyouractivesite;
				$whatholder="Active Users";
				}
	
			$db -> query ("SELECT * FROM ".$topxl_user_table." ".$sqlholder1);
			while ($maildata = $db -> fetch ())
				{
				$db2 -> query ("SELECT * FROM ".$topxl_user_table." where email='".$maildata['email']."' ".$sqlholder2);
				$sitecounter=0;
				while ($data = $db2 -> fetch ())
					{
					$sitecounter++;
					if ($sitecounter>1)
						{$userdatahead=$text_ids."     ".$textholder1;}
					else 
						{$userdatahead=$text_id."     ".$textholder2;}
					$userdata.=$data['id']."      ".$data['url']." \n";
					}
				$body=$bodymessage."\n\n".$userdatahead."\n".$userdata."\n\n".$config['mailpromo']."\n\n".$commercialmailtext."\n\nTopsiteurl: ".$config['topsiteurl']."\n";
				$body=strip_tags (stripslashes ($body));
				mail ($maildata['email'], $subject, $body,"From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
				$body = '';
				$userdata = '';
				$sendcount++;	
				$main_content.="
				<tr>
					<td width=\"210\" bgcolor=\"#FFFFFF\">".$text_mailsentto."</td>
					<td width=\"300\" bgcolor=\"#FFFFFF\">".$maildata['email']."</td>
					<td width=\"241\" bgcolor=\"#FFFFFF\">V</td>
				</tr>";
				}
			}
	
		$main_content.="
		<tr>
			<td height=\"28\" bgcolor=\"#FFFFFF\" colspan=\"3\">".$sendcount." ".$text_mailssendto." ".$whatholder."</td>
		</tr>
		</table>";
		
		/// Template 
		if(!file_exists($file))
			{echo "The template ".$file." does not exist."; exit;}
		$fp1=fopen($file,"r");  
		$zeile=fread ($fp1, filesize ($file));
		include("template.php");
		echo $zeile;
		exit;
		}
	}

$main_content="
<form name=\"form1\" method=\"post\" action=\"index.php?do=newsletter\">
<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
	<tr>
		<td height=\"35\" colspan=\"3\" bgcolor=\"#FFFFFF\" class=\"top\"><strong class=\"heading\">".$text_newsletter."</strong> ".$message."</td>
	</tr>
	<tr>
		<td width=\"140\" bgcolor=\"#FFFFFF\">".$text_subject."</td>
		<td width=\"370\" align=\"center\" bgcolor=\"#FFFFFF\"><input type=\"text\" name=\"subject\" id=\"subject\"  class=\"inputs3\" value=\"".html_special_chars (stripslashes ($subject))."\"></td>
		<td width=\"361\" bgcolor=\"#FFFFFF\"><span class=\"error\">".$error10."</span> ".$text_nwlexp_subject."</td>
	</tr>
	 <tr>
		<td bgcolor=\"#FFFFFF\">".$text_message."</td>
		<td align=\"center\" bgcolor=\"#FFFFFF\"><textarea name=\"body\" id=\"body\" class=\"textarea3\">".html_special_chars (stripslashes ($bodymessage))."</textarea></td>
		<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error11."</span> ".$text_nwlexp_message."</td>
	</tr>		 
	<tr>
		<td bgcolor=\"#FFFFFF\">".$text_sendmailto."</td>
		<td bgcolor=\"#FFFFFF\" colspan=\"2\">
		<select name=\"what\">
		<option value=\"all\">".$text_allusers."</option>
		<option value=\"active\">".$text_activeusers."</option>
		<option value=\"inactive\">".$text_inactiveusers."</option>
		<option value=\"new\">".$text_newusers."</option>
		<option value=\"valid\">".$text_validuders."</option>
		<option value=\"invalid\">".$text_invalidusers."</option>
		<option value=\"choose\">".$text_chooseuser."</option>
		</select>
	</td>
	</tr>
	<tr>
		<td bgcolor=\"#FFFFFF\">&nbsp;</td>
		<td height=\"42\" colspan=\"2\" bgcolor=\"#FFFFFF\"><input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\"> <input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\"></td>
	</tr>
</table>
</form>";

/// Template 
if(!file_exists($file))
	{echo "The template ".$file." does not exist."; exit;}
$fp1=fopen($file,"r");  
$zeile=fread ($fp1, filesize ($file));
include("template.php");
echo $zeile;
exit;
?>