<?php header('Content-Type: text/html; charset=windows-1251'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<META http-equiv=Content-Type content="text/html; charset=windows-1251">
<html>
<head>
</head>
<body style="background:#fffacd">
<form id="fzk"  method="POST" enctype="multipart/form-data" action="zk.php" style="position:absolute;top:0;left:0;width:100%">
<b id=ppas>Password&nbsp;&nbsp;
<input type="password" name="zk_pass" size="10" value="<?php  echo $_REQUEST['zk_pass'];?>">
</b>
<input name=zk0 type="button" style="background:#808080;color:yellow;display:none" onclick=zk_v(0) title="" value="V">
<input name=zk1 type="button" style="background:#808080;color:yellow;display:none" onclick=zk_v(1) title="" value=" ? ">
<input name=zk_red type="button" style="background:#c0c0c0;FONT-WEIGHT: bold" onclick=zk_v(2) title="Edit note" value="Edit">
<input name=zk_sav  type="button" style="background:#c0c0c0;FONT-WEIGHT: bold;display:none" onclick=zk_v(3) title="" value="Save">
<input name=zk_open   type="button" style="background:#c0c0c0;FONT-WEIGHT: bold;" onclick=zk_v(5) title="Open in a big window" value="Open">
<input type="hidden" name=zk_m value="<?php echo $_REQUEST['zk_m']; ?>">
<input type="hidden" name=zk_tip value="<?php echo $_REQUEST['zk_tip']; ?>">
<input type="submit" value="send" name="zk_sub" style="width:50px;background:transparent;visibility:hidden">
<div id=zk_sz style="overflow:scroll;HEIGHT:190px"  width=80%>
<?php
if (isset($_REQUEST['zk_tip']))   //
{$zktip=$_REQUEST['zk_tip'];}
else
{$zktip="";die("No request type.");}
$l = file(getcwd ( ).'/p.html'); 	//
foreach ($l as $li => $lin)         //
{if ($li==0)                        //
{$pass=$lin;}}
if ($pass=="")
{echo "NO PASSWORD!";die;}

if (isset($_REQUEST['zk_pass']))   //
{$pass1=trim($_REQUEST['zk_pass']);}

if ($pass==md5("1",false) or (strlen($pass)<32 and $zktip!=3))        // 
{$pp=true;}
else
{$pass1=md5($pass1,false);        //
if (strlen($pass)==32)            //
{}
else                              //
{$pass1=substr($pass1,3);}

if (trim($pass1) == trim($pass)) 
{$pp=true;}
else
{
if (trim($_REQUEST['zk_pass'])!="")
{echo "ENTER THE CORRECT PASSWORD!";$pp=false;}
else
{
if ($zktip==3) 
{echo "Enter your password to edit!";$pp=false;}
else
{echo "To access, enter the password!";$pp=false;}
}
}}

if ($pp)                               // 
{
if (isset($_REQUEST['zk_tip']))        // 
{$zktip=$_REQUEST['zk_tip'];}
else
{$zktip="";die("No request type.");}
if (isset($_REQUEST['zk_m']))          //
{$zkm=$_REQUEST['zk_m'];}
else
{$zkm="";die("There is no parameter m (bookmark).");}
if ($zktip==0)
//*********************************
// 
//*********************************
{
echo '<textarea name="zkhtml" rows=8  id=zk_e style="background:#e0ffff;width:92%;OVERFLOW: scroll;height:165;display:none">???</textarea>';
$scf="1.html,2.html,3.html,4.html,5.html,6.html,7.html,8.html,9.html,10.html,11.html,12.html,13.html,14.html,15.html,16.html,17.html,18.html,19.html,20.html,21.html,22.html,23.html,24.html,25.html,26.html,27.html,28.html,29.html,30.html,31.html,32.html,33.html,34.html,35.html,36.html,37.html,38.html,39.html,40.html,41.html,42.html"; 
$tag1=explode(',',$scf);                //
foreach ($tag1 as $k => $z)             //
{
if ($k==0)
{
echo "<b style=color:white;background:green> B O O K M A R K S: </b><br>";
}
$l = file(getcwd ( ).'/'.$z); 	        //
foreach ($l as $li => $lin)             //
{
echo $lin;
}
echo "<hr>";
}}


if ($zktip==1)
//***********************************
//
//***********************************
{$l = file(getcwd ( ).'/'.$zkm.'.html'); 	   //
foreach ($l as $li => $lin)                    //
{if ($li==0)                                   //
{
echo $lin;
echo '<textarea name="zkhtml" rows=8  id=zk_e style="background:#e0ffff;width:92%;OVERFLOW: scroll;height:165;display:none">';
} 
else
{echo $lin;
}}
echo '</textarea>';
foreach ($l as $li => $lin)                    //
{ if ($li>0)  {echo $lin;}
}}

//*************************************
//
//*************************************
if ($zktip==3)
{if (isset ($_REQUEST['zkhtml'])) 
{$tex=$_REQUEST['zkhtml'];
}
else
{$tex="";}
$l = file(getcwd ( ).'/'.$zkm.'.html'); 	            // 
$w = fopen(getcwd ( ).'/'.$zkm.'.html',"w") or exit; 	// 
 foreach ($l as $li => $lin)                            // 
 {  if ($li==0)     //
  {fwrite($w,$lin);}
  else               
  {fwrite($w,""); } //
  } 
$tex=str_replace("\r\n","",$tex);
fwrite($w,$tex);
fclose($w);
$l = file(getcwd ( ).'/'.$zkm.'.html'); 	   //
foreach ($l as $li => $lin)                    //
{if ($li==0)                                   //
{echo $lin;									   //
echo '<textarea name="zkhtml" rows=8  id=zk_e style="background:#e0ffff;width:92%;OVERFLOW: scroll;height:165;display:none">';
} 
else
{echo $lin;
}}
echo '</textarea>';
foreach ($l as $li => $lin)                    //
{ if ($li>0)  {echo $lin;}
}
}}
?>
</div>
</form>
</body>

<script type="text/javascript">

function zk_v(p)
{
//*************************************
//
if (p==0)
//*************************************
{
window.top.document.getElementById('cbzip').style.visibility="hidden"
window.top.document.getElementById('zip12').style.visibility="hidden"
window.top.document.getElementById('zip10').style.visibility="hidden"
fzk.elements["zk_m"].value=window.top.document.getElementById('zkz').title
fzk.elements["zk_tip"].value="0"   // 
fzk.elements["zk_sub"].click()     //
}
if (p==1)
//***************************
//
//***************************
{fzk.elements["zk_m"].value=window.top.document.getElementById('zkz').title
fzk.elements["zk_red"].style.display=""
fzk.elements["zk_tip"].value="1"   //
fzk.elements["zk_sub"].click()     //
}

if (p==2)
//********************************
//
//********************************
{
if (document.all["zk_e"]==undefined)   //
{alert("No bookmark selected!");}
else
{
fzk.elements["zk_sav"].style.display=""
fzk.elements["zkhtml"].style.display=""
window.top.document.getElementById('zii').style.top=window.top.document.getElementById('bod').scrollTop
fzk.elements["zkhtml"].style.display="";
fzk.elements["zk_tip"].value="2";
}}

if (p==3)
{
//************************
//
//************************
if (document.all["zk_e"]==undefined) 
{alert("No bookmark selected!");}
else
{
if (fzk.elements["zkhtml"].style.display=="none")
{alert("Save only after editing!");}else{
fzk.elements["zk_m"].value=window.top.document.getElementById('zkz').title;
fzk.elements["zk_tip"].value="3"   //
fzk.elements["zk_sub"].click()     //
}}}

if (p==5)
//*************************************
// 
//*************************************
{

if (document.all["zk_e"]==undefined) 
{
return;
}
if (window.top.mob)    //
{
window.top.knn=window.top.document.getElementById('bod').scrollTop
window.top.document.getElementById('bod').scrollTop=0
window.top.document.getElementById('zii').style.top=0
window.top.document.getElementById('zip').style.top=0
window.top.document.getElementById('gii').style.top=0
window.top.document.getElementById('gip').style.top=0
}
window.top.document.getElementById('cbzip').style.visibility="hidden"
window.top.document.getElementById('zip12').style.visibility="hidden"
window.top.document.getElementById('zip10').style.visibility="hidden"
//
if (document.all["zk_e"]!=undefined && document.getElementById('zk_e').style.display=="")  //
{
window.top.document.getElementById('zip').style.top=window.top.document.getElementById('bod').scrollTop
imz='0123456789ABCDEFGHJKLMNOPQRSTUVWXYZabcdef!'; 
poz=parseInt(fzk.elements["zk_m"].value);
pro=imz.substr(poz-1, 1);
window.top.document.getElementById('ziiza').innerHTML="&nbsp;&nbsp;&nbsp;"+pro+"&nbsp;&nbsp;&nbsp;";
window.top.document.getElementById('zii').style.display="";  //
window.top.document.getElementById('ppp').style.visibility="visible";
window.top.document.getElementById('ziir').value=document.getElementById('zk_e').value;
window.top.document.getElementById('tde2').innerHTML=window.top.document.getElementById('zkz').title;
window.top.document.getElementById('but2').click()           //
}
else
{if (fzk.elements["zk_tip"].value==0)    //
//************************************
//
{
window.top.document.getElementById('zip').style.display="";  
window.top.document.getElementById('ppp').style.visibility="visible";
window.top.document.getElementById('zip1').innerHTML=document.getElementById('zk_sz').innerHTML;
window.top.document.getElementById('tde2').innerHTML="ALL"
window.top.document.getElementById('zip1').scrollTop=0;
}
}
if (fzk.elements["zk_tip"].value==1 || fzk.elements["zk_tip"].value==3)   //
{
window.top.document.getElementById('cbzip').style.visibility="visible"
window.top.document.getElementById('zip12').style.visibility="visible"
window.top.document.getElementById('zip10').style.visibility="visible"

window.top.document.getElementById('tde2').innerHTML=window.top.document.getElementById('zkz').innerHTML;
window.top.document.getElementById('zip').style.display=""; 
window.top.document.getElementById('ppp').style.visibility="visible";
window.top.document.getElementById('zip1').innerHTML=document.getElementById('zk_sz').innerHTML;
window.top.document.getElementById('zip').style.top=window.top.document.getElementById('bod').scrollTop
window.top.document.getElementById('zip').style.top=window.top.document.getElementById('bod').scrollTop
window.top.document.getElementById('zip').style.top=window.top.document.getElementById('bod').scrollTop
}
}
}

//********************************************
// 
window.onload=function ()
{<?php
if ($pass==md5("1",false))        //
{echo 'document.getElementById("ppas").style.display="none";';}
if ($zktip==0)
{echo 'fzk.elements["zk_red"].style.display="none";';}
?>
}
</script>
</body></html>
