Вход Регистрация
Файл: edit.php
Строк: 293
<?php
error_reporting
(0);
$k=trim($_GET['k']); include("key.php");
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if (
$d==NULL) {$d="";} elseif ($d=="/") {$d="";} if ($n==NULL) {$n="";}
$p=trim($_GET['p']); $ed=trim($_GET['ed']);
$kdr=trim($_GET['kdr']); $ikdr=trim($_GET['ikdr']);
$rf=strtolower(preg_replace("~.*.([^.]*)~m","\1",$n));
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
include(
"utf.php"); include("esc.php"); include("koi.php"); $soft2=""$v=$_GET['ln'];
if ((
$rf=="wml")||($rf=="htm")||($rf=="html")||($rf=="txt")) {
$soft2="<a accesskey="5" title="view" href="show.php?k=$k&amp;t=$rf">View</a>&nbsp;";
} elseif (
$rf=="php") {
$soft2="<a accesskey="5" title="view" href="chck.php?k=$k">Check</a>&nbsp;";
}
$title="Editing ".$n;
include(
"inc/head.php");
if (
$ed==1) {@unlink("data/$k.edbk"); @unlink("data/$k.edbkp"); @unlink("data/$k.ed");
if ((
$ftp=ftp_connect($sr))&&(ftp_login($ftp,$lg,$ps))) {
ftp_pasv($ftp,true); $sz=ftp_size($ftp,"$d/$n");
if ((
$sz==-1)||($sz>322880)) {
header("Location: ftp.php?k=$k&d=$rd"); exit;
}
ftp_get($ftp,"data/$k.ed","$d/$n",FTP_BINARY);
$fl=@file("data/$k.ed");
if (
$fl<>NULL) {
$f=fopen("data/$k.ed","w");
for (
$i=0;$i<count($fl);$i++) {
if (
$i==0) {
if (
substr($fl[$i],0,3)==chr(239).chr(187).chr(191)) {$fl[$i]=substr($fl[$i],3);}
}
if (
$kdr==5) {fwrite($f,trim($fl[$i])."rn");}
else {
if (
$ikdr==1) {fwrite($f,trim(k2u($fl[$i]))."rn");}
else {
fwrite($f,trim(w2u(e2w(u2w($fl[$i]))))."rn");}
}
}
fclose($f);
$msz=$_GET['msz'];
if (
$msz<>NULL) {
if (
$msz>1024) {$msz=1024;}
if (
$msz>=32) {
$fl=@file("data/$k.ed");
$f=fopen("data/$k.ed","w");
for (
$i=0;$i<count($fl);$i++) {
if (
strlen($fl[$i])>$msz) {
$fl[$i]=trim(preg_replace("~.{".$msz."}[s;}>,]~m","\0rn",trim($fl[$i])))."rn";
}
fwrite($f,$fl[$i]);
}
}
fclose($f);
}
}
ftp_close($ftp);
} else {
echo(
"<p class="rmenu" align="center"><small>
no connection.</p>"
);
include(
"inc/foot.php"); exit;
}
}
$d=str_replace('$','$',$d); $n=str_replace('$','$',$n);
$sv=trim($_GET['sv']); $svs=trim($_GET['svs']); $undo=trim($_GET['undo']);
if ((
$v==NULL)||($v<1)||($v>50)) {$v=7;}
function 
rept($kl) {
if ((
$kl[1]<>NULL)&&($kl[1]!=="0")&&($kl[1]<=50)) {return str_repeat("rn",$kl[1]);}
else {return 
$kl[0];}
}
function 
lcopy($nmr) {global $k;
$fl=@file("data/$k.ed");
$cnt=count($fl);
if ((
$nmr[1]>=1)&&($nmr[1]<=$cnt)) {return trim($fl[$nmr[1]-1]);}
else {return 
$nmr[0];}
}
function 
chars($ch) {
global 
$kdr;
if ((
$ch[1]>=0)&&($ch[1]<=255)) {
if (
$kdr==5) {return chr($ch[1]);}
else {return 
w2u(chr($ch[1]));}
} else {return 
$ch[0];}
}
function 
repl($txt) {
$txt=preg_replace_callback("~#_new_line_[(d*)]#~",rept,$txt);
$txt=preg_replace_callback("~#_copy_[(d*)]#~",lcopy,$txt);
$txt=preg_replace("~
~"
,"rn",$txt);
$txt=str_replace('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.0//EN" "http://www.wapforum.org/DTD/wml_1.0.xml">','<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.0//EN" "http://www.wapforum.org/DTD/wml_1.0.xml">',$txt);
$txt=str_replace('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.xml">','<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.xml">',$txt);
$txt=str_replace('<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">','<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">',$txt);
$txt=str_replace('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">','<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">',$txt);
$txt=str_replace('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">','<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',$txt);
$txt=str_replace('header("Content-type: text/vnd.wap.wml; charset=utf-8");','header("Content-type: text/vnd.wap.wml; charset=utf-8");',$txt);
$txt=str_replace('header("Content-type: text/html; charset=utf-8");','header("Content-type: text/html; charset=utf-8");',$txt);
$txt=str_replace('header("Content-type: text/plain; charset=utf-8");','header("Content-type: text/plain; charset=utf-8");',$txt);
$txt=str_replace('<wml><card id="card1" title=""><p align="left">','<wml><card id="card1" title=""><p align="left">',$txt);
$txt=str_replace("</p></card></wml>","</p></card></wml>",$txt);
$txt=str_replace('<html><head><title></title><meta http-equiv="Content-type" content="text/html; charset=utf-8"></head><body>','<html><head><title></title><meta http-equiv="Content-type" content="text/html; charset=utf-8"></head><body>',$txt);
$txt=str_replace("</body></html>","</body></html>",$txt);
$txt=str_replace('<link rel="STYLESHEET" type="text/css" href=".css">','<link rel="STYLESHEET" type="text/css" href=".css">',$txt);
$txt=str_replace('header("Location: http://"); exit;','header("Location: http://"); exit;',$txt);
$txt=str_replace('date("d.m.Y, H:i:s",mktime(date("H")+0));','date("d.m.Y, H:i:s",mktime(date("H")+0));',$txt);
$txt=preg_replace_callback("~#_(d{1,3})#~",chars,$txt);
return 
$txt;
}
if (
$undo<>NULL) {
@
copy("data/$k.edbk","data/$k.ed");
$p=trim(@file_get_contents("data/$k.edbkp"));
@
unlink("data/$k.edbk"); @unlink("data/$k.edbkp");
} else {
if (
$sv<>NULL) {
@
copy("data/$k.ed","data/$k.edbk");
$f=@fopen("data/$k.edbkp","w"); @fwrite($f,$p); @fclose($f);
$e1=trim(stripslashes($_POST['e1'])); $e2=trim(stripslashes($_POST['e2']));
$e3=trim(stripslashes($_POST['e3'])); $e4=trim(stripslashes($_POST['e4']));
$e5=trim(stripslashes($_POST['e5'])); $e6=trim(stripslashes($_POST['e6']));
$e7=trim(stripslashes($_POST['e7'])); $e8=trim(stripslashes($_POST['e8']));
$e9=trim(stripslashes($_POST['e9'])); $e10=trim(stripslashes($_POST['e10']));
$e11=trim(stripslashes($_POST['e11'])); $e12=trim(stripslashes($_POST['e12']));
$e13=trim(stripslashes($_POST['e13'])); $e14=trim(stripslashes($_POST['e14']));
$e15=trim(stripslashes($_POST['e15']));
if ((
$e1<>NULL)||($e2<>NULL)||($e3<>NULL)||($e4<>NULL)||($e5<>NULL)||($e6<>NULL)||
(
$e7<>NULL)||($e8<>NULL)||($e9<>NULL)||($e10<>NULL)||($e11<>NULL)||($e12<>NULL)||
(
$e13<>NULL)||($e14<>NULL)||($e15<>NULL)) {
if (
$fl=@file("data/$k.ed")) {$cnt=count($fl);
$begin=$sv*$v-$v; if ($begin>$cnt) {$begin=0;}
$end=$begin+$v; if ($end>$cnt) {$end=$cnt;} $ar=NULL$nm=1$str="";
for (
$i=$begin;$i<$end;$i++) {$fl[$i]=repl(${"e$nm"}."rn"); $nm++;}
for (
$i=0;$i<count($fl);$i++) {$str.=$fl[$i];}
if (
strpos($str,"
"
)!==false) {
$str=preg_replace("~[s]*
[s]*~"
,"rn",$str);
}
if (
strpos($str,"~","",$str));
}
if (
strpos($str,"")!==false) {
$str=str_replace("","",$str);
$str=str_replace("nr","",$str);
}
$f=@fopen("data/$k.ed","w"); @fwrite($f,repl(trim($str))); @fclose($f); $str=NULL;
}
}
}
if (
$svs<>NULL) {
if (
$kdr==1) {copy("data/$k.ed","data/$k.eds");}
else {
$fl=@file("data/$k.ed");
@
$f=fopen("data/$k.eds","w");
if (
$fl<>NULL) {
for (
$i=0;$i<count($fl);$i++) {
if (
$kdr==2) {@fwrite($f,trim(u2w($fl[$i]))."rn");}
elseif (
$kdr==3) {@fwrite($f,trim(w2e(u2w($fl[$i])))."rn");}
elseif (
$kdr==4) {@fwrite($f,trim(u2k($fl[$i]))."rn");}
else {@
fwrite($f,trim($fl[$i])."rn"); $msg="<div class="rmenu" style="color:red" align="center"><b>Has been saved..!!</b></div>";}
}
}
@
fclose($f);
}
if ((
$ftp=ftp_connect($sr))&&(ftp_login($ftp,$lg,$ps))) {
@
ftp_pasv($ftp,true);
@
ftp_put($ftp,str_replace('$$','$',"$d/$n"),"data/$k.eds",FTP_BINARY);
@
ftp_close($ftp);
} else {
echo(
"<p class="rmenu" align="center">No Connection</p>");
include(
"inc/foot.php"); exit;
}
@
unlink("data/$k.eds");
}
$bl=""$nav="";
if (
$fl=@file("data/$k.ed")) {$cnt=count($fl); $allp=ceil($cnt/$v);
if ((
$p==NULL)||($p==0)) {$p=1;} elseif ($p>$allp) {$p=$allp;} elseif ($p<1) {$p=1;}
$begin=$p*$v-$v; if ($begin>$cnt) {$begin=0;}
$end=$begin+$v; if ($end>$cnt) {$end=$cnt;} $ar=NULL$vl=$end-$begin;
function 
chrpl($str) {
for (
$j=0;$j<32;$j++) {
if ((
$j<>10)&&($j<>13)) {$str=str_replace(chr($j),"#_$j#",$str);}
}
return 
$str;
}
for (
$i=$begin;$i<$end;$i++) {
if (
strpos(strtolower(getenv("HTTP_USER_AGENT")),"sonyericssonk")!==false) {
$ar[]=str_replace('$','$',htmlspecialchars(chrpl($fl[$i]),ENT_QUOTES));
} else {
$ar[]=str_replace('$','$',htmlspecialchars(chrpl($fl[$i]),ENT_QUOTES));
}
}
 if (
$p>1) {$vp=$p-1;
$bl.="<a href="edit.php?k=$k&amp;d=$rd&amp;n=$rn&amp;p=$vp&amp;kdr=$kdr&amp;ln=$v"><font color="red"><b>&lt;&lt;</b></font></a> |rn";} elseif ($allp>$p) {$bl.="<b>&lt;&lt;</b> | ";}
  if (
$allp>$p) {$vp=$p+1;
$bl.="<a href="edit.php?k=$k&amp;d=$rd&amp;n=$rn&amp;p=$vp&amp;kdr=$kdr&amp;ln=$v"><font color="red"><b>&gt;&gt;</b></font></a>rn";} elseif ($p>1) {$bl.="<b>&gt;&gt;</b><br/>rn";}
if (
$bl<>NULL) {$bl="$bl";
$nav="<div><form action="edit.php" method="get"><input type="hidden" name="k" value="$k"/><input type="hidden" name="d" value="$rd"/><input type="hidden" name="n" value="$rn"/><input type="hidden" name="kdr" value="$kdr"/><input type="hidden" name="ln" value="$v"/><input type="text" name="p" value="$p" size="3" maxlength="3" format="*N"/><input type="submit" value="GO"/></form></div>rn";}
} else {
$p=1$allp=1$ar[]=""$vl=1;}$soft="$soft2<a accesskey="1" title="code" href="show.php?k=$k&amp;t=pr">Code</a>&nbsp;<a accesskey="2" title="code 2.0" href="show.php?k=$k&amp;t=pr2">Code2.0</a>&nbsp;";
echo(
"<div class="gmenu"><a href="ftp.php?k=$k&amp;d=$rd">$d/</a><a href="file.php?k=$k&amp;d=$rd&amp;n=$rn">$n</a></div><div class="bmenu"><b>$title</b></div>
$msg
<div class="
menu">");
echo(
"<form action="edit.php?k=$k&amp;d=$rd&amp;n=$rn&amp;ln=$v&amp;p=$p&amp;kdr=$kdr&amp;sv=$p&amp;svs=1" method="post">");
for (
$i=1;$i<=$vl;$i++) {
echo(
"<textarea name="e".$i."" title="".$i."(".($begin+$i).")">".trim($ar[$i-1])."</textarea><br/>rn");
}
echo(
"<input class="submit" type="submit" value="Save"/></form><br/>");
echo(
"$bl<br/>$nav<br/> 
pages: 
$p/$allp lines: $vl/$cnt<br/></div>");
echo(
"<div class="phdr"><b>Actions:</b></div>");
echo(
"<p class="menu">$soft<a href="func.php?k=$k&amp;d=$rd&amp;n=$rn&amp;kdr=$kdr&amp;h=&amp;p=$p&amp;ln=$v" accesskey="3">Option</a>&nbsp;");
if (@
file_exists("data/$k.edbk")) {echo("<a href="edit.php?k=$k&amp;d=$rd&amp;n=$rn&amp;kdr=$kdr&amp;undo=1&amp;ln=$v" accesskey="4">Undo</a>");}
echo(
"</p>");
include(
"inc/foot.php");
?>
Онлайн: 1
Реклама