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/top100-sexnetzwerk/admin/config.php
<?php
############################################
### Top-XL - Topsite Configuration File config.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;}

$action = !empty ($_GET["action"]) ? safety ($_GET["action"]) : '';
$message = '';
$main_content = '';
$checkbanner = '';
$getbanner = '';
$error1 = '';
$error1a = '';
$error2 = '';
$error3 = '';
$error4 = '';
$error5 = '';
$error6 = '';
$error7 = '';
$error8 = '';
$error15 = '';
$error16 = '';
$error18 = '';
$error19 = '';
$error20 = '';
$error20a = '';
$error20b = '';
$error20c = '';
$error20d = '';
$error22 = '';
$error21 = '';
$error23 = '';
$error24 = '';
$error25 = '';
$error26 = '';
$error27 = '';
$error28 = '';
$error30 = '';
$error30 = '';
$error31 = '';
$newaddrow = '';
$newaddcode = '';
$rowsthrou = '';

/**
* delete promotial
*/
if ($action=="deletepromotial")
	{
	if (!empty ($_GET["id"]) && is_numeric ($_GET["id"]))
		{$db -> query ("DELETE FROM ".$topxl_promotial_table." WHERE row='".$_GET["id"]."'");}

	header ("location: index.php?do=config&action=promotial");
	}

/**
* promotial
*/
if ($action=="promotial")
	{
	# post -> save changes
	if (!empty ($_POST['submit']))
		{
		# new promotial row
		$newaddrow = !empty ($_POST["newaddrow"]) ? $_POST["newaddrow"] : '';
		$newaddcode = !empty ($_POST["newaddcode"]) ? $_POST["newaddcode"] : '';

		if (!empty ($newaddrow) || !empty ($newaddcode))
			{
			/// schauen, ob addrow schon vorhanden
			$db -> query ("SELECT row FROM ".$topxl_promotial_table." WHERE row='".addslashes ($newaddrow)."'");
			$rowcheckrow = $db -> fetch ();
			if (!empty ($newaddrow) && $rowcheckrow['row'] != $newaddrow and is_numeric($newaddrow))
				{
				/// wenn nicht vorhanden, in DB schreiben
				$db -> query ("INSERT INTO ".$topxl_promotial_table." SET row='".$newaddrow."',code='".addslashes ($newaddcode)."'");
				$newaddrow = '';
				$newaddcode = '';
				}
		
			else
				{
				$error30 = $messagedoubleentry;
				$message = $messageerror;
				}
			}

		# promotial rows
		$rowsthrou = !empty ($_POST["rowsthrou"]) ? safety (substr(trim($_POST["rowsthrou"]), 0, -1)) : '';
		$rowsthrou=explode(",",$rowsthrou);
		$max=(count($rowsthrou)-1);
		for ($i= 0; $i<=$max; $i++) 
			{
			$rowspost=$rowsthrou[$i];
			$codespost="addcode_".$rowspost;
			$addcode=!empty ($_POST[$codespost]) ? $_POST[$codespost] : '';
			$db -> query ("UPDATE ".$topxl_promotial_table." SET code='".addslashes ($addcode)."' where row='".addslashes ($rowspost)."'");
			$message = $messageupdate;
			unset($addcode);
			}

		# show ads
		$config['showadds'] = !empty ($_POST["showadds"]) ? $_POST["showadds"] : '';
		if ($config['showadds']!="yes" && $config['showadds']!="no")
			{$config['showadds']=="no";}
		$db -> query ("UPDATE ".$topxl_admin_table." SET showadds='".addslashes ($config['showadds'])."'");
		$message=$messageupdate;

		
		# row begin/end
		$config['addcodeend'] = !empty ($_POST["addcodeend"]) ? $_POST["addcodeend"] : '';
		$config['addcodebegin'] = !empty ($_POST["addcodebegin"]) ? $_POST["addcodebegin"] : '';	
		$db -> query ("UPDATE ".$topxl_admin_table." SET addcodebegin='".addslashes ($config['addcodebegin'])."',addcodeend='".addslashes ($config['addcodeend'])."'");
		$message=$messageupdate;
		
		# mail
		$config['mailpromo'] = !empty ($_POST["mailpromo"]) ? safety ($_POST["mailpromo"]) : '';
		$db -> query ("UPDATE ".$topxl_admin_table." SET mailpromo='".$config['mailpromo']."'");
		$config['mailpromo'] = stripslashes ($config['mailpromo']);
		$message=$messageupdate;
		}

	$main_content="
	
	<script language=\"javascript\" type=\"text/javascript\">
	var newaddcode = '".$stanaddcode."';
	var addcodebegin = '".$stanaddcodebegin."';
	var addcodeend = '".$stanaddcodeend."';
	function stancode (what)
		{document.getElementById(what).value = (what == 'newaddcode' ? newaddcode : (what == 'addcodebegin' ? addcodebegin : addcodeend));}
	</script>
	
	
	<form action=\"index.php?do=config&action=promotial\" method=\"post\">
	<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_topsiteconfiguration."</strong> ".$message."</td>
		</tr>
		<tr>
			<td height=\"22\" colspan=\"3\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong><span class=\"blacklink\">".$text_commerce."</span></strong></a></td>
		</tr>		
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"175\">".$text_showadds."</td>
			<td height=\"35\" colspan=\"2\" bgcolor=\"#FFFFFF\" class=\"top\" style=\"padding:0px;\">
				<table width=\"698\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
					<tr>
						<td bgcolor=\"#FFFFFF\" width=\"50\">
						<select name=\"showadds\">
						<option value=\"yes\"";
						if ($config['showadds']=="yes")
							{$main_content .= " selected";}
						$main_content .= ">".$text_yes."</option>
						<option value=\"no\"";
						if ($config['showadds']=="no")
							{$main_content .= " selected";}
						$main_content .= ">".$text_no."</option>
						</select>	
						</td>
						<td bgcolor=\"#FFFFFF\" width=\"671\" style=\"border-left:1px solid #CCCCCC;\">".$text_shouldadds."</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td bgcolor=\"#FFFFFF\" colspan=\"2\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr>
		<tr>
			<td height=\"35\" colspan=\"3\" bgcolor=\"#E4E4E4\" class=\"top\"><strong class=\"heading\">".$text_edithtmlcode."</strong></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"175\"><strong>".$text_addseachxline."</strong></td>
			<td bgcolor=\"#FFFFFF\" width=\"606\"><strong>".$text_htmlforline."</strong></td>
			<td bgcolor=\"#FFFFFF\" width=\"100\"><strong>".$text_delete."</strong></td>
		</tr>";
		$rowmarker=0;

		$rowsthrou = '';

		$db -> query ("SELECT * FROM ".$topxl_promotial_table." ORDER BY row ASC");

		while ($codegetrow = $db -> fetch ())
			{
			$rowsthrou .= $codegetrow['row'].",";
			
			$rowmarker++;
			if ($rowmarker==2)
				{
				$tdbgcolor="bgcolor=\"#F7F7F7\"";
				$rowmarker=0;
				}

			else
				{$tdbgcolor="bgcolor=\"#FFFFFF\"";}

			$main_content .= " 
			<tr>
				<td height=\"22\" ".$tdbgcolor." align=\"center\">".$codegetrow['row']."</td>
				<td ".$tdbgcolor.">
				<textarea name=\"addcode_".$codegetrow['row']."\" id=\"addcode_".$codegetrow['row']."\" class=\"textarea4\">".html_special_chars (stripslashes ($codegetrow['code']))."</textarea> 
				</td>
				<td ".$tdbgcolor."><a href=\"index.php?do=config&action=deletepromotial&id=".$codegetrow['row']."\">".$text_del."</a>
				</td>
			</tr>";
			}

		$main_content .= "
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			</td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			<input type=\"hidden\" name=\"rowsthrou\" value=\"".$rowsthrou."\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
			<td bgcolor=\"#FFFFFF\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr>
		<tr>
			<td height=\"35\" colspan=\"3\" bgcolor=\"#E4E4E4\" class=\"top\"><strong class=\"heading\">".$text_addnewrow."</strong></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"><strong>".$text_createnewrow."</strong></td>
			<td bgcolor=\"#FFFFFF\"><strong>".$htmlnewrow."</strong> <span class=\"error\">".$error30."</span></td>
			<td bgcolor=\"#FFFFFF\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"center\">
			<input name=\"newaddrow\" type=\"text\" id=\"newaddrow\" style=\"width:30px;\" value=\"".$newaddrow."\" maxlength=\"4\">
			</td>
			<td bgcolor=\"#FFFFFF\">
			<textarea name=\"newaddcode\" id=\"newaddcode\" class=\"textarea4\">".html_special_chars (stripslashes ($newaddcode))."</textarea> 
			<span class=\"error\">".$error16."</span>
			</td>
			<td bgcolor=\"#FFFFFF\"><a href=\"javascript:stancode('newaddcode')\">".$text_includestandard."</a>
		</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
			<td bgcolor=\"#FFFFFF\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr> 
		<tr>
			<td height=\"35\" colspan=\"3\" bgcolor=\"#E4E4E4\" class=\"top\"><strong class=\"heading\">".$text_begineachline."</strong></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"175\"></td>
			<td bgcolor=\"#FFFFFF\" width=\"606\">".$text_beginlineendtable."</td>
			<td bgcolor=\"#FFFFFF\" width=\"100\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			<textarea name=\"addcodebegin\" id=\"addcodebegin\" class=\"textarea5\">".$config['addcodebegin']."</textarea></td>
			<td bgcolor=\"#FFFFFF\"><a href=\"javascript:stancode('addcodebegin')\">".$text_includestandard."</a>
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"175\"></td>
			<td bgcolor=\"#FFFFFF\" width=\"606\">".$text_endlineendtable."</td>
			<td bgcolor=\"#FFFFFF\" width=\"100\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			<textarea name=\"addcodeend\" id=\"addcodeend\" class=\"textarea5\">".$config['addcodeend']."</textarea> 
			</td>
			<td bgcolor=\"#FFFFFF\"><a href=\"javascript:stancode('addcodeend')\">".$text_includestandard."</a>
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			<input type=\"hidden\" name=\"rowsthrou\" value=\"".$rowsthrou."\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
			<td bgcolor=\"#FFFFFF\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr> 
		<tr>
			<td height=\"35\" colspan=\"3\" bgcolor=\"#E4E4E4\" class=\"top\"><strong class=\"heading\">".$text_comerceinmail."</strong></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			<textarea name=\"mailpromo\" id=\"mailpromo\" class=\"textarea4\">".html_special_chars (stripslashes ($config['mailpromo']))."</textarea> 
			</td>
			<td bgcolor=\"#FFFFFF\"></td>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_exp_mailpromo."</td>
			<td bgcolor=\"#FFFFFF\"></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			<input type=\"hidden\" name=\"rowsthrou\" value=\"".$rowsthrou."\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
			<td bgcolor=\"#FFFFFF\"></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;
	}

/**
* reciprocal
*/
if ($action=="reciprocal")
	{
	$what = !empty ($_GET["what"]) ? safety($_GET["what"]) : '';
	
	# post -> save changes
	if (!empty ($_POST['submit']))
		{
		$reftype = $config['reftype'];
		$config['linktitle'] = !empty ($_POST["linktitle"]) ? safety ($_POST["linktitle"]) : '';
		$config['topbannerurl'] = !empty ($_POST["topbannerurl"]) ? safety ($_POST["topbannerurl"]) : '';
		$config['topbannerurla'] = !empty ($_POST["topbannerurla"]) ? safety ($_POST["topbannerurla"]) : '';
		$config['topbannerurlb'] = !empty ($_POST["topbannerurlb"]) ? safety ($_POST["topbannerurlb"]) : '';
		$config['topbannerurlc'] = !empty ($_POST["topbannerurlc"]) ? safety ($_POST["topbannerurlc"]) : '';
		$config['topbannerurld'] = !empty ($_POST["topbannerurld"]) ? safety ($_POST["topbannerurld"]) : '';
		$config['reftype'] = !empty ($_POST["reftype"]) ? safety ($_POST["reftype"]) : '';
		$config['recicodetext'] = !empty ($_POST["recicodetext"]) ? $_POST["recicodetext"] : '';
		$config['recicodebanner'] = !empty ($_POST["recicodebanner"]) ? $_POST["recicodebanner"] : '';
		$sqlholder = '';
		
		if (empty ($config['linktitle']) or strlen($config['linktitle']) > 60)
			{$error18=$errortext18;}

		if ($reftype != $config['reftype'])
			{
			if ($config['reftype']=="textlink")
				{$checkbanner="yes";}
			else 
				{$getbanner="yes";}
			}

		if (($config['reftype']=="banner" or $config['reftype']=="textban" or $checkbanner=="yes") and $getbanner!="yes")
			{
			$check=bannercheck($config['topbannerurl'],$url_protocols);
			if($check==1)
				{$error20=$errortext5;}
			if($check==2)
				{$error20=$errortext5b;}
			if($check==3)
				{$error20=$errortext5a;}
			if($config['topbannerurla']!="")
				{
				$check=bannercheck($config['topbannerurla'],$url_protocols);
				if($check==1)
					{$error20a=$errortext5;}
				if($check==2)
					{$error20a=$errortext5b;}
				if($check==3)
					{$error20a=$errortext5a;}
				}
			if($config['topbannerurlb']!="")
				{
				$check=bannercheck($config['topbannerurlb'],$url_protocols);
				if($check==1)
					{$error20b=$errortext5;}
				if($check==2)
					{$error20b=$errortext5b;}
				if($check==3)
					{$error20b=$errortext5a;}
				}
			if($config['topbannerurlc']!="")
				{
				$check=bannercheck($config['topbannerurlc'],$url_protocols);
				if($check==1)
					{$error20c=$errortext5;}
				if($check==2)
					{$error20c=$errortext5b;}
				if($check==3)
					{$error20c=$errortext5a;}
				}
			if($config['topbannerurld']!="")
				{
				$check=bannercheck($config['topbannerurld'],$url_protocols);
				if($check==1)
					{$error20d=$errortext5;}
				if($check==2)
					{$error20d=$errortext5b;}
				if($check==3)
					{$error20d=$errortext5a;}
				}
			$sqlholder=",topbannerurl='".$config['topbannerurl']."',topbannerurla='".$config['topbannerurla']."',topbannerurlb='".$config['topbannerurlb']."',topbannerurlc='".$config['topbannerurlc']."',topbannerurld='".$config['topbannerurld']."'";	
			}
		
		if(strpos ($config['recicodetext'], "{clickevent}") === false)
			{$error27=$errortext22;}

		if(strpos ($config['recicodebanner'], "{clickevent}") === false)
			{$error28=$errortext22;}

		if (!empty ($error18) || !empty ($error20) || !empty ($error20a) || !empty ($error20b) || !empty ($error20c) || !empty ($error20d) || !empty ($error27) || !empty ($error28))
			{$message=$messageerror;}

		else
			{$db -> query ("UPDATE ".$topxl_admin_table." SET linktitle='".$config['linktitle']."',reftype='".$config['reftype']."',recicodebanner='".addslashes ($config['recicodebanner'])."',recicodetext='".addslashes ($config['recicodetext'])."'".$sqlholder);}
		}
	
	if ($getbanner == "yes")
		{		
		$db -> query ("SELECT * FROM ".$topxl_admin_table."");
		$data = $db -> fetch ();

		$config['topbannerurl'] = $data['topbannerurl'];
		$config['topbannerurla'] = $data['topbannerurla'];
		$config['topbannerurlb'] = $data['topbannerurlb'];
		$config['topbannerurlc'] = $data['topbannerurlc'];
		$config['topbannerurld'] = $data['topbannerurld'];
		}

	$main_content = "
	<form action=\"index.php?do=config&action=reciprocal\" method=\"post\">
	<script language=\"javascript\" type=\"text/javascript\">
	var textstan = '".$stanrecitext."';
	var bannerstan = '".$stanrecibanner."';
	function stancode (what)
		{document.getElementById(what).value = (what == 'recicodebanner' ? bannerstan : textstan);}
	</script>
	<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_topsiteconfiguration."</strong> ".$message."</td>
		</tr>
		<tr>
			<td height=\"22\" colspan=\"3\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong><span class=\"blacklink\">".$text_reftype."</span></strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
		</tr>
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"135\">".$text_reftype."</td>
			<td bgcolor=\"#FFFFFF\" width=\"210\">
			<select name=\"reftype\">
			<option value=\"textlink\"";
			if ($config['reftype']=="textlink")
				{$main_content .= " selected";}
			$main_content .= ">".$text_textlink."</option>
			<option value=\"banner\"";
			if ($config['reftype']=="banner")
				{$main_content .= " selected";}
			$main_content .= ">".$text_banner."</option>
			<option value=\"textban\"";
			if ($config['reftype']=="textban")
				{$main_content .= " selected";}
			$main_content .= ">".$text_textban."</option>
			</select>
			</td>
			<td bgcolor=\"#FFFFFF\" width=\"525\">".$text_exp_reftype."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_topsitelinktitle."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"linktitle\" type=\"text\" class=\"inputs\" id=\"linktitle\" value=\"".html_special_chars (stripslashes ($config['linktitle']))."\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error18."</span> ".$text_exp_topsitelinktitle."</td>
		</tr>";
		if ($config['reftype']=="banner" or $config['reftype']=="textban")
			{
			$main_content .= "
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_topbannerurl." 1</td>
				<td bgcolor=\"#FFFFFF\">
				<input name=\"topbannerurl\" type=\"text\" class=\"inputs\" id=\"topbannerurl\" value=\"".html_special_chars (stripslashes ($config['topbannerurl']))."\">				
				</td>
				<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error20."</span> ".$text_exp_topbannerurl."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_topbannerurl." 2</td>
				<td bgcolor=\"#F7F7F7\">
				<input name=\"topbannerurla\" type=\"text\" class=\"inputs\" id=\"topbannerurla\" value=\"".html_special_chars (stripslashes ($config['topbannerurla']))."\">				
				</td>
				<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error20a."</span> ".$text_exp_topbannerurl."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_topbannerurl." 3</td>
				<td bgcolor=\"#FFFFFF\">
				<input name=\"topbannerurlb\" type=\"text\" class=\"inputs\" id=\"topbannerurlb\" value=\"".html_special_chars (stripslashes ($config['topbannerurlb']))."\">				
				</td>
				<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error20b."</span> ".$text_exp_topbannerurl."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_topbannerurl." 4</td>
				<td bgcolor=\"#F7F7F7\">
				<input name=\"topbannerurlc\" type=\"text\" class=\"inputs\" id=\"topbannerurlc\" value=\"".html_special_chars (stripslashes ($config['topbannerurlc']))."\">				
				</td>
				<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error20c."</span> ".$text_exp_topbannerurl."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_topbannerurl." 5</td>
				<td bgcolor=\"#FFFFFF\">
				<input name=\"topbannerurld\" type=\"text\" class=\"inputs\" id=\"topbannerurld\" value=\"".html_special_chars (stripslashes ($config['topbannerurld']))."\">				
				</td>
				<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error20d."</span> ".$text_exp_topbannerurl."</td>
			</tr>
			";
			}
		$main_content .= "
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
			<td bgcolor=\"#FFFFFF\"></td>
		</tr>
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr> 
		<tr>
			<td height=\"35\" bgcolor=\"#E4E4E4\" colspan=\"3\" clas=\"top\"><strong class=\"heading\">".$text_edithtmlcode1."</strong>
			</td>
		</tr>
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\" style=\"padding:0px;\">
				<table width=\"872\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
					<tr>
						<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"134\" style=\"border-bottom:1px solid #CCCCCC;\">
						".$text_backlinkcode." ".$text_textlink."<br><img src=\"../img/spacer.gif\" width=\"124\" height=\"1\">
						</td>
						<td bgcolor=\"#FFFFFF\" width=\"605\" style=\"border-left:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;\">
						<span class=\"error\">".$error27."</span>
						<textarea name=\"recicodetext\" id=\"recicodetext\" class=\"textarea5\">".html_special_chars (stripslashes ($config['recicodetext']))."</textarea> 
						</td>
						<td bgcolor=\"#FFFFFF\" width=\"133\" style=\"border-left:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;\">
						<a href=\"javascript:stancode('recicodetext')\">".$text_includestandard."</a>
						</td>
					</tr>
					<tr>
						<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_backlinkcode." ".$text_banner."</td>
						<td bgcolor=\"#F7F7F7\" style=\"border-left:1px solid #CCCCCC;\">
						<span class=\"error\">".$error28."</span>
						<textarea name=\"recicodebanner\" id=\"recicodebanner\" class=\"textarea5\">".html_special_chars (stripslashes ($config['recicodebanner']))."</textarea>
						</td>
						<td bgcolor=\"#FFFFFF\" style=\"border-left:1px solid #CCCCCC;\">
						<a href=\"javascript:stancode('recicodebanner')\">".$text_includestandard."</a>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"><img src=\"../img/spacer.gif\" width=\"125\" height=\"1\"></td>
			<td bgcolor=\"#FFFFFF\" colspan=\"2\" class=\"small\">
			<strong>".$text_holderincode."</strong><br>
			<strong>{clickevent}:</strong> ".$text_onmdhitscount." 
			</td>
		</tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\"></td>
			<td bgcolor=\"#F7F7F7\" colspan=\"2\" class=\"small\">
			<strong>".$text_homderoptional."</strong><br>
			<strong>{linktitle}:</strong> ".$text_titeloflinks."/".$text_reftype."/".$text_topsitelinktitle."<br>
			<strong>{topsiteurl}:</strong> ".$text_urloflist."/".$text_settings."/".$text_topsiteurl."<br>
			<strong>{topsitebannerurl}:</strong> ".$text_thebanner."/".$text_reftype."/ - ".$text_topbannerurl."<br>
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td bgcolor=\"#FFFFFF\" colspan=\"2\">
			<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;
	}

/**
* Template
*/
if ($action=="look")
	{
	#post -> save changes
	if (!empty ($_POST['submit']))
		{
		$config['memcontbwidth'] = !empty ($_POST["memcontbwidth"]) && is_numeric ($_POST["memcontbwidth"]) ? safety ($_POST["memcontbwidth"]) : '487';
		$config['design'] = !empty ($_POST["design"]) ? safety ($_POST["design"]) : '';
	
		if (empty ($config['memcontbwidth']) || (!empty ($config['memcontbwidth']) && !is_numeric ($config['memcontbwidth'])))
			{
			$error26 = $text_notnumeric;
			$message = $messageerror;
			}
	
		if (empty ($error26))
			{
			$db -> query ("UPDATE ".$topxl_admin_table." SET memcontbwidth='".$config['memcontbwidth']."',design='".$config['design']."'");
			$message = $messageupdate;
			}
		}

	$alldesigsnarray=get_design_file();
	$max=count($alldesigsnarray);
	$designform="<select name=\"design\">";

	if ($max>1)
		{
		for($i=0;$i<$max;$i++)
			{
			$designform.="<option";
			if ($config['design']==$alldesigsnarray[$i])
				{$designform.=" selected";}
			$designform.=">".$alldesigsnarray[$i]."</option>";		
			}
		}

	else
		{$designform.="<option>".$alldesigsnarray."</option>";}

	$designform.="</select>";
$main_content .= "
	<form action=\"index.php?do=config&action=look\" method=\"post\">
	<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_topsiteconfiguration."</strong> ".$message."</td>
		</tr>
		<tr>
			<td height=\"22\" colspan=\"3\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong><span class=\"blacklink\">".$text_optical."</span></strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td>
		</tr>
		<tr>
			<td width=\"165\" height=\"22\" bgcolor=\"#FFFFFF\">".$text_choose_design."</td>
			<td width=\"70\" bgcolor=\"#FFFFFF\">".$designform."</td>
			<td width=\"653\" bgcolor=\"#FFFFFF\">".$text_exp_choose_design."</td>
		</tr>
		<tr>
			<td width=\"165\" height=\"22\" bgcolor=\"#F7F7F7\">".$text_memtablewidth."</td>
			<td width=\"70\" bgcolor=\"#F7F7F7\">
			<input name=\"memcontbwidth\" type=\"text\" class=\"inputs\" id=\"memcontbwidth\" value=\"".$config['memcontbwidth']."\" style=\"width:70px;\">				
			</td>
			<td width=\"653\" bgcolor=\"#F7F7F7\"><span class=\"error\">".$error26."</span> ".$text_exp_memtablewidth."</td>
		</tr>
		<tr>
			<td bgcolor=\"#FFFFFF\" colspan=\"3\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\" class=\"small\">".$text_changeallother."</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;
	}

/**
* hits
*/
if ($action=="hits")
	{
	# post -> save changes
	if (!empty ($_POST['submit']))
		{
		$config['hitsneeded'] = !empty ($_POST["hitsneeded"]) ? safety ($_POST["hitsneeded"]) : '';
		$config['resettime'] = !empty ($_POST["resettime"]) ? safety ($_POST["resettime"]) : '';
		$config['ipinblock'] = !empty ($_POST["ipinblock"]) ? safety ($_POST["ipinblock"]) : '';
		$config['ipblock'] = !empty ($_POST["ipblock"]) ? safety ($_POST["ipblock"]) : '';
		$config['referercheckin'] = !empty ($_POST["referercheckin"]) ? safety ($_POST["referercheckin"]) : '';
		$config['referercheckout'] = !empty ($_POST["referercheckout"]) ? safety ($_POST["referercheckout"]) : '';
	
		if (!empty ($config['hitsneeded']))
			{	
			if (!is_numeric($config['hitsneeded']) or !$config['hitsneeded'])
				{$error22=$text_notnumeric;}
			}
		
		else
			{$config['hitsneeded'] = '0';}

		if (empty ($config['resettime']) || !is_numeric($config['resettime']))
			{$error6=$text_notnumeric;}

		if (empty ($config['ipinblock']) || !is_numeric($config['ipinblock']))
			{$error7=$text_notnumeric;}

		if (empty ($config['ipblock']) || !is_numeric($config['ipblock']))
			{$error8=$text_notnumeric;}
	
		if (!empty ($error6) || !empty ($error7) || !empty ($error8) || !empty ($error22))
			{$message=$messageerror;}
	
		else
			{
			$config['resettime'] = $config['resettime']*86400;
			$config['ipinblock'] = $config['ipinblock']*60;
			$config['ipblock'] = $config['ipblock']*60;
			
			$db -> query ("UPDATE ".$topxl_admin_table." SET hitsneeded='".$config['hitsneeded']."',resettime='".$config['resettime']."',ipinblock='".$config['ipinblock']."',ipblock='".$config['ipblock']."',referercheckin='".$config['referercheckin']."',referercheckout='".$config['referercheckout']."'");
			$message = $messageupdate;
			$config['resettime'] = $config['resettime']/86400;
			$config['ipinblock'] = $config['ipinblock']/60;
			$config['ipblock'] = $config['ipblock']/60;
			}
		}

	else
		{
		$config['resettime'] = $config['resettime']/86400;
		$config['ipinblock'] = $config['ipinblock']/60;
		$config['ipblock'] = $config['ipblock']/60;
		}

	$main_content = "
	<form action=\"index.php?do=config&action=hits\" method=\"post\">
	<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
		<tr>
			<td height=\"35\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><strong class=\"heading\">".$text_topsiteconfiguration."</strong> ".$message."</td>
		</tr>
		<tr>
			<td height=\"22\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong><span class=\"blacklink\">".$text_hits."</span></strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
		</tr>
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"155\">".$text_hitsneeded."</td>
			<td bgcolor=\"#FFFFFF\" width=\"50\">
			<input name=\"hitsneeded\" type=\"text\" class=\"inputs\" id=\"hitsneeded\" value=\"".html_special_chars (stripslashes ($config['hitsneeded']))."\" style=\"width:45px;\"></td>
			<td bgcolor=\"#FFFFFF\" width=\"683\"><span class=\"error\">".$error22."</span> ".$text_exp_hitsneeded."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_resettime."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"resettime\" type=\"text\" class=\"inputs\" id=\"resettime\" value=\"".html_special_chars (stripslashes ($config['resettime']))."\" style=\"width:45px;\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error6."</span> ".$text_exp_resettime."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_ipblockin."</td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"ipinblock\" type=\"text\" class=\"inputs\" id=\"ipinblock\" value=\"".html_special_chars (stripslashes ($config['ipinblock']))."\" style=\"width:45px;\">				
			</td>
			<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error7."</span>  ".$text_exp_ipblockin."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_ipblockout."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"ipblock\" type=\"text\" class=\"inputs\" id=\"ipblock\" value=\"".html_special_chars (stripslashes ($config['ipblock']))."\" style=\"width:45px;\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error8."</span> ".$text_exp_ipblockout."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_referercheck_in."</td>
			<td bgcolor=\"#FFFFFF\">
			<select name=\"referercheckin\">
			<option value=\"yes\"";
			if ($config['referercheckin']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['referercheckin']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select>							
			</td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_referercheck_in."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_referercheck_out."</td>
			<td bgcolor=\"#F7F7F7\">
			<select name=\"referercheckout\">
			<option value=\"yes\"";
			if ($config['referercheckout']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['referercheckout']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select>								
			</td>
			<td bgcolor=\"#F7F7F7\">".$text_exp_referercheck_out."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			</td>
			<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"left\" colspan=\"2\">
			<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;
	}

/**
* topsite
*/
if ($action=="anzeige")
	{
	# submit -> save changes
	if (!empty ($_POST['submit']))
		{
		$config['linkspersite'] = !empty ($_POST["linkspersite"]) ? trim (safety ($_POST["linkspersite"])) : '';
		$config['bannerrows'] = !empty ($_POST["bannerrows"]) ? trim (safety ($_POST["bannerrows"])) : '';
		$config['sorting'] = !empty ($_POST["sorting"]) ? trim (safety ($_POST["sorting"])) : '';
		$config['showbanner'] = !empty ($_POST["showbanner"]) ? trim (safety ($_POST["showbanner"])) : '';
		$config['maxsigntitle'] = !empty ($_POST["maxsigntitle"]) ? trim (safety ($_POST["maxsigntitle"])) : '';
		$config['maxsigndesc'] = !empty ($_POST["maxsigndesc"]) ? trim (safety ($_POST["maxsigndesc"])) : '';
		$config['inactivetime'] = !empty ($_POST["inactivetime"]) ? trim (safety ($_POST["inactivetime"])) : '';
		$config['marknew'] = !empty ($_POST["marknew"]) ? trim (safety ($_POST["marknew"])) : '';
		$config['newtime'] = !empty ($_POST["newtime"]) ? trim (safety ($_POST["newtime"])) : '';
		$config['staticbannersize'] = !empty ($_POST["staticbannersize"]) ? trim (safety ($_POST["staticbannersize"])) : '';
		$config['bannerwidth'] = !empty ($_POST["bannerwidth"]) ? trim (safety ($_POST["bannerwidth"])) : '';
		$config['bannerheight'] = !empty ($_POST["bannerheight"]) ? trim (safety ($_POST["bannerheight"])) : '';
		$config['onlyactive'] = !empty ($_POST["onlyactive"]) ? safety ($_POST["onlyactive"]) : '';
	
		if (empty ($config['linkspersite']) || !is_numeric($config['linkspersite']))
			{$error3=$text_notnumeric;}

		if (!empty ($config['bannerrows']))
			{	
			if (!is_numeric($config['bannerrows']) or !$config['bannerrows'])
				{$error4=$text_notnumeric;}
			}
		
		else
			{$config['bannerrows'] = '0';}

		if (empty ($config['inactivetime']) || !is_numeric($config['inactivetime']))
			{$error15=$text_notnumeric;}

		if (empty ($config['newtime']) || !is_numeric($config['newtime']))
			{$error23=$text_notnumeric;}

		if (empty ($config['maxsigntitle']) || !is_numeric($config['maxsigntitle'] ))
			{$error24=$text_notnumeric;}

		if (empty ($config['maxsigndesc']) || !is_numeric($config['maxsigndesc']))
			{$error25=$text_notnumeric;}

		if (empty ($config['bannerwidth']) || !is_numeric($config['bannerwidth']))
			{$error30=$text_notnumeric;}

		if (empty ($config['bannerheight']) || !is_numeric($config['bannerheight']))
			{$error31=$text_notnumeric;}
	
		if (!empty ($error3) || !empty ($error4) || !empty ($error15) || !empty ($error23) || !empty ($error24) || !empty ($error25) || !empty ($error30) || !empty ($error31))
			{$message=$messageerror;}
	
		else
			{
			$config['inactivetime'] = $config['inactivetime']*86400;
			$config['newtime'] = $config['newtime']*86400;
			$db -> query ("UPDATE ".$topxl_admin_table." SET linkspersite='".$config['linkspersite']."',bannerrows='".$config['bannerrows']."',sorting='".$config['sorting']."',showbanner='".$config['showbanner']."',maxsigntitle='".$config['maxsigntitle']."',maxsigndesc='".$config['maxsigndesc']."',inactivetime='".$config['inactivetime']."',marknew='".$config['marknew']."',newtime='".$config['newtime']."',staticbannersize='".$config['staticbannersize']."',bannerwidth='".$config['bannerwidth']."',bannerheight='".$config['bannerheight']."',onlyactive='".$config['onlyactive']."'");
			$message = $messageupdate;
			$config['inactivetime'] = $config['inactivetime']/86400;
			$config['newtime'] = $config['newtime']/86400;
			}
		}
	
	else
		{
		$config['inactivetime'] = $config['inactivetime']/86400;
		$config['newtime'] = $config['newtime']/86400;
		}

	$main_content="
	<form action=\"index.php?do=config&action=anzeige\" method=\"post\">
	<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
		<tr>
			<td height=\"35\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><strong class=\"heading\">".$text_topsiteconfiguration."</strong> ".$message."</td>
		</tr>
		<tr>
			<td height=\"22\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong><span class=\"blacklink\">".$text_anzeige."</span></strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
		</tr>
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr> 
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\" width=\"155\">".$text_linkspersite."</td>
			<td bgcolor=\"#FFFFFF\" width=\"105\">
			<input name=\"linkspersite\" type=\"text\" class=\"inputs\" id=\"linkspersite\" value=\"".html_special_chars (stripslashes ($config['linkspersite']))."\"  style=\"width:95px;\">			
			</td>
			<td bgcolor=\"#FFFFFF\" width=\"628\"><span class=\"error\">".$error3."</span> ".$text_exp_linkspersite."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_sorting."</td>
			<td bgcolor=\"#F7F7F7\">
			<select name=\"sorting\">
			<option value=\"in\"";
			if ($config['sorting']=="in")
				{$main_content .= " selected";}
			$main_content .= ">".$text_hitin."</option>
			<option value=\"out\"";
			if ($config['sorting']=="out")
				{$main_content .= " selected";}
			$main_content .= ">".$text_hitout."</option>
			<option value=\"intotal\"";
			if ($config['sorting']=="intotal")
				{$main_content .= " selected";}
			$main_content .= ">".$text_hitintotal."</option>
			<option value=\"outtotal\"";
			if ($config['sorting']=="outtotal")
				{$main_content .= " selected";}
			$main_content .= ">".$text_hitouttotal."</option>
			</select>
			</td>
			<td bgcolor=\"#F7F7F7\">".$text_exp_sortingoftopsite."</td>
		</tr>		
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_onlyactive."</td>
			<td bgcolor=\"#FFFFFF\">
			<select name=\"onlyactive\">
			<option value=\"yes\"";
			if ($config['onlyactive']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['onlyactive']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select>
			</td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_onlyactive."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_inactivetime."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"inactivetime\" type=\"text\" class=\"inputs\" id=\"inactivetime\" value=\"".html_special_chars (stripslashes ($config['inactivetime']))."\"  style=\"width:95px;\">			
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error15."</span> ".$text_exp_inactivetime."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_marknew."</td>
			<td bgcolor=\"#FFFFFF\">
			<select name=\"marknew\">
			<option value=\"yes\"";
			if ($config['marknew']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['marknew']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select>
			</td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_marknew."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_newtime."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"newtime\" type=\"text\" class=\"inputs\" id=\"newtime\" value=\"".html_special_chars (stripslashes ($config['newtime']))."\" style=\"width:95px;\">
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error23."</span> ".$text_exp_newtime."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_showbanner."</td>
			<td bgcolor=\"#FFFFFF\">
			<select name=\"showbanner\">
			<option value=\"yes\"";
			if ($config['showbanner']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['showbanner']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select>
			</td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_showbanner."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_rowswithbanner."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"bannerrows\" type=\"text\" class=\"inputs\" id=\"bannerrows\" value=\"".html_special_chars (stripslashes ($config['bannerrows']))."\"  style=\"width:95px;\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error4."</span> ".$text_exp_rowswithbanner."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_staticbannersize."</td>
			<td bgcolor=\"#FFFFFF\">
			<select name=\"staticbannersize\">
			<option value=\"yes\"";
			if ($config['staticbannersize']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['staticbannersize']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select>
			</td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_staticbannersize."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_bannerwidth."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"bannerwidth\" type=\"text\" class=\"inputs\" id=\"bannerwidth\" value=\"".html_special_chars (stripslashes ($config['bannerwidth']))."\" style=\"width:95px;\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error30."</span> ".$text_exp_bannerwidth."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_bannerheight."</td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"bannerheight\" type=\"text\" class=\"inputs\" id=\"bannerheight\" value=\"".html_special_chars (stripslashes ($config['bannerheight']))."\" style=\"width:95px;\">				
			</td>
			<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error31."</span> ".$text_exp_bannerheight."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_maxsigntitle."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"maxsigntitle\" type=\"text\" class=\"inputs\" id=\"maxsigntitle\" value=\"".html_special_chars (stripslashes ($config['maxsigntitle']))."\" style=\"width:95px;\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error24."</span> ".$text_exp_maxsigntitle."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_maxsigndesc."</td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"maxsigndesc\" type=\"text\" class=\"inputs\" id=\"maxsigndesc\" value=\"".html_special_chars (stripslashes ($config['maxsigndesc']))."\" style=\"width:95px;\">				
			</td>
			<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error25."</span> ".$text_exp_maxsigndesc."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
			<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"left\" colspan=\"2\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
		</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;
	}

/**
* language
*/
if($action=="language")
	{
	# submit -> save changes
	if (!empty ($_POST['submit']))
		{
		$what = !empty ($_GET["what"]) ? safety ($_GET["what"]) : '';
	
		if($what=="delete")
			{
			$deletelang = !empty ($_POST["deletelang"]) ? safety ($_POST["deletelang"]) : '';
			$config['langs'] = str_replace (",".$deletelang, "", $config['langs']);
			$config['langs'] = str_replace ($deletelang, "", $config['langs']);
			$config['langs'] = str_replace (",,", "", $config['langs']);
			$db -> query ("UPDATE ".$topxl_admin_table." SET langs='".$config['langs']."'");
			}	
	
		else
			{
			$config['stanlang'] = !empty ($_POST["stanlang"]) ? safety ($_POST["stanlang"]) : '';
			$addnewlang = !empty ($_POST["addnewlang"]) ? safety ($_POST["addnewlang"]) : '';
			$newlangs = !empty ($_POST["newlangs"]) ? safety ($_POST["newlangs"]) : '';
			$config['langdetect'] = !empty ($_POST["langdetect"]) ? safety ($_POST["langdetect"]) : 'yes';
			$sqlholder = '';
			if ($addnewlang == "yes")
				{
				if (!empty($newlangs) and $newlangs!=" ")
					{$newlangs = $config['langs'].",".$newlangs."";}	
				$config['langs'] = $newlangs;
				$sqlholder = ",langs='".$config['langs']."'";
				}
			$config['stanlang'] = addslashes ($config['stanlang']);
			$db -> query ("UPDATE ".$topxl_admin_table." SET stanlang='".$config['stanlang']."',langdetect='".$config['langdetect']."'".$sqlholder);
			}
		}

	$newlangs=check_new_lang_files($config['langs']);
	
	$newlangshtml = '';

	if (!empty ($newlangs))
		{
		$newlangshtml="<tr>
				<td bgcolor=\"#F7F7F7\">".$text_new_langs."</td><td bgcolor=\"#F7F7F7\">".$newlangs."</td><td bgcolor=\"#F7F7F7\">
				".$text_exp_new_langs."</td>
				</tr>
				<tr>
				<td bgcolor=\"#FFFFFF\">".$text_add."</td>
				<td bgcolor=\"#FFFFFF\">
				<select name=\"addnewlang\">
			<option value=\"yes\">".$text_yes."</option>
			<option value=\"no\" selected>".$text_no."</option>
			</select><input type=\"hidden\" name=\"newlangs\" value=\"".$newlangs."\"</td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_add."</td>
			</tr>";
		}

	$main_content="
		<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
		<form action=\"index.php?do=config&action=language\" method=\"post\">
			<tr>
				<td height=\"35\" colspan=\"3\" bgcolor=\"#FFFFFF\" class=\"top\"><strong class=\"heading\">".$text_topsiteconfiguration."</strong> ".$message."</td>
			</tr>
			<tr>
				<td height=\"22\" colspan=\"3\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong><span class=\"blacklink\">".$text_language."</span></strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
			</tr>
			<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr>
			".$newlangshtml."
			<tr>
<td bgcolor=\"#FFFFFF\">".$text_langdetect_active."</td><td bgcolor=\"#FFFFFF\">
				<select name=\"langdetect\">
				<option value=\"yes\"";
			if ($config['langdetect']=="yes")
				{$main_content .= " selected";}
			$main_content .= ">".$text_yes."</option>
			<option value=\"no\"";
			if ($config['langdetect']=="no")
				{$main_content .= " selected";}
			$main_content .= ">".$text_no."</option>
			</select></td>
			<td bgcolor=\"#FFFFFF\">
				".$text_exp_langdetect_active."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#F7F7F7\" width=\"155\">".$text_language."</td>
				<td bgcolor=\"#F7F7F7\" width=\"50\">
				<select name=\"stanlang\">";
				$config['langs']=explode(",",$config['langs']);
				$max=count($config['langs']);
				for($i=0;$i<$max;$i++)
					{
					$main_content .="<option value=\"".$config['langs'][$i]."\"";
					if ($config['stanlang']==$config['langs'][$i])
						{$main_content .= ' selected="selected"';}
					$main_content .= ">".$config['langs'][$i]."</option>";
					}
				$main_content .="
				</select>		
				</td>
				<td bgcolor=\"#F7F7F7\" width=\"683\">".$text_exp_language."</td>
			</tr>

			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
				<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"left\" colspan=\"2\">
				<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
				<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
				</td>
			</tr>
		  </form>
			<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr>
			<form action=\"index.php?do=config&action=language&what=delete\" method=\"post\">
			<tr>
<td bgcolor=\"#FFFFFF\">".$text_delete_lang."</td><td bgcolor=\"#FFFFFF\">
				<select name=\"deletelang\"><option value=\"no\">".$text_no."</option>";
				for($i=0;$i<$max;$i++)
					{
					if ($config['langs'][$i]!=$config['stanlang'])
						{
						$db -> query ("SELECT lang FROM ".$topxl_user_table." WHERE lang='".$config['langs'][$i]."'");
						$main_content .="<option value=\"".$config['langs'][$i]."\">".$config['langs'][$i]." (".$db -> numRows ().")</option>";
						}
					
					}
				$main_content .="
			</select></td>
			<td bgcolor=\"#FFFFFF\">".$text_exp_delete_lang."</td></tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\"></td>
				<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"left\" colspan=\"2\">
				<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
				<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
				</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\" class=\"small\">".$text_exp_lang."</td>
			</tr>
		  </form>
		</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;
	}

/**
* signup
*/
if ($action=="anmeldung")
	{
	#
	if (!empty ($_POST['submit']))
		{
		$config['validatesites'] = !empty ($_POST["validatesites"]) ? safety ($_POST["validatesites"]) : 'yes';
		$config['mailtouser'] = !empty ($_POST["mailtouser"]) ? safety ($_POST["mailtouser"]) : 'yes';
		$config['mailtoadmin'] = !empty ($_POST["mailtoadmin"]) ? safety ($_POST["mailtoadmin"]) : 'yes';
		$config['addperget'] = !empty ($_POST["addperget"]) ? safety ($_POST["addperget"]) : 'no';
		$config['refereraddcheck'] = !empty ($_POST["refereraddcheck"]) ? safety ($_POST["refereraddcheck"]) : 'no';
		$config['addvalicode'] = !empty ($_POST["addvalicode"]) ? safety ($_POST["addvalicode"]) : 'no';
		
		$db -> query ("UPDATE ".$topxl_admin_table." SET validatesites='".$config['validatesites']."',mailtouser='".$config['mailtouser']."',mailtoadmin='".$config['mailtoadmin']."',addperget='".$config['addperget']."',refereraddcheck='".$config['refereraddcheck']."',addvalicode='".$config['addvalicode']."'");
		}

	$main_content="
		<form action=\"index.php?do=config&action=anmeldung\" method=\"post\">
		<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
			<tr>
				<td height=\"35\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><strong class=\"heading\">".$text_topsiteconfiguration."</strong> ".$message."</td>
			</tr>
			<tr>
				<td height=\"22\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong>".$text_settings."</strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong><span class=\"blacklink\">".$text_anmeldung."</span></strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
			</tr>
			<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_validatesites."</td>
				<td bgcolor=\"#FFFFFF\">
				<select name=\"validatesites\">
				<option value=\"yes\"";
				if ($config['validatesites']=="yes")
					{$main_content .= " selected";}
				$main_content .= ">".$text_yes."</option>
				<option value=\"no\"";
				if ($config['validatesites']=="no")
					{$main_content .= " selected";}
				$main_content .= ">".$text_no."</option>
				</select>            				
				</td>
				<td bgcolor=\"#FFFFFF\">".$text_exp_validatesites."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_mailtouser."</td>
				<td bgcolor=\"#F7F7F7\">
				<select name=\"mailtouser\">
				<option value=\"yes\"";
				if ($config['mailtouser']=="yes")
					{$main_content .= " selected";}
				$main_content .= ">".$text_yes."</option>
				<option value=\"no\"";
				if ($config['mailtouser']=="no")
					{$main_content .= " selected";}
				$main_content .= ">".$text_no."</option>
				</select>
				</td>
				<td bgcolor=\"#F7F7F7\">".$text_exp_mailtouser."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_mailtoadmin."</td>
				<td bgcolor=\"#FFFFFF\">
				<select name=\"mailtoadmin\">
				<option value=\"yes\"";
				if ($config['mailtoadmin']=="yes")
					{$main_content .= " selected";}
				$main_content .= ">".$text_yes."</option>
				<option value=\"no\"";
				if ($config['mailtoadmin']=="no")
					{$main_content .= " selected";}
				$main_content .= ">".$text_no."</option>
				</select>			
				</td>
				<td bgcolor=\"#FFFFFF\">".$text_exp_mailtoadmin."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_addperget."</td>
				<td bgcolor=\"#F7F7F7\">
				<select name=\"addperget\">
				<option value=\"yes\"";
				if ($config['addperget']=="yes")
					{$main_content .= " selected";}
				$main_content .= ">".$text_yes."</option>
				<option value=\"no\"";
				if ($config['addperget']=="no")
					{$main_content .= " selected";}
				$main_content .= ">".$text_no."</option>
				</select>			
				</td>
				<td bgcolor=\"#F7F7F7\">".$text_exp_addperget."</td>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_refereraddcheck."</td>
				<td bgcolor=\"#FFFFFF\">
				<select name=\"refereraddcheck\">
				<option value=\"yes\"";
				if ($config['refereraddcheck']=="yes")
					{$main_content .= " selected";}
				$main_content .= ">".$text_yes."</option>
				<option value=\"no\"";
				if ($config['refereraddcheck']=="no")
					{$main_content .= " selected";}
				$main_content .= ">".$text_no."</option>
				</select>			
				</td>
				<td bgcolor=\"#FFFFFF\">".$text_exp_refereraddcheck."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_addvalicode."</td>
				<td bgcolor=\"#F7F7F7\">
				<select name=\"addvalicode\">
				<option value=\"yes\"";
				if ($config['addvalicode']=="yes")
					{$main_content .= " selected";}
				$main_content .= ">".$text_yes."</option>
				<option value=\"no\"";
				if ($config['addvalicode']=="no")
					{$main_content .= " selected";}
				$main_content .= ">".$text_no."</option>
				</select>			
				</td>
				<td bgcolor=\"#F7F7F7\">".$text_exp_addvalicode."</td>
			</tr>
			<tr>
				<td height=\"22\" bgcolor=\"#FFFFFF\">
				</td>
				<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"right\" colspan=\"2\">
				<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;
	}


/**
* config
*/

# post -> save changes
if (!empty ($_POST['submit']))
	{
	$config['adminmail'] = !empty ($_POST["adminmail"]) ? safety ($_POST["adminmail"]) : '';
	$config['adminmail2'] = !empty ($_POST["adminmail2"]) ? safety ($_POST["adminmail2"]) : '';
	$config['topsiteurl'] = !empty ($_POST["topsiteurl"]) ? safety ($_POST["topsiteurl"]) : '';
	$config['filename'] = !empty ($_POST["filename"]) ? safety ($_POST["filename"]) : '';
	$config['topsitename'] = !empty ($_POST["topsitename"]) ? safety ($_POST["topsitename"]) : '';
	$config['kwholder1'] = !empty ($_POST["kwholder1"]) ? safety ($_POST["kwholder1"]) : '';

	if (empty ($config['adminmail']))
		{$error1=$errortext2;}
	elseif (strlen($config['adminmail']) > 255)
		{$error5=$errortext5b;}
	elseif (validateEmail (trim($config['adminmail'])) == false)
		{$error1=$errortext2a;}

	if (empty ($config['adminmail2']))
		{$error1a=$errortext2;}
	elseif (strlen($config['adminmail2']) > 255)
		{$error5=$errortext5b;}
	elseif (validateEmail (trim($config['adminmail2'])) == false)
		{$error1a=$errortext2a;}

	if (empty ($config['topsiteurl']) || !preg_match ("@^".$url_protocols."@", $config['topsiteurl']))
		{$error2=$errortext3;}
	elseif (strlen($config['topsiteurl']) > 255)
		{$error5=$errortext5b;}
	
	if (empty ($config['filename']) || strlen($config['filename']) > 255)
		{$error28=$errortext28;}

	if (empty ($config['topsitename']) || strlen($config['topsitename']) > 150)
		{$error19=$errortext19;}	

	if (empty ($config['kwholder1']) || preg_match ("@[^a-zA-Z0-9\-]@", $config['kwholder1']))
		{$error21=$errortext21;}
	elseif (strlen($config['kwholder1']) > 255)
		{$error5=$errortext5b;}

	if (!empty ($error1) || !empty ($error1a) || !empty ($error2) || !empty ($error5) || !empty ($error6) || !empty ($error7) || !empty ($error8) || !empty ($error19) || !empty ($error21) || !empty ($error28))
		{$message=$messageerror;}

	else
		{
		$config['filename'] .= ".php";
		$config['filename'] = preg_replace ("@\.html|\.htm|\.php3|\.php4|\.php5@i", "", $config['filename']);
		$db -> query ("UPDATE ".$topxl_admin_table." SET adminmail='".$config['adminmail']."',adminmail2='".$config['adminmail2']."',topsiteurl='".$config['topsiteurl']."',filename='".$config['filename']."',topsitename='".$config['topsitename']."',kwholder1='".$config['kwholder1']."'");
		$message.=$messageupdate;
		}
	}

$config['filename']=str_replace(".php","",$config['filename']);

$main_content="
	<form action=\"index.php?do=config\" method=\"post\">
	<table width=\"874\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">
		<tr>
			<td height=\"35\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><strong class=\"heading\">".$text_topsiteconfiguration."</strong> ".$message."</td>
		</tr>
		<tr>
			<td height=\"22\" colspan=\"7\" bgcolor=\"#FFFFFF\" class=\"top\"><a href=\"index.php?do=config\"><strong><span class=\"blacklink\">".$text_settings."</span></strong></a> | <a href=\"index.php?do=config&action=hits\"><strong>".$text_hits."</strong></a> | <a href=\"index.php?do=config&action=anzeige\"><strong>".$text_anzeige."</strong></a> | <a href=\"index.php?do=config&action=language\"><strong>".$text_language."</strong></a> | <a href=\"index.php?do=config&action=look\"><strong>".$text_optical."</strong></a> | <a href=\"index.php?do=config&action=reciprocal\"><strong>".$text_reftype."</strong></a> | <a href=\"index.php?do=config&action=anmeldung\"><strong>".$text_anmeldung."</strong></a> | <a href=\"index.php?do=config&action=promotial\"><strong>".$text_commerce."</strong></a></td>
		</tr>
		<tr><td height=\"22\" bgcolor=\"#FFFFFF\" colspan=\"3\"></td></tr> 
		<tr>
			<td width=\"135\" height=\"22\" bgcolor=\"#FFFFFF\">".$text_adminemail1."</td>
		<td width=\"210\" bgcolor=\"#FFFFFF\">
		<input name=\"adminmail\" type=\"text\" class=\"inputs\" id=\"adminmail\" value=\"".html_special_chars (stripslashes ($config['adminmail']))."\">				
			</td>
			<td width=\"543\" bgcolor=\"#FFFFFF\"><span class=\"error\">".$error1."</span> ".$text_exp_adminemail1."</td>
		</tr>
		<tr>
			<td width=\"135\" height=\"22\" bgcolor=\"#F7F7F7\">".$text_adminemail2."</td>
			<td width=\"210\" bgcolor=\"#F7F7F7\">
			<input name=\"adminmail2\" type=\"text\" class=\"inputs\" id=\"adminmail2\" value=\"".html_special_chars (stripslashes ($config['adminmail2']))."\">				
			</td>
			<td width=\"543\" bgcolor=\"#F7F7F7\"><span class=\"error\">".$error1a."</span> ".$text_exp_adminemail12."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_topsiteurl."</td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"topsiteurl\" type=\"text\" class=\"inputs\" id=\"topsiteurl\" value=\"".html_special_chars (stripslashes ($config['topsiteurl']))."\">				
			</td>
			<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error2."</span> ".$text_exp_topsiteurl."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_filename."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"filename\" type=\"text\" class=\"inputs\" id=\"filename\" value=\"".html_special_chars (stripslashes ($config['filename']))."\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error28."</span> ".$text_exp_filename."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">".$text_topsitename."</td>
			<td bgcolor=\"#FFFFFF\">
			<input name=\"topsitename\" type=\"text\" class=\"inputs\" id=\"topsitename\" value=\"".html_special_chars (stripslashes ($config['topsitename']))."\">				
			</td>
			<td bgcolor=\"#FFFFFF\"><span class=\"error\">".$error19."</span> ".$text_exp_topsitename."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#F7F7F7\">".$text_kwholder1."</td>
			<td bgcolor=\"#F7F7F7\">
			<input name=\"kwholder1\" type=\"text\" class=\"inputs\" id=\"kwholder1\" value=\"".html_special_chars (stripslashes ($config['kwholder1']))."\">				
			</td>
			<td bgcolor=\"#F7F7F7\"><span class=\"error\">".$error21."</span> ".$text_exp_kwholder1."</td>
		</tr>
		<tr>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			</td>
			<td height=\"22\" bgcolor=\"#FFFFFF\" align=\"right\">
			<input name=\"submit\" type=\"submit\" class=\"submitbuton\" value=\"".$text_submit."\">
			<input name=\"reset\" type=\"reset\" class=\"submitbuton\" value=\"".$text_reset."\">
			</td>
			<td height=\"22\" bgcolor=\"#FFFFFF\">
			</td>
		</tr>
	</table>
	</form>";

/// Template 
$config['filename'] .= ".php";
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;
?>