Location: PHPKode > projects > ToplistHost > toplisthost/statistik.php
<?php
include("funktions.php");
openmysql();
$config=loadconfig();

if(!$ac) {
	$post.=gettext2('newlist_start');
	$result=mysql_query("select katid, kat from ft_sys_kat order by kat");
	while($zeile=mysql_fetch_row($result)) {
		$tmp.="<option value=\"$zeile[0]\">$zeile[1]</option>";
	}
	$post=preg_replace("/{kat}/", "$tmp", $post);
	printhtml(gettext2("anm_titel"),$post);
} elseif($ac == 'step2') {
	if(!isset($kat) or !$titel or !$mail or !$pass) fehler(gettext2('alle_felder')); 
	if($pass != $passb) fehler(gettext2('passwort_ungleich'));

	mysql_query("insert into ft_all_liste values (null, '$pass', '$mail', '$titel', $kat, 0, 0, 50, 5, '', '468x60', 1, 10, 86400, now(), now(), '0', '1', 1, 0, 1440, 0, '1', 150,'','0',".(int) !$config[10].",null,'300','300', '700','500',0,50, 150, 0, 60)");
	if(mysql_error()) fehler(mysql_error());
	$id=mysql_insert_id();
	mkdir ("$config[5]/$id", 0777);
	$fp=@fopen("$config[5]/$id/index.html", "w");
	fputs($fp, "Leer");
	fclose($fp);
	chmod("$config[5]/$id/index.html",0666);
	mysql_query("update ft_all_liste set url='$config[6]/$id/index.html' where liste=$id");
	if(mysql_error()) fehler(mysql_error());
	###Template für Anmeldung
	mysql_query("insert into ft_all_templates select '$id', '0', html from ft_sys_templates where welches=100");
	###Template für Statistik
	mysql_query("insert into ft_all_templates select '$id','1', html from ft_sys_templates where welches=101");
	###Template für Liste
	mysql_query("insert into ft_all_templates select '$id', '2', replace(html,'{liste}','$id') from ft_sys_templates where welches=102");
	print mysql_error();
	###Template für Header
	mysql_query("insert into ft_all_templates select '$id','3', html from ft_sys_templates where welches=103");
	###Template für Zeile
	mysql_query("insert into ft_all_templates select '$id','4', html from ft_sys_templates where welches=104");
	###Template für Regeln
	mysql_query("insert into ft_all_templates select '$id','5', html from ft_sys_templates where welches=105");
	###Template für SiteOfTheMoment
	mysql_query("insert into ft_all_templates select '$id','6', html from ft_sys_templates where welches=106");
	###Template für Anmelden-Mail
	mysql_query("insert into ft_all_templates select '$id','7', html from ft_sys_templates where welches=107");

	### Mail an Betreiber
	if($config[7]) mail($config[8],"Neue Liste angemeldet", "Soeben wurde eine neue Topliste angemeldt. \n\nE-Mail: $mail\nID: $id\nName der Liste: $titel","From: $config[8]");
	######################
	### Send mail to user

	$welches=1;
	$toreplace=array("mail" => "$mail",
				"titel" => "$titel",
				"pass" => "$pass",
				"id" => "$id",
				"url" => "$config[6]/$id/index.html"
	);
	
	#Interne Funktionen
	$result=mysql_query("SELECT html FROM ft_sys_templates WHERE welches=$welches");
	$zeile=mysql_fetch_row($result);
	while(list($key, $val)=each($toreplace)) {
		$zeile[0]=preg_replace("/\{$key\}/","$val", $zeile[0]);
	}

	mail($mail,"Ihre neue Topliste", $zeile[0], "From: $config[8]");
	####################
	
	$post=preg_replace("/{id}/", "$id", gettext2('newlist_modus'));
	printhtml(gettext2("anm_art"),$post);
} elseif($ac == 'step3') {
	mysql_query("update ft_all_liste set art=$modus where liste=$id");
	if($modus == 5 or $modus == 2) {
		mysql_query("update ft_all_liste set html=1 where liste=$id");
		$liste=$id;
		$listconfig=loadlistconfig();
		include("update.php");
		$post=preg_replace("/{id}/", "$id", gettext2('anm_fertig2'));
	} else {
		$post=preg_replace("/{id}/", "$id", gettext2('newlist_modus2'));
	}
	printhtml(gettext2('anm_htmlcode'),$post);
} elseif($ac == 'step4') {
	$html=0;
	if($html1) $html+=1;
	if($html2) $html+=2;
	if($html4) $html+=4;
	if(!$html) fehler("Bitte mindestens einen HTML-Code wählen!");
	mysql_query("update ft_all_liste set html=$html where liste=$id");
	if($html == 2 or $html == 3 or $html == 7 or $html==6) {
		$post=preg_replace("/{id}/", "$id", gettext2('newlist_modus3'));
		printhtml(gettext2('anm_htmlcode'),$post);
	} elseif($html == 4 or $html == 5) {
			$post=preg_replace("/{id}/", "$id", gettext2('newlist_modus4'));
			printhtml(gettext2('anm_htmlcode'),$post);
	} elseif($html == 1) {
		$post=preg_replace("/{id}/", "$id", gettext2('anm_fertig2'));
		$liste=$id;
		$listconfig=loadlistconfig();
		include("update.php");
		printhtml(gettext2('anm_fertig'),$post);
	}
} elseif($ac == 'step5') {
		if(!$breite or !$hoehe) fehler(gettext2('listadmin_modus6'));
		mysql_query("update ft_all_liste set htmlheight='$hoehe', htmlwidth='$breite' where liste=$id");
		$result=mysql_query("select html from ft_all_liste where liste=$id");
		list($html)=mysql_fetch_row($result);
		if($html == 7 or $html == 6) {
			$post=preg_replace("/{id}/", "$id", gettext2('newlist_modus4'));
			printhtml(gettext2('anm_htmlcode'),$post);
		} else {
			$liste=$id;
			$listconfig=loadlistconfig();
			include("update.php");
			printhtml(gettext2('anm_fertig'),gettext2('anm_fertig2'));
		}
} elseif($ac == 'step6') {
		if(!$breite or !$hoehe) fehler(gettext2('listadmin_modus6'));
		if(!isset($art)) $art=1;
		mysql_query("update ft_all_liste set htmlheight2='$hoehe', htmlwidth2='$breite', intro=$art where liste=$id");
		$liste=$id;
		$listconfig=loadlistconfig();
		include("update.php");
		printhtml(gettext2('anm_fertig'),gettext2('anm_fertig2'));
}

function printhtml($titel, $post) {
	$welches=0;
	$toreplace=array("post" => "$post",
				"titel" => "$titel"
	);

	#Interne Funktionen
	$result=mysql_query("SELECT html FROM ft_sys_templates WHERE welches=$welches");
	$zeile=mysql_fetch_row($result);
	while(list($key, $val)=each($toreplace)) {
		$zeile[0]=ereg_replace("\{".$key."\}","$val", $zeile[0]);
	}
	print $zeile[0];
}
function fehler($post) {
	printhtml(gettext2('error'),$post);
	exit;
}
?>
Return current item: ToplistHost