<?php header('Content-Type: text/html; charset=windows-1251'); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Editing scripts</title>
<style>
a {color:#254A6C;font-family:tahoma;font-size:12px;font-weight:normal;}
.redlink {color:#B92327;font-family:tahoma;font-size:11px;font-weight:normal;}
.bluelink {color:#254A6C;font-family:tahoma;font-size:11px;font-weight:normal;}
a:hover {color:white;font-family:tahoma;font-size:12px;font-weight:normal;background:black}
</style>
</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, contact your ADMINISTRATOR!
<li> Close site
<li> Check back later!</ol>
</td></tr>
</table>
</td><td width=30%>&nbsp;</td></tr></table></body></html>';
die;
}
?>
<body  style="overflow:hidden;background:silver">
<?php
include "f.php"; 
if (isset ($_REQUEST['file'])) 
{$file=trim($_REQUEST['file']);}
else
{$file=trim($_GET['file']);}
?>
<form  style="background:brown;color:yellow"  id=form action="script.php" method="post" enctype="multipart/form-data" >
<?php
echo '<nobr><font size=5 style=color:white>DEBUG, file: '.$im.'</font>';
echo '&nbsp;<b id=ifa>';
echo $file;
echo '</b>';
?>
<textarea  name=stru style="display:none" value=""></textarea>
<input style="display:none" type="submit" name="Save" title="Click me to save.">
&nbsp;&nbsp;&nbsp;<button  style="background:white"  title="Save modified code. After saving, to test the code, click 'Test'." 
onclick=save()>Save</button>
<input style="display:none" type="submit" name="Test" title="Click me to check.">

<button style="background:white" title="After saving, to check the code, click me." 
onclick=form.elements('Test').click() >Test</button>


&nbsp;&nbsp;&nbsp;
<button  onclick="window.close()" style="background:white" title="Close the form">&nbsp;&nbsp;X&nbsp;&nbsp;</button>
<input type=hidden name="im" value="<?php echo $im; ?>">
<input type=hidden name="file" value="<?php echo $file; ?>">
<input type=hidden name="tip" value="<?php echo $tip; ?>">
</nobr>
</form>
<table id=tab border=0 width=100% HEIGHT=100% ><tbody>
<tr>
<td align=center >MESSAGES
</td>
</tr>
<tr>
<td valign=top height=30% width=100% id=cen align=center>
<div  style="height:150px;width:1000;OVERFLOW: scroll;background:#ffefd5">
<?php
if (isset ($_REQUEST['Test'])) 
{
$fi=getcwd ( )."/".str_replace("../","",$file);
$h = file($fi);  //
if (strstr($file, ".php"))    //
{
$ttest="";
for ($i = 1; $i <= count($h)-2; $i++) 
{$ttest=$ttest.trim($h[$i])."\r\n";}
eval($ttest);                 //
echo "<br><br><b style=color:red>END OF TESTING!</b>";
}
else
{
echo "<br><br><b style=color:red>Tested by pressing an inserted button!</b>";
}
}
if (isset ($_REQUEST['Save'])) 
{
$stt=explode("\r\n", trim($_REQUEST['stru'])); //
$filename=getcwd ( )."/".str_replace("../","",$file);
$h = fopen($filename, 'w+') or exit;	//
foreach ($stt as $li => $lin)
{
$st2=str_replace('\"','"',$lin);
$st2=str_replace("\'","'",$st2);

//$st2=$lin;
fwrite($h,$st2."\r\n");
}
fclose($h); 					// 
echo "<br><br><b style=color:red>SAVED!</b>";
 }





?>
</div>
</td></tr>
<tr><td align=center>THE CODE
</td></tr>
<tr><td height=100% valign=top align=center>
<?php 
$fi=getcwd ( )."/".str_replace("../","",$file);
$h = file($fi) or exit;	//
?>
<nobr>
<textarea id=npp style="position:relative;height:80%;width:40;top:0;left:0; overflow: hidden;border:none 2mm none">
<?php 
if (strstr($file, ".php"))
{
for ($i = 1; $i <= count($h)-2; $i++) 
{echo($i)."\r\n";}
}
else
{
for ($i = 0; $i <= count($h)-1; $i++) 
{echo($i)."\r\n";}
}
?>
</textarea>
<textarea wrap=off cols=115  id=kod onscroll=document.getElementById('npp').scrollTop=this.scrollTop 
style="position:relative;height:80%;top:0;left:0;border:none 2mm none">
<?php 
if (strstr($file, ".php"))
{
for ($i = 1; $i <= count($h)-2; $i++) 
{echo $h[$i];}
}
else
{
for ($i = 0; $i <= count($h)-1; $i++) 
{
echo $h[$i];
}
}
?>
</textarea></nobr>
</td>
</tr></tbody></table>
 </body>
<script type="text/javascript">
//*******************************
window.onload=function ()
//******************************
{
}
//***************************************************
function save()  //
//***************************************************
{
//
mtt=document.getElementById("kod").value.split("\r\n")
len=parseInt(document.getElementById("kod").cols)

if (document.getElementById("ifa").innerHTML.indexOf(".php")>0)
{zap="<"+"?php\r\n"}
else
{zap=""}

for(var j = 0; j <mtt.length; j++)
{if (false)   //(mtt[j].length>len)
{zap=zap+mtt[j].substr(0,len)+"\r\n"
zap=zap+mtt[j].substr(len)+"\r\n"
}
else
{
if (j==(mtt.length-1))
{zap=zap+mtt[j]}
else
{
zap=zap+mtt[j]+"\r\n"
}
}
}
if (document.getElementById("ifa").innerHTML.indexOf(".php")>0)
{zap=zap+"?>\r\n"}
//
form.elements('stru').value=zap
form.elements('Save').click()   //
}
</script>
 </html>