<?php header('Content-Type: text/html; charset=windows-1251'); ?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Guestbook moderation</title>
</head>
<?php
if (file_exists(getcwd ( )."/otd/2.txt"))
{echo '<body leftMargin=0 id=bod topMargin=0  style="overflow:hidden;background:silver;">';
echo '<table id=monoz  border=0 style="width:100%;height:100%;
z-index:3;position:absolute;top:0px;left:0px;">
<tr ><td width=30%>&nbsp;</td><td width=30%  valign=center align=center>
<table border=0 width=400 style="background:white" >
<tr><td><IMG height=60 border=0 src="d~e~f/pas.jpg"></td>
<td  height=30px ><center><b style="color:red">ATTENTION !'.
'</b> </center> <br>
<ol>
<li> THE ADMINISTRATOR closed the site to carry out work on its reorganization!
<li> The site will be available after completion of work!
<li> For information, please contact the ADMINISTRATOR!
<li> Close site
<li> Check back later!
</ol>
</td></tr>
</table>
</td><td width=30%>&nbsp;</td></tr></table></body></html>';
die;
}
?>
<body background="d~e~f/bkg4.gif" topMargin=0 style="overflow:hidden" width=100% height=100%>
<div id=ppp style="z-index:2;opacity:0.3;visibility:hidden;height:100%;width:100%;position:absolute;top:0;left:10;background:black;filter:alpha(opacity=30)">&#160;&#160;&#160;</div>
<?php
include "f.php";   //
if (isset($_GET['utf8']))
{$utf8=$_GET['utf8'];}
else
{$utf8="";}
if (isset ($_REQUEST['nam']))
{$nam=$_REQUEST['nam'];}
else
{ $nam=$_GET['nam'];} 
if (isset ($_REQUEST['site']))
{$site=$_REQUEST['site'];}
else
{ $site=$_GET['site'];} 
if  (strpos($site,'/contents/')>0)      // 
{list($a1,$a2,$a3,$a4,$a5)=explode("/",$site);  //
$fol=$a1."/".$a2."/".$a3;
}
else
{$fol=str_replace(".htm","",$site);   //
}
?>
<form id="form"  method="POST" enctype="multipart/form-data" action="modtg.php
<?php echo '?site='.$site.'&utf8='.$utf8.'&nam='.$nam;?>
">
<b style="color:red;font-family:tahoma;font-size:12px;font-weight:bold;">WEBSITE:</b> 
<b style="color:#316290;font-family:tahoma;font-size:12px;font-weight:bold;" id=sname2>
<?php
include "plan/name.txt";
?>
</b>


<table border="0" width=100% height=100%>
<tbody>
<TR>
<td valign=top>
<table border="1" width=100% style="border:2px brown solid" >
<THEAD style="">
<TR>
<TH width=20px>N</TH>
<TH title="Ip - address of the author of the post;
  Character - a picture reflecting the character of the recording;
Date - date of entry; Name - the name of the author of the post  ">
<table border=0 width=100%>
<tr>
<td align=center>
<b>Ip&nbsp;&nbsp;Character&nbsp;&nbsp;Date&nbsp;&nbsp;Name</b>
</td>
</tr>
<tr>
<td align=center style="background:white">
<b>Text</b>
<td>
</tr>
</table>
</TH>
<TH width=20px title="Mark me if you want to show the guest post on the site, or reset if you want to hide, after all the actions click 'Execute'." valign=center>v</TH>
<TH width=20px title="Mark me in the message lines you want to delete, then click 'Execute'." valign=center>x</TH>
<TH width=10px >&nbsp;</TH>
</TR></THEAD></table>
<DIV id=k style="OVERFLOW: scroll;  height:90%" align=left>
<table border="1" width=100% style=""><tbody>
<TBODY>
<?php
$os=""; 						  //
if (isset ($_REQUEST['de']))      //
{
$w=fopen(wu(getcwd ( ).'/pages/'.$fol.'/tg/tg.txt',$utf8), 'w') or exit; //
$wh=fopen(wu(getcwd ( ).'/pages/'.$fol.'/tg/tg.htm',$utf8), 'w') or exit; //
fclose($w);   //
fclose($wh);  //
$soob="All deleted!";
}
if (isset ($_REQUEST['hid']))    //
{// 
// 
$l = file(getcwd().'/pages/'.$fol.'/tg/tg.txt');    // 
foreach ($l as $li => $lin)  
{if (substr(trim($lin),0,1)!="*")                   // 
{list($ip,$ka,$im,$d,$t,$p)=explode("//",$l[$li]);  // 
$l[$li]=$ip.'//'.$ka.'//'.$im.'//'.$d.'//'.$t.'//-'."\r\n";
}}
foreach ($_REQUEST as $i => $z)                     // 
{if (substr($i,0,2)=="uu")                          // 
{$k=trim(substr($i,2));
 $l[$k]="uu";                                       // 
}
else
 {if (substr($i,0,2)=="pp")                         // 
 { $k=trim(substr($i,2));
 list($ip,$ka,$im,$d,$t,$p)=explode("//",$l[$k]);
 if ($p!="+") // 
  {$l[$k]=$ip.'//'.$ka.'//'.$im.'//'.$d.'//'.$t.'//+'."\r\n";
  } // 
 }}}
// 
$w=fopen(wu(getcwd ( ).'/pages/'.$fol.'/tg/tg.txt',$utf8), 'w') or exit;  //
$wh=fopen(wu(getcwd ( ).'/pages/'.$fol.'/tg/tg.htm',$utf8), 'w') or exit; //
fwrite($wh,'<h2 style="background:#b0c4de;text-align:center" align=center>Guest book</h2><table border=0 width=100%><tbody>');
$ii=1;
  foreach ($l as $li => $lin)  
  {if (trim($lin)=="uu")                                                  //
  {}
  else
  {fwrite($w,$lin);
if (substr($lin,0,1)!="*")                                              // 
{list($ip,$ka,$im,$d,$t,$p)=explode("//",$l[$li]);
if (trim($p)=="+")                                                      // 
{$ww='<tr style="background:#e6e6fa;">
<td width=10px><b>'.trim($ii++).'</b></td>
<td width=10px><img src="../d~e~f/'.$ka.'"></td>
<td width=70px><b>'.$d.'</b></td>
<td width=85%><b>'.$im. '</b></td></tr><tr><td></td><td colspan=3>'.str_replace('  ','&nbsp;&nbsp;',$t)."</td></tr>";
if (strpos($site,"/contents/")>0)                                      //
{ $ww=str_replace('../','../../../../',$ww);	
}
fwrite($wh,$ww);
}}} //
}
fclose($w);                                                          // 
fwrite($wh,"</tbody></table>");
fclose($wh);                                                         // 
$soob="Performed !";
}
//************************
// 
//************************
$mf=getcwd().'/pages/'.$fol.'/tg/tg.txt';
$net=true;
if (file_exists($mf))                                                 // 
{$net=false;
$l = file($mf);
//
$ii=1;
foreach ($l as $li => $lin)
{echo "<TR>";
 if (substr($lin,0,1)=="*")                                         //
{}
 else
 {//
 list($ip,$ka,$im,$d,$t,$p)=explode("//",$lin);
echo '<td width=20px>'.$ii++.'</td>';
echo '<td ><font style="background:#e6e6fa;width:100%">';
echo "<b>".trim($ip).'</b>&nbsp';
echo '<img src="d~e~f/'.trim($ka).'">'.'&nbsp';
echo "<b>".trim($d).'</b>&nbsp;&nbsp;&nbsp;&nbsp';
echo '<b>'.trim($im).'</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>';
echo "<b style=background:white>".trim($t)."</b>";
echo "</td>";
echo '<td width=20px align=center>';
 if (substr($p,0,1)=="+") 
 {echo '<input type="checkbox"   name="pp'.$li.'" checked>';}
else
 {echo '<input type="checkbox"   name="pp'.$li.'">';}
 echo '<td width=20px align=center>';
 echo '<input type="checkbox"   name="uu'.$li.'">';
 echo '</td>';
 }}}
?>
</td></tr></tbody></table>
</div></td>
<td valign=center width=300px>
<center>
<font size=3><b>MODERATION GUESTBOOK PAGE</b></font><br>
<u><b title="To view the published page, go back to the designer and click 'LOOK'!">
<?php  echo rtr($nam); ?> </u></center><br><hr>
<b>

<li><a  href="help/10.htm#102" target=_blank>&nbsp;Help&nbsp;</a>
<li>Filter&nbsp;&nbsp;<input type="text" id=goto size="30" title="One or more filtering contexts through
delimiter character '/'">
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onclick=got(0) form=""  
title="Show only those lines that contain context in any part of the record">
Select</button>&nbsp;&nbsp;&nbsp;
<button form="" onclick=got(2) title="Cancel selection">&nbsp;X&nbsp;</button>
&nbsp;&nbsp;&nbsp;To print&nbsp;&nbsp;&nbsp;<button form="" style=width:30 onclick=ptab()>P</button>

<li> All received records are shown in the table!
<li> Select records to show by clicking in the "v" column
<li> Select records to delete by clicking in the "x" column
<li> Click the <br> button to show and/or delete<center>
<button form="" onclick=dm() 
title="Click me to process the marks.">Execute</button>
</center>
<li>To delete all records, click the button<br>
<center><button form="" onclick=da() 
>Delete all</button>
</center>
<hr>
<center >
<b id=soob style='color:brown'>
<?php
echo $soob;
?>
</b></center>
<input id=sel type="submit" value="Execute" name="hid" style="display:none"> 
<input id=all type="submit" value="Delete all" name="de" style="display:none">
<input type="hidden" name="utf8" value="<?php echo $utf8;  ?>">
<input type="hidden" name="site" value="<?php echo $site;  ?>">
<input type="hidden" name="nam" value="<?php echo $nam;  ?>">
</form>
</b>
</td>
</tr></tbody></table>
<a id=per target=_blank style="visibility:hidden" href=#>+++</a>
</body>
 <script type="text/javascript">
//***************************************
function dm()  //
//***************************************
{document.getElementById("soob").innerHTML=""
mch=document.getElementById("k").getElementsByTagName("INPUT")
if (mch.length==0)
{alert("Empty!")
return
}
if (!confirm("Those marked in X will be deleted, in V are shown? \r\n Click 'Cancel' to cancel"))
{return}
else
{document.getElementById("sel").click()
}}

//**************************************************
function da() //
//**************************************************
{document.getElementById("soob").innerHTML=""
mch=document.getElementById("k").getElementsByTagName("INPUT")
if (mch.length==0)
{alert("Empty!")
return
}
if (!confirm("Will all be deleted? \r\n Click 'Cancel' to cancel"))
{return}
else
{document.getElementById("all").click()
}}

//**********************************************************
window.onload=function () //
//**********************************************************
{obj9= document.getElementById("k")
obj9.style.height=document.getElementById("ppp").offsetHeight-100
obj9.scrollLeft=0
obj9.scrollTop=0
}

fi2=false     // 
//*******************************************
function got(p)   //
//*******************************************
{if (p==2 &&  !fi2)                                          // 
{return	}	
mtr2=document.getElementById("k").getElementsByTagName("TR")  //
if (p==2)
{for(var j = 0; j <= mtr2.length-1; j++)
{mtr2[j].style.display=""
}
fi2=false     //
document.getElementById("soob").innerHTML="Filter canceled"
}
//**************************************************************************************************
if (p==0)                                                  //
{if (document.getElementById("goto").value=="")
{alert("Enter the filter context!")	
return	
}
kont=document.getElementById("goto").value
mkont=kont.split("/")
for(var jj = 0; jj <= mkont.length-1; jj++)
{if (mkont[jj]=="")
{alert("Empty context in filter list!")
return
}}

for(var j = 0; j <= mtr2.length-1; j++)
{mmtr2=mtr2[j].getElementsByTagName("TD")
for(var jj = 0; jj <= mkont.length-1; jj++)
{if (mmtr2[1].innerHTML.indexOf(mkont[jj])>=0)
{mtr2[j].style.display="";break}
else
{mtr2[j].style.display="none"
}}}
fi2=true
document.getElementById("soob").innerHTML="Filtering!"
}}

//********************************************************************
function ptab() // 
//********************************************************************
{
newstr2="<b>Website: </b>"+document.getElementById("sname2").innerHTML
newstr2=newstr2+"<h2 style='text-align:center'>Guestbook Pages «<?php  echo rtr($nam); ?>»</h2>"
if (fi2)
{newstr2=newstr2+ "Filter by '"+
document.getElementById("goto").value+"' in 2"
}
else
{newstr2=newstr2
}
mstr=document.getElementById("k").getElementsByTagName("TR")
newstr2=newstr2+"<table width=100% border=1><tr><td align=center><b>N</b></td><td align=center><b>Ip&nbsp;&nbsp;Character&nbsp;&nbsp;Date&nbsp;&nbsp;Name<br>Text</b></td></tr>"
newstr2=newstr2+"<tr><td align=center><b>1</b></td><td align=center>2</td></tr>"
newstr=""
for(var j5 = 0; j5 <mstr.length; j5++)  
{
if (mstr[j5].style.display=="")
{
mstrtd=mstr[j5].getElementsByTagName("TD")
newstr="<tr><td>"+mstrtd[0].innerHTML+"</td>"
newstr=newstr+"<td>"+mstrtd[1].innerHTML+"</td></tr>"
newstr2=newstr2+newstr
}
}
newstr2=newstr2+"</table>"
dop=window.open("","","");
tnap="<HTML><HEAD><META http-equiv=Content-Type content='text/html; charset=windows-1251'></head>"
tnap=tnap+newstr2+"</html>"
dop.document.write(tnap)
}








</script>
</html>