File size: 1.55Kb
<?php
require"../system/config.php";
require"../system/func.php";
$id_theme=(int)$_GET['id_theme'];
$qq=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_messages` WHERE `id_them`='$id_theme'"),0);
$qq2=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_themes` WHERE `id_them`='$id_theme'"),0);
if($qq2==0){echo'FATAL ERROR';}else{
if($qq==0){
$j=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id_them`='$id_theme'"));
$ye=mysql_fetch_assoc(mysql_query("SELECT `login` FROM `users` WHERE `id_user`='".$j['id_user']."'"));
$sav='1.'.$ye['login'].' ['.date_fixed($j['timer']).'] '.$j['fttext'];
}else{
$q=mysql_query("SELECT * FROM `forum_messages` WHERE `id_them`='$id_theme'");
$j=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id_them`='$id_theme'"));
$ye=mysql_fetch_assoc(mysql_query("SELECT `login` FROM `users` WHERE `id_user`='".$j['id_user']."'"));
$sa='1.'.$ye['login'].' ['.date_fixed($j['timer']).'] '.$j['fttext'];
while($d=mysql_fetch_array($q)){
$ye2=mysql_fetch_assoc(mysql_query("SELECT `login` FROM `users` WHERE `id_them`='".$j['id_user']."'"));
$rre++; $rre=$rre+1;
$sa2.=$rre.'. '.$ye2['login'].' ['.date_fixed($d['timer']).'] '.$d['fmtext'];
}
$sav=$sa.' '.$sa2;
}
$file=fopen('txt/dokym_'.$id_theme.'.txt','w');
fputs($file,$sav);
fclose($file);
header('Content-Type: text/text; charset=utf-8', true);
header('Location: txt/dokym_'.$id_theme.'.txt');
header('Content-Disposition: attachment; filename="txt/dokym_'.$id_theme.'.txt";');
}
require"../system/foot.php";
?>