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/members/index.php
<?php 
############################################
### Top-XL - Members index.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
////////////////////////////////////////////
////////////////////////////////////////////
@ini_set ('error_reporting', 0);
@error_reporting (0);
@ini_set ('default_charset', 'utf-8');
header ('Content-Type: text/html; charset=utf-8');

$scriptpath = $_SERVER['DOCUMENT_ROOT'];
include ("../inc/sql.php");
include ("../inc/vars.php");
include ("../inc/functions.php");

$langget = get_lang ($config['stanlang']);
include ("../lang/members-".get_lang_file ($langget, $config['stanlang'], $config['langs'], $config['langdetect']).".php");

$do = !empty (safety ($_GET["do"])) ? safety ($_GET["do"]) : ''; 
$action = !empty ($_GET["action"]) ? safety ($_GET["action"]) : ''; 

$message = '';
$error2 = '';
$error7 = '';
$error1 = '';
$error3 = '';
$error4 = '';
$error5 = '';
$error6 = '';
$error8 = '';
$error9 = '';
$error10 = '';
$error11 = '';

//////////////////////////
//// Validate email
//////////////////////////

if ($do == "validatemail")
	{
	$vid = !empty ($_GET["vid"]) ? safety ($_GET["vid"]) : '';
	$id = !empty ($_GET["id"]) ? safety ($_GET["id"]) : '';

	if (empty ($id) || empty ($vid) || !is_numeric ($id) || !is_numeric ($vid))
		{
		echo "<div align=\"center\"><strong>Input ".$text_notnumeric."</strong></div>";
		exit;
		}

	$db -> query("SELECT * FROM ".$topxl_user_table." WHERE id='".$id."'");
	$row = $db -> fetch ();

	if (!empty ($vid) && $row['validatecode'] == $vid) 
		{
    	$db -> query ("UPDATE ".$topxl_user_table." SET email='".stripslashes ($row['validatemail'])."', validatemail='', validatecode='' WHERE id='".$id."'");
		echo '<div align="center"><strong>'.$text_newmailindb.'</strong></div>';
		}

   else 
		{echo '<div align="center"><strong>'.$text_wrongcodeemail.'</strong></div>';}

	exit;
	}

//////////////////////////
//// Lost Password
//////////////////////////

if ($do == "lost")
	{
	// pass confirmation and new pass aktivation
	if ($action == "passvalidation")
		{
		$id = !empty ($_GET["id"]) ? safety ($_GET["id"]) : '';
		$pvid = !empty ($_GET["pvid"]) ? safety ($_GET["pvid"]) : '';

		if (empty ($pvid) || empty ($id) || !is_numeric ($id) or !is_numeric ($pvid))
			{
			echo "<div align=\"center\"><strong>Input ".$text_notnumeric."</strong></div>";
			exit;
			}

		else
			{
			$db -> query ("SELECT newpass,passvalicode,email FROM ".$topxl_user_table." WHERE id='".$id."'");
			$dbcheckrow = $db -> fetch ();	

			if ($pvid == $dbcheckrow['passvalicode'])
				{
				$db -> query ("UPDATE ".$topxl_user_table." SET pass='".md5 ($dbcheckrow['newpass'])."',newpass='',passvalicode='' WHERE id='".$id."'");

				//// mail mit passwort rausschicken
				$body = $text_bodymailwithpass."\n\n".$text_logindata."\n".$text_loginname.": ".$id."\n".$text_pass.": ".$dbcheckrow['newpass']."\n\n".$text_topsitename.": ".$config['topsitename']."\n".$text_topsiteurl.": ".$config['topsiteurl']."\n\n".$config['mailpromo']."\n\n".$commercialmailtext."";
				$body = strip_tags (stripslashes ($body));
				mail ($dbcheckrow['email'], $subjectmailwithpass, $body, "From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
				echo "<div align=\"center\" class=\"updatemessage\">".$text_newpassactive2."</div>";
				}

			else
				{echo "<div align=\"center\" class=\"error\">".$text_wrongcodepass."</div>";}
			}

		exit;
		}

	# lost pass
	elseif ($action=="generate")
		{
		if ($config['referercheckin'] == "yes" && !preg_match ('@'.$config['topsiteurl'].'/members/index.php@i', $_SERVER["HTTP_REFERER"]))
			{
			echo "No valid referer";
			exit;
			}

		else 
			{
			$id = !empty ($_POST["id"]) ? safety ($_POST["id"]) : '';
			$email = !empty ($_POST["email"]) ? safety ($_POST["email"]) : '';

			if (empty ($email))
				{$error2=$errortext2."<br>";}
			elseif (validateEmail (trim($email)) == false)
				{$error2=$errortext2a."<br>";}
			elseif (strlen($email) > 255)
				{$error2=$errortext5b;}

			if (empty ($id) || !is_numeric($id))
				{$error7=$text_id." ".$text_notnumeric."<br>";}

			if (!empty ($error2) || !empty ($error7))
				{$message=$messageerror;}

			else
				{
				$db -> query ("SELECT email,id FROM ".$topxl_user_table." WHERE email='".$email."' and id='".$id."'");
				$dbcheckrow = $db -> fetch ();	

				if (!empty ($dbcheckrow['email']))
					{
					/// passwort generieren und mail schreiben
					$signs="23456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
					srand ((double)microtime()*1000000);
					$pass = '';

					for ($i= 0; $i<=8; $i++) 
						{$pass .= substr($signs,(rand()%(strlen ($signs))), 1);}

					$passvalicode = rand(1000000, 9999999);

					$db -> query ("UPDATE ".$topxl_user_table." SET newpass='".$pass."',passvalicode='".$passvalicode."' WHERE id='".$id."'");

					////mail scheiben
					$body = $text_bodypassvalimail."\n\n".$config['topsiteurl']."/members/index.php?do=lost&action=passvalidation&pvid=".$passvalicode."&id=".$id."\n\n".$text_topsitename.": ".$config['topsitename']."\n".$text_topsiteurl.": ".$config['topsiteurl']."\n\n".$config['mailpromo']."\n\n".$commercialmailtext;
					$body = strip_tags ($body);
					mail ($dbcheckrow['email'], $subjecttextpasschange, $body,"From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
					$message="<div align=\"center\" class=\"updatemessage\">".$text_newpassactive."</div>";
					echo $message;
					exit;
					}

				else
					{$message=$messageerror." <br><span class=\"error\">".$text_accountnotfound."</span>";}
				}
			}
		}

	/// Template
	if (!file_exists("../html/".$config['design']."/members/lost.html"))
		{echo "The template file html/".$config['design']."/members/lost.html does not exist.";exit;}
	$fp1=fopen("../html/".$config['design']."/members/lost.html","r"); // Datei öffnen 
	$zeile = fread ($fp1, filesize ("../html/".$config['design']."/members/lost.html"));
	$zeile = str_replace ("{text_lostpassword}", $text_lostpassword, $zeile);
	$zeile = str_replace ("{text_exp_lostpassword}", $text_exp_lostpassword, $zeile);
	$zeile = str_replace ("{text_id}", $text_id, $zeile);
	$zeile = str_replace ("{text_email}", $text_email, $zeile);
	$zeile = str_replace ("{text_submit}", $text_submit, $zeile);
	$zeile = str_replace ("{error2}", $error2, $zeile);
	$zeile = str_replace ("{error7}", $error7, $zeile);
	$zeile = str_replace ("{message}", $message, $zeile);
	$zeile = str_replace ("{text_code}", $code, $zeile);
	echo $zeile;
	exit;
	}

//////////////////////////
//// Login
//////////////////////////

if ($do=="login")
	{
	$id = !empty ($_POST["id"]) ? safety ($_POST["id"]) : '';
	$pass = !empty ($_POST["pass"]) ? safety ($_POST["pass"]) : '';

	if (empty ($id) || !is_numeric ($id))
		{
		header("location: index.php?do=loginsite&action=error");
		exit;
		}

	$db -> query ("SELECT id FROM ".$topxl_user_table." WHERE id='".$id."' AND pass='". md5 ($pass)."'");

	if ($db -> numRows () > 0)
		{
		setcookie ("xxxtopmembers", $id.":".$pass);
		header ("location: index.php?do=main");
		}

	else 
		{header("location: index.php?do=loginsite&action=error");}

	exit;
	}
	
//////////////////////////
//// Loginsite
//////////////////////////

if ($do == "loginsite")
	{
	if ($action=="error")
		{$message=$messageloginerror;}

	$id = !empty ($_GET["linkid"]) && is_numeric ($_GET["linkid"]) ? safety ($_GET["linkid"]) : '';

	/// Template einlesen und ausgeben
	if (!file_exists("../html/".$config['design']."/members/login.html"))
		{echo "The template file html/".$config['design']."/members/login.html does not exist.";exit;}
	$fp1=fopen("../html/".$config['design']."/members/login.html","r"); // Datei öffnen 
	$zeile = fread ($fp1, filesize ("../html/".$config['design']."/members/login.html"));
	$zeile = str_replace ("{id}", $id, $zeile);
	$zeile = str_replace ("{text_id}", $text_id, $zeile);
	$zeile = str_replace ("{text_pass}", $text_pass, $zeile);
	$zeile = str_replace ("{text_submit}", $text_submit, $zeile);
	$zeile = str_replace ("{message}", $message, $zeile);
	$zeile = str_replace ("{text_login}", $text_login, $zeile);
	$zeile = str_replace ("{text_code}", $code, $zeile);
	echo $zeile;
	exit;
	}

////////////////////////////////////
////////// berechtigung überprüfen
////////////////////////////////////

$keks = !empty ($_COOKIE["xxxtopmembers"]) ? $_COOKIE["xxxtopmembers"] : '';
$keks2 = !empty ($_COOKIE["xxxtopa"]) ? $_COOKIE["xxxtopa"] : '';

///
if (empty ($do))
	{
	header ("location: index.php?do=loginsite");
	exit;
	}

else
	{
	# cookie found
	if ($keks)
		{
		$keksinhalt = explode (":", $keks);
		$id = !empty ($keksinhalt[0]) ? safety ($keksinhalt[0]) : '';
		$pass = !empty ($keksinhalt[1]) ? safety ($keksinhalt[1]) : '';

		if (empty ($id) || !is_numeric ($id))
			{
			header("location: index.php?do=loginsite");
			exit;
			}

		$db -> query ("SELECT * FROM ".$topxl_user_table." WHERE id='".$id."' AND pass='".md5 ($pass)."'"); 

		if ($db -> numRows () > 0)
			{$do = !empty ($do) ? $do : 'main';}

		else 
			{
			header("location: index.php?do=loginsite");
			exit;
			}
		
		$userrow = $db -> fetch (); 
		}

	# admin cookie found
	elseif (!empty ($keks2))
		{
		$linkid = !empty ($_GET["id"]) && is_numeric ($_GET["id"]) ? safety ($_GET["id"]) : '';
	
		$keksinhalt=explode(":", $keks2);
		$user = !empty ($keksinhalt[0]) ? safety ($keksinhalt[0]) : '';
		$pass = !empty ($keksinhalt[1]) ? safety ($keksinhalt[1]) : '';
		$remember = !empty ($keksinhalt[2]) ? safety ($keksinhalt[2]) : '';

		$id = (empty ($linkid)) ? safety ($keksinhalt[3]) : $linkid;

		if (empty ($user) || empty ($remember) || empty ($id) or !is_numeric ($remember) or !is_numeric ($id))
			{
			header("location: index.php?do=loginsite");
			exit;
			}
		
		$db -> query ("SELECT * FROM ".$topxl_user_table." WHERE id='".$id."'"); 
		$userrow = $db -> fetch (); 
		
		$db -> query ("SELECT * FROM ".$topxl_admin_table.""); 
		$adminrow = $db -> fetch (); 

		if ($adminrow['user'] == $user && $adminrow['pass'] == $pass)
			{
			if ($remember=="1")
				{setcookie("xxxtopa", $user.":".$pass.":".$remember.":".$id, 2147468399, $config['acookiepath']);}

			elseif ($remember=="0")
				{setcookie("xxxtopa", $user.":".$pass.":".$remember.":".$id, '0', $config['acookiepath']);}

			$do = !empty ($do) ? $do : 'main';
			}

		else 
			{
			header("location: index.php?do=loginsite");
			exit;
			}
		}

	/// wenn kein Keks vorhanden ist gehts zum Login check
	else
		{
		header("location: index.php?do=loginsite");
		exit;
		}
	}

//////////////////////////////////////
///// Logout
//////////////////////////////////////

if ($do=="logout")
	{
	setcookie ("xxxtopmembers", " : ", time()-7200);
	header ("Location: index.php?do=loginsite");
	exit;
	}

//////////////////////////////////////
///// Main section
//////////////////////////////////////
$file="../html/".$config['design']."/members/main.html";

if ($do=="main")
	{
	if (!empty ($userrow['hitin']) && !empty ($userrow['hitout']))
		{
		$ratiohits=$userrow['hitout']/$userrow['hitin'];
		$ratiohits=substr($ratiohits, 0, 4);
		}

	else 
		{$ratiohits=1;}

	if (!empty ($userrow['hitintotal']) && !empty ($userrow['hitouttotal']))
		{
		$ratiohitstotal = $userrow['hitouttotal']/$userrow['hitintotal'];
		$ratiohitstotal = substr($ratiohitstotal, 0, 4);
		}

	else 
		{$ratiohitstotal=1;}

	if ($userrow['active'] == "yes")
		{$activetext = $text_active;}

	else
		{$activetext = "<font color=\"red\">".$text_notactive."</font>";}

	$sqlorder = '';
	$sqlwhere = '';
	$sqllastactive = '';
	$timestamp = time ();
	$found = false;

	if ($config['sorting'] == "out")
		{
		$sqlorder = "ORDER BY hitout";
		$sqlwhere = "hitout>='".$config['hitsneeded']."'";
		$sorter="Hits Out";
		}

	elseif ($config['sorting'] == "outtotal")
		{
		$sqlorder = "ORDER BY hitouttotal";
		$sqlwhere = "hitouttotal>='".$config['hitsneeded']."'";
		$sorter="Hits Out Total";
		}

	elseif ($config['sorting'] == "intotal")
		{
		$sqlorder = "ORDER BY hitintotal";
		$sqlwhere = "hitintotal>='".$config['hitsneeded']."'";
		$sorter="Hits In Total";
		}	

	elseif ($config['sorting'] == "in")
		{
		$sqlorder = "ORDER BY hitin";
		$sqlwhere = "hitin>='".$config['hitsneeded']."'";
		$sorter="Hits In";
		}
	
	if ($config['onlyactive'] == "yes")
		{
		$inacttime = $timestamp - $inactivetime;
		$sqllastactive = " and lastactive>='".$inacttime."'";
		}

	$resetevery = $config['resettime']/86400;
	$nextreset = $config['lastreset']+$config['resettime'];
	$nextreset = date("Y-m-d:H-i-s", $nextreset); 
	$lastreset1 = date("Y-m-d:H-i-s", $config['lastreset']); 
	$counthitsrow = count_hits($topxl_user_table, $db);

	if (!empty ($counthitsrow['insumme']) && !empty ($counthitsrow['outsumme']))
		{
		$ratiohitsall = $counthitsrow['outsumme']/$counthitsrow['insumme'];
		$ratiohitsall = substr($ratiohitsall, 0, 4);
		}

	else 
		{$ratiohitsall=1;}

	if (!empty ($counthitsrow['tisumme']) && !empty ($counthitsrow['tosumme']))
		{
		$ratiohitstotalall=$counthitsrow['tosumme']/$counthitsrow['tisumme'];
		$ratiohitstotalall=substr($ratiohitstotalall, 0, 4);
		}

	else 
		{$ratiohitstotalall=1;}
	
	$rank = 0;
	
	$db -> query ("SELECT id from ".$topxl_user_table." WHERE active='yes' and ".$sqlwhere.$sqllastactive." ".$sqlorder." DESC, id ASC");
	while ($row = $db -> fetch ())
		{
		$rank++;
		if ($row['id'] == $id)
			{
			$found = true;
			break;
			}
		}

	if ($found == true)
		{$seite = ' - '.$text_sitemenu." ".ceil ($rank / $config['linkspersite']);}
		
	else
		{
		$seite = '';
		$rank = (get_lang_file ($langget, $stanlang, $langarray, $langdetect) == 'de') ? 'Zurzeit nicht gelistet. Letzter HitIn ist zu lange her.' : 'Currently not listed. Last hitin is too long ago.';
		}

	$main_content = '
	<table width="'.$config['memcontbwidth'].'" border="0" cellpadding="0" cellspacing="0">
		<tr>
       		<td height="28" colspan="2" class="heading tdcontentbgcolor">'.$text_mainsection.'</td>
      	</tr>
      	<tr>
        	<td colspan="2" class="tdcontentbgcolor">
		  	<a href="'.$userrow['url'].'" target="_blank">'.stripslashes ($userrow['title']).'</a><br>';
		  	if ($config['showbanner']=="yes")
		  		{$main_content .= '<img src="'.stripslashes ($userrow['bannerurl']).'" width="468" height="60"><br>';}
			$main_content .= '  
			'.stripslashes ($userrow['description']).'<br><br></td></tr>
		<tr>
			<td width="40%" class="tdcontentbgcolor">
			'.$text_joindate.': <br>'.$text_hitin.': <br>'.$text_hitout.': <br>'.$text_ratio.': <br>'.$text_hitintotal.': <br>'.$text_hitouttotal.': <br>'.$text_ratiototal.': <br>'.$text_sitestatus.': '.($userrow['active']=="yes" ? '<br />'.$text_rank.':' : '').' <br>
			</td>
			<td valign="top" width="60%" class="tdcontentbgcolor">
			'.$userrow['joindate'].'<br>'.$userrow['hitin'].'<br>'.$userrow['hitout'].'<br>1/'.$ratiohits.'<br>'.$userrow['hitintotal'].'<br>'.$userrow['hitouttotal'].'<br>1/'.$ratiohitstotal.'<br>'.$activetext.($userrow['active']=="yes" ? '<br />'.$rank.$seite : '').'
			</td>
		</tr>
		<tr>
       		<td colspan="2" class="tdcontentbgcolor"><strong>'.$text_generalinfo.':</strong></td>
		</tr>
		<tr>
			<td valign="top" class="tdcontentbgcolor">
			'.$text_sorting.': <br>'.$text_hitintotal.': <br>'.$text_hitouttotal.': <br>'.$text_ratiototal.': <br>'.$text_hitsoutsince.': <br>'.$text_hitsinsince.': <br>'.$text_ratio.': <br>'.$text_resettime.':<br>'.$text_lastreset.':<br>'.$text_nextreset.':<br><br>
			</td>
			<td valign="top" class="tdcontentbgcolor">
			'.$sorter.'<br>'.$counthitsrow['tisumme'].'<br>'.$counthitsrow['tosumme'].'<br>1/'.$ratiohitstotalall.'<br>'.$counthitsrow['outsumme'].'<br>'.$counthitsrow['insumme'].'<br>1/'.$ratiohitsall.'<br>'.$resetevery.' '.$text_days.'<br>'.$lastreset1.'<br>'.$nextreset.'<br><br>
		  	</td>
		</tr>
	</table>"´';

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

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

//////////////////////////////////////
///// Edit section
//////////////////////////////////////
	
if ($do=="edit")
	{

	if (!empty ($_POST['submit']))
		{
		$name = !empty ($_POST["name"]) ? safety ($_POST["name"]) : '';
		$email = !empty ($_POST["email"]) ? safety ($_POST["email"]) : '';
		$title = !empty ($_POST["title"]) ? safety ($_POST["title"]) : '';
		$description = !empty ($_POST["description"]) ? safety ($_POST["description"]) : '';
		$url = !empty ($_POST["url"]) ? safety ($_POST["url"]) : '';
		$bannerurl = !empty ($_POST["bannerurl"]) ? safety ($_POST["bannerurl"]) : '';	
		$reciprocal = !empty ($_POST["reciprocal"]) ? safety ($_POST["reciprocal"]) : '';	

		$urlslash = $url; 
		if($urlslash==3)
			{$url=$url."/";}
		$recislash=slashcheck($reciprocal);
		if($recislash==3)
			{$reciprocal=$reciprocal."/";}
	
		$db -> query ("SELECT url,reciprocal FROM ".$topxl_user_table." WHERE (reciprocal='".$reciprocal."' or url='".$url."') and id != '".$id."'");
		$urlcheck = $db -> fetch ();
	
		$urlchkeckurl=$urlcheck['url'];
		$urlchkeckreciprocal=$urlcheck['reciprocal'];
		
		if (empty ($name))
			{$error1=$errortext1;}
		elseif (strlen($name) > 60)
			{$error1=$errortext1b;}

		if (empty ($email) )
			{$error2=$errortext2;}
		elseif (validateEmail (trim($email)) == false)
			{$error2=$errortext2a;}
		elseif (strlen($email) > 255)
			{$error2=$errortext5b;}
	
		if (empty ($url) || !preg_match ("@^".$url_protocols."@", $url))
			{$error3=$errortext3;}
		elseif (strlen($url) > 255)
			{$error3=$errortext5b;}
		elseif ($urlchkeckurl==$url)
			{$error3=$errortext3a;}

		if (empty ($reciprocal) || !preg_match ("@^".$url_protocols."@", $reciprocal))
			{$error4=$errortext4;}
		elseif (strlen($reciprocal) > 255)
			{$error4=$errortext5b;}
		elseif ($urlchkeckreciprocal==$reciprocal)
			{$error4=$errortext4a;}
			
		if ($config['showbanner']=="yes")
			{
			if (empty ($bannerurl) || !preg_match ("@^".$url_protocols."@", $bannerurl))
				{$error5=$errortext5;}

			else 
				{
				if (strlen($bannerurl) > 255)
					{$error5=$errortext5b;}
				$bannerurl=addslashes($bannerurl);
				$sqlholder=",bannerurl='".$bannerurl."'";
				$ext = strrchr($bannerurl,'.');
				$limitedext=array(".gif",".jpg",".jpeg",".png"); 
				if (!in_array($ext,$limitedext))
					{$error5=$errortext5a;}
				}
			}

		if (empty ($title))
			{$error6=$errortext6;}
		elseif (strlen($title) > $config['maxsigntitle'])
			{$error6=$errortext6a;}

		if (empty ($description))
			{$error7=$errortext7;}
		elseif (strlen($description) > $config['maxsigndesc'])
			{$error7=$errortext7a;}

		//// if an error happens
		if (!empty ($error1) || !empty ($error2) || !empty ($error3) || !empty ($error4) || !empty ($error5) || !empty ($error6) || !empty ($error7))
			{$message=$messageerror;}

		else
			{
			$title = str_replace ('\'', '', stripslashes ($title));
			$title = addslashes (str_replace ('"', '', $title));

			$db -> query ("SELECT email FROM ".$topxl_user_table." WHERE id='".$id."'");
			$emailcheckrow = $db -> fetch ();
			if ($emailcheckrow['email'] != $email)
				{
				$validatecode=rand(1000000, 9999999);
				$db -> query ("UPDATE ".$topxl_user_table." SET name='".$name."',validatemail='".$email."',validatecode='".$validatecode."',title='".$title."',description='".$description."',url='".$url."',bannerurl='".$bannerurl."',reciprocal='".$reciprocal."' WHERE id='".$id."'");
	
				/// send validatemail to user
				$subject=$subjet_emailvalimail;
				$body=$text_emailchange."\n\n".$config['topsiteurl']."/members/index.php?do=validatemail&vid=".$validatecode."&id=".$id."\n\n".$text_accountid.": ".$id."\n".$text_topsitename.": ".$config['topsitename']."\n".$text_topsiteurl.": ".$config['topsiteurl']."\n\n".$config['mailpromo']."\n\n".$commercialmailtext;
				$body=strip_tags($body);
				mail($email,$subject,$body,"From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
				$message=$messageupdate." ".$messagemailupdate;
				$email=$userrow['email'];
				}

			else
				{
				$db -> query ("UPDATE ".$topxl_user_table." SET name='".$name."',email='".$email."',title='".$title."',description='".$description."',url='".$url."',bannerurl='".$bannerurl."',reciprocal='".$reciprocal."' WHERE id='".$id."'");
				$message=$messageupdate;
				}
			}
		}

	else
		{
		$name=$userrow['name'];
		$email=$userrow['email'];
		$title=$userrow['title'];
		$description=$userrow['description'];
		$url=$userrow['url'];
		$bannerurl=$userrow['bannerurl'];	
		$reciprocal=$userrow['reciprocal'];
		}

	$main_content = '
		<form name="form1" method="post" action="index.php?do=edit">
		<table width="'.$config['memcontbwidth'].'" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td height="28" colspan="3" class="heading tdcontentbgcolor">'.$text_editaccountheading.' &nbsp;&nbsp;'.$message.'</td>
			</tr>
			<tr>
				<td width="23%" height="22" class="tdcontentbgcolor">'.$text_name.'</td>
				<td width="35%" align="center" class="tdcontentbgcolor"><input name="name" type="text" class="inputs" value="'.html_special_chars (stripslashes ($name)).'"></td>
				<td width="42%" class="error tdcontentbgcolor">'.$error1.'</td>
			</tr>
			<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_email.'</td>
				<td align="center" class="tdcontentbgcolor"><input name="email" type="text" class="inputs" value="'.stripslashes ($email).'"></td>
				<td class="error tdcontentbgcolor">'.$error2.'</td>
			</tr>
			<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_url.'</td>
				<td align="center" class="tdcontentbgcolor"><input name="url" type="text" class="inputs" id="url" value="'.stripslashes ($url).'"></td>
				<td class="error tdcontentbgcolor">'.$error3.'</td>
			</tr>
			<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_reciprocal.'</td>
				<td align="center" class="tdcontentbgcolor"><input name="reciprocal" type="text" class="inputs" id="reciprocal" value="'.stripslashes ($reciprocal).'"></td>
				<td class="error tdcontentbgcolor">'.$error4.'</td>
			</tr>';

			if ($config['showbanner']=="yes")
				{
				$main_content .= '
				<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_bannerurl.':</td>
				<td align="center" class="tdcontentbgcolor"><input name="bannerurl" type="text" class="inputs" id="bannerurl" value="'.stripslashes ($bannerurl).'"></td>
				<td class="error tdcontentbgcolor"><span class="fehler">'.$error5.'</span></td>
				</tr>';
				}

			$main_content .= '
			<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_title.'</td>
				<td align="center" class="tdcontentbgcolor"><input name="title" type="text" class="inputs" id="title" value="'.html_special_chars (stripslashes ($title)).'"></td>
				<td class="error tdcontentbgcolor">'.$error6.'</td>
			</tr>
			<tr>
				<td height="60" class="tdcontentbgcolor">'.$text_description.'</td>
				<td align="center" class="tdcontentbgcolor"><textarea name="description" id="description">'.html_special_chars (stripslashes ($description)).'</textarea></td>
				<td class="error tdcontentbgcolor">'.$error7.'</td>
			</tr>
			<tr>
				 <td height="41" class="tdcontentbgcolor">&nbsp;</td>
				 <td align="center" valign="middle" class="tdcontentbgcolor">
				 	<input name="submit" type="submit" class="submitbuton" value="'.$text_submit.'">
					<input name="reset" type="reset" class="submitbuton" value="'.$text_reset.'"></td>
				 <td class="tdcontentbgcolor">&nbsp;</td>
			</tr>
	  	</table>
		</form>';

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

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

//////////////////////////////////////
///// Html code section
//////////////////////////////////////
	
if ($do=="htmlcode")
	{
	$htmlcodescript=htmlentities($htmlcodescript);
	$main_content='
	<table width="'.$config['memcontbwidth'].'" border="0" cellpadding="0" cellspacing="0">
		<tr>
       	<td height="28" class="heading tdcontentbgcolor">'.$text_htmlcode.'</td>
      	</tr>
		<tr>
       	<td height="28" class="tdcontentbgcolor small">'.$exp_javascript_backlink.'</td>
      	</tr>
      	<tr>
        	<td valign="top" class="tdcontentbgcolor">	
			<strong>'.$bodycode_text.'</strong><br>';

	if ($config['reftype']=="textlink" or $config['reftype']=="textban")
		{$main_content.=texthtmlgen($id,$topxl_admin_table,$config['topsiteurl'],$config['linktitle'],$config['filename'],$text_textlink,$htmlcodescript,$text_preview,$config['recicodetext'],$db);}

	if ($config['reftype']=="banner" or $config['reftype']=="textban")
		{
		$main_content.=bannerhtmlgen($id,$topxl_admin_table,$config['topsiteurl'],$config['topbannerurl'],$config['linktitle'],$config['filename'],$text_banner,$htmlcodescript,$text_preview,$config['recicodebanner'],$db);
		if ($config['topbannerurla']!="")
			{$main_content.=bannerhtmlgen($id,$topxl_admin_table,$config['topsiteurl'],$config['topbannerurla'],$config['linktitle'],$config['filename'],$text_banner,$htmlcodescript,$text_preview,$config['recicodebanner'],$db);}
		if ($config['topbannerurlb']!="")
			{$main_content.=bannerhtmlgen($id,$topxl_admin_table,$config['topsiteurl'],$config['topbannerurlb'],$config['linktitle'],$config['filename'],$text_banner,$htmlcodescript,$text_preview,$config['recicodebanner'],$db);}
		if ($config['topbannerurlc']!="")
			{$main_content.=bannerhtmlgen($id,$topxl_admin_table,$config['topsiteurl'],$config['topbannerurlc'],$config['linktitle'],$config['filename'],$text_banner,$htmlcodescript,$text_preview,$config['recicodebanner'],$db);}
		if ($config['topbannerurld']!="")
			{$main_content.=bannerhtmlgen($id,$topxl_admin_table,$config['topsiteurl'],$config['topbannerurld'],$config['linktitle'],$config['filename'],$text_banner,$htmlcodescript,$text_preview,$config['recicodebanner'],$db);}
		}
	$main_content .= '
			<br><br></td>
		</tr>
	</table>';

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

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

//////////////////////////////////////
///// Stats section
//////////////////////////////////////
	
if ($do=="stats" or $do=="statsview")
	{
	if ($do=="statsview")
		{
		$monthdaycount=date("t"); //anzahl Tage im Monat
		$month=date("m");
		$thisyear=date("y"); 
		$thisday=date("d");
		$thismonthdate=mktime(0,0,0,$month,1,$thisyear); // Null Uhr Null anfangg diesen Monats
		$lastmonth=$month-1;  // letetn Monat bekommen
		$lastmonthdate=mktime(0,0,0,$lastmonth,1,$thisyear);  // Null Uhr Null anfangg letzten Monats		
		$main_content = '<table width="'.$config['memcontbwidth'].'" border="0" cellpadding="0" cellspacing="1" class="contenttablebgcolor">';
		$lastresetdate=date("m-d", $config['lastreset']);
		if ($action=="current")
			{
			$timetolastreset=time()-$config['lastreset'];
			$daystolastreset=$timetolastreset/86400;
			$daystolastreset=ceil($daystolastreset);
			$weekdayget=$config['lastreset'];

			$main_content .= '
			<tr>
				<td height="28" colspan="6" class="heading tdcontentbgcolor">'.$textcurrentperiodstats.'</td>
			</tr>
			<tr>
				<td width="7%" height="20" class="tdcontentbgcolor">&nbsp;</td>
				<td width="10%" class="tdcontentbgcolor">'.$text_weekday.'</td>
				<td width="13%" class="tdcontentbgcolor" align="center">'.$text_date.'</td>
				<td width="11%" class="tdcontentbgcolor" align="right">'.$text_hitin.'</td>
				<td width="13%" class="tdcontentbgcolor" align="right">'.$text_hitout.'</td>
				<td width="46%" class="tdcontentbgcolor"></td>
			</tr>';

			for ($i= 1; $i<=$daystolastreset; $i++) 
				{
				$weekday=date("D", $weekdayget);
				$daybegin=$weekdayget;
				$yearget=date("y", $weekdayget);
				$monthget=date("m", $weekdayget);
				$dayget=date("d", $weekdayget);
				if ($i==1)
					{
					$daybegin=$config['lastreset'];
					$daybegin1=mktime(0,0,0,$monthget,$dayget,$yearget);
					$dayend=$daybegin1+86400;
					}
				else
					{
					$daybegin=mktime(0,0,0,$monthget,$dayget,$yearget);
					$dayend=$daybegin+86400;
					}
				$db -> query ("SELECT count(validin) AS insumme FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp<'".$dayend."' and timestamp>'".$daybegin."'"); 
				$thisdayhitsinrow = $db -> fetch ();
				$thisdayhitin=$thisdayhitsinrow['insumme'];

				$db -> query ("SELECT count(validout) AS insumme FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp<'".$dayend."' and timestamp>'".$daybegin."'"); 
				$thisdayhitsoutrow = $db -> fetch ();
				$thisdayhitsout=$thisdayhitsoutrow['insumme'];	
					
				$main_content .= '
				<tr>
					<td height="20" class="tdcontentbgcolor">'.$i.'</td>
					<td class="tdcontentbgcolor">'.$weekday.'</td>
					<td class="tdcontentbgcolor" align="center">'.$lastresetdate.'</td>
					<td class="tdcontentbgcolor" align="right">'.$thisdayhitin.'</td>
					<td class="tdcontentbgcolor" align="right">'.$thisdayhitsout.'</td>
					<td class="tdcontentbgcolor"></td>
				</tr>';

				$lastresetdate++;
				$weekdayget=$weekdayget+86400;
				}
			}

		elseif ($action=="hitlatsperiod")
			{
			$lastperiodresettime=$config['lastreset']-$config['lastresettime'];
			$lastresetdate=date("m-d", $lastperiodresettime);
			$daysinlastperiod=$config['lastresettime']/86400;
			$daysinlastperiod=ceil($daysinlastperiod);
			$weekdayget=$lastperiodresettime;
			$main_content .= '
			<tr>
				<td height="28" colspan="6" class="heading tdcontentbgcolor">'.$text_lastperiostats.'</td>
			</tr>
			<tr>
				<td width="7%" height="20" class="tdcontentbgcolor">&nbsp;</td>
				<td width="10%" class="tdcontentbgcolor">'.$text_weekday.'</td>
				<td width="13%" class="tdcontentbgcolor" align="center">'.$text_date.'</td>
				<td width="11%" class="tdcontentbgcolor" align="right">'.$text_hitin.'</td>
				<td width="13%" class="tdcontentbgcolor" align="right">'.$text_hitout.'</td>
				<td width="46%" class="tdcontentbgcolor"></td>
			</tr>';

			for ($i= 1; $i<=$daysinlastperiod; $i++) 
				{
				$weekday=date("D", $weekdayget);
				$daybegin=$weekdayget;
				$yearget=date("y", $weekdayget);
				$monthget=date("m", $weekdayget);
				$dayget=date("d", $weekdayget);
				if ($i==1)
					{
					$daybegin=$lastperiodresettime;
					$daybegin1=mktime(0,0,0,$monthget,$dayget,$yearget);
					$dayend=$daybegin1+86400; 
					}
				elseif ($i==$daysinlastperiod)
					{
					$daybegin=mktime(0,0,0,$monthget,$dayget,$yearget);
					$dayend=$config['lastreset'];
					}
				else
					{
					$daybegin=mktime(0,0,0,$monthget,$dayget,$yearget);
					$dayend=$daybegin+86400;
					}

				$db -> query ("SELECT count(validin) AS insumme FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp<'".$dayend."' and timestamp>'".$daybegin."'"); 
				$thisdayhitsinrow = $db -> fetch ();
				$thisdayhitin=$thisdayhitsinrow['insumme'];

				$db -> query ("SELECT count(validout) AS insumme FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp<'".$dayend."' and timestamp>'".$daybegin."'"); 
				$thisdayhitsoutrow = $db -> fetch ();
				$thisdayhitsout=$thisdayhitsoutrow['insumme'];		
				
				$main_content .= '
				<tr>
					<td height="20" class="tdcontentbgcolor">'.$i.'</td>
					<td class="tdcontentbgcolor">'.$weekday.'</td>
					<td class="tdcontentbgcolor" align="center">'.$lastresetdate.'</td>
					<td class="tdcontentbgcolor" align="right">'.$thisdayhitin.'</td>
					<td class="tdcontentbgcolor" align="right">'.$thisdayhitsout.'</td>
					<td class="tdcontentbgcolor"></td>
				</tr>';
				$lastresetdate++;
				$weekdayget=$weekdayget+86400;
				}
			}

		elseif ($action=="monthin")
			{
			$day=date("d");
			$month=date("m");
			$thisyear=date("y"); 
			$thismonthdate=mktime(0,0,0,$month,1,$thisyear); // Null Uhr Null anfangg diesen Monats
			$weekdayget=$thismonthdate;
			$dateget=date("m-d",$thismonthdate);

			$main_content .= '
			<tr>
				<td height="28" colspan="6" class="heading tdcontentbgcolor">'.$textthismonthstats.'</td>
			</tr>
			<tr>
				<td width="7%" height="20" class="tdcontentbgcolor">&nbsp;</td>
				<td width="10%" class="tdcontentbgcolor">'.$text_weekday.'</td>
				<td width="13%" class="tdcontentbgcolor" align="center">'.$text_date.'</td>
				<td width="11%" class="tdcontentbgcolor" align="right">'.$text_hitin.'</td>
				<td width="13%" class="tdcontentbgcolor" align="right">'.$text_hitout.'</td>
				<td width="46%" class="tdcontentbgcolor"></td>
			</tr>';

			for ($i= 1; $i<=$day; $i++) 
				{
				$weekday=date("D", $weekdayget);
				$weekday=date("D", $weekdayget);
				$daybegin=$weekdayget;
				$yearget=date("y", $weekdayget);
				$monthget=date("m", $weekdayget);
				$dayget=date("d", $weekdayget);
				$daybegin=mktime(0,0,0,$monthget,$dayget,$yearget);
				$dayend=$daybegin+86400;

				$db -> query ("SELECT count(validin) AS insumme FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp>'".$daybegin."' and timestamp<'".$dayend."'"); 
				$countmonthinsrow = $db -> fetch ();
				$monthhitsin=$countmonthinsrow['insumme'];

				$db -> query ("SELECT count(validout) AS outsumme FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp>'".$daybegin."' and timestamp<'".$dayend."'"); 
				$countmonthoutsrow = $db -> fetch ();
				$monthhitsout=$countmonthoutsrow['outsumme'];	
			
				$main_content .= '
				<tr>
					<td height="20" class="tdcontentbgcolor">'.$i.'</td>
					<td class="tdcontentbgcolor">'.$weekday.'</td>
					<td class="tdcontentbgcolor" align="center">'.$dateget.'</td>
					<td class="tdcontentbgcolor" align="right">'.$monthhitsin.'</td>
					<td class="tdcontentbgcolor" align="right">'.$monthhitsout.'</td>
					<td class="tdcontentbgcolor"></td>
				</tr>';
				$dateget++;
				$weekdayget=$weekdayget+86400;
				}
			}

		elseif ($action=="lastmonthin")
			{
			$month=date("m")-1;
			if ($month==12)
				{$thisyear=date("y")-1;}
			else 
				{$thisyear=date("y");}
			$days=date("t", mktime(0,0,0,$month,1,$thisyear));
			$lastmonthdate=mktime(0,0,0,$month,1,$thisyear); // Null Uhr Null anfangg diesen Monats
			$weekdayget=$lastmonthdate;
			$dateget=date("m-d",$lastmonthdate);

			$main_content .= '
			<tr>
				<td height="28" colspan="6" class="heading tdcontentbgcolor">'.$text_lastmonthstats.'</td>
			</tr>
			<tr>
				<td width="7%" height="20" class="tdcontentbgcolor">&nbsp;</td>
				<td width="10%" class="tdcontentbgcolor">'.$text_weekday.'</td>
				<td width="13%" class="tdcontentbgcolor" align="center">'.$text_date.'</td>
				<td width="11%" class="tdcontentbgcolor" align="right">'.$text_hitin.'</td>
				<td width="13%" class="tdcontentbgcolor" align="right">'.$text_hitout.'</td>
				<td width="46%" class="tdcontentbgcolor"></td>
			</tr>';

			for ($i= 1; $i<=$days; $i++) 
				{
				$weekday=date("D", $weekdayget);
				$weekday=date("D", $weekdayget);
				$daybegin=$weekdayget;
				$yearget=date("y", $weekdayget);
				$monthget=date("m", $weekdayget);
				$dayget=date("d", $weekdayget);
				$daybegin=mktime(0,0,0,$monthget,$dayget,$yearget);
				$dayend=$daybegin+86400;

				$db -> query ("SELECT count(validin) AS insumme FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp>'".$daybegin."' and timestamp<'".$dayend."'"); 
				$countmonthinsrow = $db -> fetch ();
				$lastmonthhitsin=$countmonthinsrow['insumme'];

				$db -> query ("SELECT count(validout) AS outsumme FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp>'".$daybegin."' and timestamp<'".$dayend."'"); 
				$countmonthoutsrow = $db -> fetch ();
				$lastmonthhitsout=$countmonthoutsrow['outsumme'];		
		
				$main_content .= '
				<tr>
					<td height="20" class="tdcontentbgcolor">'.$i.'</td>
					<td class="tdcontentbgcolor">'.$weekday.'</td>
					<td class="tdcontentbgcolor" align="center">'.$dateget.'</td>
					<td class="tdcontentbgcolor" align="right">'.$lastmonthhitsin.'</td>
					<td class="tdcontentbgcolor" align="right">'.$lastmonthhitsout.'</td>
					<td class="tdcontentbgcolor"></td>
				</tr>';
				$dateget++;
				$weekdayget=$weekdayget+86400;
				}
			}
		$main_content .= "</table>";
		}

	else
		{
		$month=date("m");
		$thisyear=date("y"); 
		$thismonthdate=mktime(0,0,0,$month,1,$thisyear); // Null Uhr Null anfangg diesen Monats

		$db -> query ("SELECT count(validin) AS insumme FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp>'".$thismonthdate."'");
		$countmonthinsrow = $db -> fetch ();
		$monthhitsin=$countmonthinsrow['insumme'];

		$db -> query ("SELECT count(validout) AS outsumme FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp>'".$thismonthdate."'"); 
		$countmonthoutsrow = $db -> fetch ();
		$monthhitsout=$countmonthoutsrow['outsumme'];

		$lastmonth=$month-1;  // letetn Monat bekommen
		$lastmonthdate=mktime(0,0,0,$lastmonth,1,$thisyear);  // Null Uhr Null anfangg letzten Monats	

		$db -> query ("SELECT count(validin) AS incount FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp>'".$lastmonthdate."' and timestamp<'".$thismonthdate."'"); 
		$countlastmonthinsrow = $db -> fetch ();
		$lastmonthhitsin=$countlastmonthinsrow['incount'];

		$db -> query ("SELECT count(validout) AS outcount FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp>'".$lastmonthdate."' and timestamp<'".$thismonthdate."'"); 
		$countlastmonthoutsrow = $db -> fetch ();
		$lastmonthhitsout=$countlastmonthoutsrow['outcount'];

		$lastperiodresetti=$config['lastreset']-$config['lastresettime'];

		$db -> query ("SELECT count(validin) AS insumme FROM ".$topxl_hits_table." WHERE validin='yes' and siteid='".$id."' and timestamp<'".$config['lastreset']."' and timestamp>'".$lastperiodresetti."'"); 
		$counthitinlatsperiodrow = $db -> fetch ();
		$hitinlatsperiod=$counthitinlatsperiodrow['insumme'];

		$db -> query ("SELECT count(validout) AS insumme FROM ".$topxl_hits_table." WHERE validout='yes' and siteid='".$id."' and timestamp<'".$config['lastreset']."' and timestamp>'".$lastperiodresetti."'"); 
		$counthitoutlatsperiodrow = $db -> fetch ();
		$hitoutlatsperiod=$counthitoutlatsperiodrow['insumme'];		

		$main_content='
		<table width="'.$config['memcontbwidth'].'" border="0" cellpadding="0" cellspacing="1" class="contenttablebgcolor">
			<tr>
				<td height="28" colspan="4" class="heading tdcontentbgcolor">'.$text_stats.'</td>
			</tr>
		  <tr>
				<td width="40%" class="tdcontentbgcolor">'.$text_hitsinsince.'</td>
				<td width="11%" class="tdcontentbgcolor" align="right">'.$userrow['hitin'].'</td>
				<td width="14%" class="tdcontentbgcolor" align="right" rowspan="2"><a href="index.php?do=statsview&action=current">'.$text_view.'</a></td>
				<td width="35%" class="tdcontentbgcolor" align="right" rowspan="2">&nbsp;</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsoutsince.'</td>
				<td class="tdcontentbgcolor" align="right">'.$userrow['hitout'].'</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsinlasperiod.'</td>
				<td class="tdcontentbgcolor" align="right">'.$hitinlatsperiod.'</td>
				<td class="tdcontentbgcolor" align="right" rowspan="2"><a href="index.php?do=statsview&action=hitlatsperiod">'.$text_view.'</a></td>
				<td class="tdcontentbgcolor" align="right" rowspan="2">&nbsp;</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsoutlasperiod.'</td>
				<td class="tdcontentbgcolor" align="right">'.$hitoutlatsperiod.'</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsinthismonth.'</td>
				<td class="tdcontentbgcolor" align="right">'.$monthhitsin.'</td>
				<td class="tdcontentbgcolor" align="right" rowspan="2"><a href="index.php?do=statsview&action=monthin">'.$text_view.'</a></td>
				<td class="tdcontentbgcolor" align="right" rowspan="2">&nbsp;</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsoutthismonth.'</td>
				<td class="tdcontentbgcolor" align="right">'.$monthhitsout.'</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsinlastmonth.'</td>
				<td class="tdcontentbgcolor" align="right">'.$lastmonthhitsin.'</td>
				<td class="tdcontentbgcolor" align="right" rowspan="2"><a href="index.php?do=statsview&action=lastmonthin">'.$text_view.'</a></td>
				<td class="tdcontentbgcolor" align="right" rowspan="2">&nbsp;</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitsoutlastmonth.'</td>
				<td class="tdcontentbgcolor" align="right">'.$lastmonthhitsout.'</td>
			</tr>
			<tr>
				<td class="tdcontentbgcolor">'.$text_hitintotal.'</td>
				<td class="tdcontentbgcolor" align="right">'.$userrow['hitintotal'].'</td>
				<td class="tdcontentbgcolor" align="right" rowspan="2">&nbsp;</td>
				<td class="tdcontentbgcolor" align="right" rowspan="2">&nbsp;</td>
			</tr>
			 <tr>
				<td class="tdcontentbgcolor">'.$text_hitouttotal.'</td>
				<td class="tdcontentbgcolor" align="right">'.$userrow['hitouttotal'].'</td>
			</tr>
		</table>';
		}

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

	/// Template 
	if(!file_exists($file))
		{echo "The template /html/".$file."members/main.html does not exist."; exit;}
	$fp1=fopen($file,"r");  
	$zeile = fread ($fp1, filesize ($file));
	include("template.php");
	echo $zeile;
	exit;
	}
	
//////////////////////////////////////
///// All Accounts section
//////////////////////////////////////
	
if ($do=="allaccounts")
	{
	$main_content = '
	<table width="'.$config['memcontbwidth'].'" border="0" cellpadding="0" cellspacing="1" class="contenttablebgcolor">
		<tr>
       	<td height="28" colspan="7" class="heading tdcontentbgcolor">'.$text_allaccountsheading.'</td>
      </tr>
		<tr>
        	<td width="7%" class="tdcontentbgcolor">	
			'.$text_id.'
			</td>
			<td width="40%" class="tdcontentbgcolor">	
			'.$text_title.'
			</td>
			<td width="10%" class="tdcontentbgcolor" align="right">	
			'.$text_in.'
			</td>			
			<td width="10%" class="tdcontentbgcolor" align="right">	
			'.$text_out.'
			</td>		
			<td width="12%" class="tdcontentbgcolor" align="right">	
			'.$text_allin.'
			</td>		
			<td width="12%" class="tdcontentbgcolor" align="right">	
			'.$text_allout.'
			</td>
			<td width="9%" class="tdcontentbgcolor" align="right">
			'.$text_edit.'
			</td>
		</tr>';

	$db -> query ("SELECT * FROM ".$topxl_user_table." WHERE email='".$userrow['email']."'"); 
	while ($multigetrow = $db -> fetch ())
		{
		$main_content .= '
		<tr>
        	<td class="tdcontentbgcolor">	
			<a href="index.php?do=loginsite&linkid='.$multigetrow['id'].'" class="smalllink" target="_blank">'.$multigetrow['id'].'</a>
			</td>
			<td class="tdcontentbgcolor">	
			<a href="'.stripslashes ($multigetrow['url']).'" class="smalllink" target="_blank">'.substr (stripslashes ($multigetrow['title']), 0, 30).'</a>
			</td>
			<td class="tdcontentbgcolor" align="right">	
			'.$multigetrow['hitin'].'
			</td>			
			<td class="tdcontentbgcolor" align="right">	
			'.$multigetrow['hitout'].'
			</td>		
			<td class="tdcontentbgcolor" align="right">	
			'.$multigetrow['hitintotal'].'
			</td>		
			<td class="tdcontentbgcolor" align="right">	
			'.$multigetrow['hitouttotal'].'
			</td>
			<td class="tdcontentbgcolor" align="right">
			<a href="index.php?do=loginsite&linkid='.$multigetrow['id'].'" class="smalllink" target="_blank">'.$text_edit.'</a>
			</td>
		</tr>';
		}	

	$main_content .= '</table>';
	$allaccounts = '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>';

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

//////////////////////////////////////
///// Change Pass Section
//////////////////////////////////////
	
if ($do=="pass")
	{
	if (!empty ($_POST['submit']))
		{
		$pass = !empty ($_POST["pass"]) ? safety ($_POST["pass"]) : '';	
		$pass2 = !empty ($_POST["pass2"]) ? safety ($_POST["pass2"]) : '';
		$currentpass = !empty ($_POST["currentpass"]) ? safety ($_POST["currentpass"]) : '';

		if (empty ($currentpass))
			{$error9 = $errortext9;}
		
		else
			{
			$currentpass = md5 ($currentpass);
	
			$db -> query ("SELECT * FROM ".$topxl_user_table." WHERE id='".$id."'");
			$currentpassrow = $db -> fetch ();
	
			$checkcurrentpass = $currentpassrow['pass'];
			if ($checkcurrentpass != $currentpass)
				{$error9 = $errortext9a;}

			if (!empty ($pass)) 
				{
				if ($pass != $pass2)		 
					{$error8 = $errortext8a;}    
				elseif (strlen ($pass)< "8")
					{$error8 = $errortext8b;}
				elseif (strlen ($pass)> 60)
					{$error8 = $errortext1b;}
			   }

			/// if no pass was entered
			else 
				{$error8=$errortext8c;}
			}

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

		else
			{
			$db -> query ("UPDATE ".$topxl_user_table." SET pass='".md5 ($pass)."' WHERE id='".$id."'");
			setcookie ("xxxtopmembers", $id.":".$pass);
			$message = $messagepasschanged;

			/// mail an User mit neuem passwort
			$subject = $subjectmailwithpass;
			$body = $messagepasschanged."\n\n".$text_logindata."\n".$text_loginname.": ".$id."\n".$text_pass.": ".$pass."\n\n".$text_topsitename.": ".$config['topsitename']."\n".$text_topsiteurl.": ".$config['topsiteurl']."\n\n".$config['mailpromo']."\n\n".$commercialmailtext;
			$body = strip_tags (stripslashes ($body));
			mail ($userrow['email'], $subject, $body, "From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
			}
		}

	$main_content = '
		<form name="form1" method="post" action="index.php?do=pass">
		<table width="'.$config['memcontbwidth'].'" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td height="28" colspan="3" class="heading  tdcontentbgcolor">'.$text_changepassheading.' &nbsp;&nbsp;'.$message.'</td>
			</tr>
			<tr>
				<td width="31%" height="22" class="tdcontentbgcolor">'.$text_currentpass.'</td>
				<td width="31%" align="center" class="tdcontentbgcolor"><input name="currentpass" type="password" class="inputs" value=""></td>
				<td width="38%" class="error tdcontentbgcolor">'.$error9.'</td>
			</tr>
			<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_pass.'</td>
				<td align="center" class="tdcontentbgcolor"><input name="pass" type="password" class="inputs" value=""></td>
				<td class="error tdcontentbgcolor">'.$error8.'</td>
			</tr>
			<tr>
				<td height="22" class="tdcontentbgcolor">'.$text_pass.'</td>
				<td align="center" class="tdcontentbgcolor"><input name="pass2" type="password" class="inputs" value=""></td>
				<td class="tdcontentbgcolor"></td>
			</tr>
			<tr>
				<td height="41" class="tdcontentbgcolor">&nbsp;</td>
				<td align="center" valign="middle" class="tdcontentbgcolor">
				<input name="submit" type="submit" class="submitbuton" value="'.$text_submit.'">
				<input name="reset" type="reset" class="submitbuton" value="'.$text_reset.'"><br><br><br><br></td>
				<td class="tdcontentbgcolor">&nbsp;</td>
			</tr>
		</table>
		</form>';	

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

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

//////////////////////////////////////
///// Contact section
//////////////////////////////////////
	
if ($do == "contact")
	{
	$mailsubject = !empty ($_POST["mailsubject"]) ? safe_subject (safety($_POST["mailsubject"])) : '';
	$mailmessage = !empty ($_POST["mailmessage"]) ? safe_body (safety ($_POST["mailmessage"])) : '';

	if (!empty ($_POST['submit']))
		{
		if (safe_body($message)==1)
			{$messageerror=$text_badsign_message;}
		if (empty ($mailsubject))
			{$error10=$errortext10;}
		if (empty ($mailmessage))
			{$error11=$errortext11;}

		//// if an error happens
		if (!empty ($error10) || !empty ($error11))
				{$message=$messageerror;}
		else 
			{
			include ("../lang/members-".$config['stanlang'].".php");

			/// Mail to admin
			$subject=$mailsubject;
			$body=$text_emailfrom." ".$userrow['name']."\n".$text_via." ".$config['topsiteurl']."\n\n".$mailmessage."\n\n".$text_accountid.": ".$id."\n".$text_url.": ".$userrow['url'];
			$body=strip_tags (stripslashes ($body));
			mail($config['adminmail2'],$subject,$body,"From: ".$config['adminmail']."\nReply-To: ".$userrow['email']);

			//// mail to user
			include("../lang/members-".get_lang_file($langget,$config['stanlang'],$config['langs'],$config['langdetect']).".php");
			$subject=$text_subjectcopy." ".$config['topsitename'];
			$body=$text_body1."\n\n".$text_yourmessage."\n\n".$mailmessage."\n\n".$text_willanswer."\n\n".$config['mailpromo']."\n\n".$commercialmailtext;
			$body=strip_tags(stripslashes ($body));
			mail($userrow['email'],$subject,$body,"From: ".$config['adminmail']."\nReply-To: ".$config['adminmail']);
			$message=$messagemailsend;
			$mailsubject = '';
			$mailmessage = '';
			}
		}

	$main_content='
		<table width="'.$config['memcontbwidth'].'" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td height="28" colspan="2" class="heading tdcontentbgcolor">'.$text_mailtoadminheading.' &nbsp;&nbsp;'.$message.'</td>
			</tr>
			<form name="form1" method="post" action="index.php?do=contact">
			<tr>
				<td width="17%" height="22" valign="top" class="tdcontentbgcolor">'.$text_subject.'</td>
				<td width="83%" align="center" class="tdcontentbgcolor"><input name="mailsubject" type="text" class="inputs" value="'.html_special_chars (stripslashes ($mailsubject)).'" style="width:350px"><br><span class="error">'.$error10.'</span></td>
			</tr>
			<tr>
				<td height="22" valign="top" class="tdcontentbgcolor">'.$text_message.'</td>
				<td align="center" class="tdcontentbgcolor"><textarea name="mailmessage" style="width:350px;height:200px">'.html_special_chars (stripslashes ($mailmessage)).'</textarea><br><span class="error">'.$error11.'<br></span></td>
			</tr>
			<tr>
				<td height="41" class="tdcontentbgcolor">&nbsp;</td>
				<td align="center" valign="middle" class="tdcontentbgcolor">
				<input name="submit" type="submit" class="submitbuton" value="'.$text_submit.'">
				<input name="reset" type="reset" class="submitbuton" value="'.$text_reset.'"></td>
			</tr>
			</form>
		</table>';

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

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

//////////////////////////////////////
///// Delete Account section
//////////////////////////////////////

if ($do=="delete")
	{
	if (!empty ($_POST['submit']))
		{
		$db -> query ("DELETE FROM ".$topxl_user_table." WHERE id='".$id."'");
		$db -> query ("DELETE FROM ".$topxl_hits_table." WHERE siteid='".$id."'");
		$db -> query ("UPDATE ".$topxl_admin_table." SET deletedsites=deletedsites+1"); 
		header ("Location: index.php");
		exit;
		}

	$main_content= '
		<form name="form1" method="post" action="index.php?do=delete">
		<table width="'.$config['memcontbwidth'].'" border="0" align="center" cellpadding="0" cellspacing="0">
			<tr>
				<td height="28" class="heading tdcontentbgcolor">'.$text_deleteaccountheading.' &nbsp;&nbsp;'.$message.'</td>
			</tr>
			<tr>
				<td class="tdcontentbgcolor"><strong>'.$text_qdeleteaccount.'</strong><br>
				'.$text_noreactivation.'<br><br>
				<input name="submit" type="submit" value="'.$text_deleteaccount.'"><br><br><br><br><br><br>
				</td>
			</tr>
		</table>
		</form>';

	$allaccounts = (check_multiaccount ($userrow['email'], $topxl_user_table, $db))=="1" ? '<a href="index.php?do=allaccounts">'.$text_allyouraccounts.'</a><br>' : '';

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