admin 管理员组

文章数量: 1184232


2024年3月6日发(作者:二维数组名)

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

function _get($str){ $val = !empty($_GET[$str]) ? $_GET[$str] : ""; return $val; } //DESCRIB (): END@()

function _post($str){ $val = !empty($_POST[$str]) ? $_POST[$str] : ""; return $val; } //DESCRIB (): END@()

function _server($str){$val = !empty($_SERVER[$str]) ? $_SERVER[$str] : ""; return $val; }//DESCRIB (): END@()

function _cookie($str){$val = !empty($_COOKIE[$str]) ? $_COOKIE[$str] : ""; return $val; }//DESCRIB (): END@()

function _session($str){$val = !empty($_SESSION[$str]) ? $_SESSION[$str] : ""; return $val; }//DESCRIB (): END@()

function beforestr($fstring,$fg){

$tmpstst=explode($fg,$fstring);

$tottmp=count($tmpstst);

$fmxxx="";

for ($ix=0;$ix<$tottmp-2;$ix++){

$fmxxx=$fmxxx.$tmpstst[$ix].$fg;

};

$fmxxx=$fmxxx.$tmpstst[$tottmp-1];

return $fmxxx;

}

function base64EncodeImage($image_file) {

$base64_image = '';

$image_info = getimagesize($image_file);

$image_data = fread(fopen($image_file, 'r'), filesize($image_file));

$base64_image = 'data:' . $image_info['mime'] . ';base64,' . chunk_split(base64_encode($image_data));

return $base64_image;

}

function b64tofile($base64_image_content,$path,$fname){

if (preg_match('/^(data:s*image(w+);base64,)/', $base64_image_content, $result)){

$type = $result[2];

if ($fname==""){

$new_file = combineurl($path,"/".date('Ymd',time())."/");

}else{

$new_file = combineurl($path,"/");

};

if(!file_exists($new_file)){

mkdir($new_file, 0700);

}if ($fname==""){

$new_file = $new_().".{$type}";

}else{

$new_file = $new_file.$fname.".{$type}";

};if (file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64_image_content)))){

return $new_file;

}else{

return false;

}}else{

return false;

}} //匹配出图片的格式

Function cdfile($rurl,$lcfile){

$ch=curl_init($rurl);

$downloadPath=$lcfile;

$downloadPathName=$downloadPath;

$lcpath=urltopath($lcfile);

is_dir($lcpath) OR mkdir($lcpath, 0777, true);

$fp=fopen($downloadPathName,'wb') or die('open failed!');

1

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

function checkBOM($strtxt) {

$charset[1] = substr($strtxt, 0, 1);

$charset[2] = substr($strtxt, 1, 1);

$charset[3] = substr($strtxt, 2, 1);

if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {

return substr($strtxt, 3);

} else {

return $strtxt;

};

}

function check_gifcartoon($image_file){

$fp = fopen($image_file,'rb');

$image_head = fread($fp,1024);

fclose($fp);

return preg_match("/".chr(0x21).chr(0xff).chr(0x0b).'NETSCAPE2.0'."/",$image_head)?false:true;

}

function conturn($mstr){

$mstr=str_replace("{","[",$mstr);$mstr=str_replace("}","]",$mstr);

return $mstr;

}

function combineurl($qu,$hu){

If (substr($qu,-1)=="/"){

$qu=killlaststr($qu);}

if (substr($hu,0,1)=="/"){

return $qu.$hu;

}else{

return $qu."/".$hu;

}

}//DESCRIB (): END@()

function comburl($qurl,$hurl){

if (substr($hurl,0,1)=="/"){

return $($hurl,1,strlen($hurl)-1);

}else{

return $qurl.$hurl;

}

}//DESCRIB comburl(): 合并两个地址 ENDcomburl@()

function connurl($bpath,$curl){

if (strpos("xxx".$curl,"../")>0){

$ptcu=explode("../",$curl);

$totmin=count($ptcu);

}else{

$totmin=0;

}

if (substr($bpath,-1)!="/"){

$bpath=$bpath."/";

}

curl_setopt($ch,CURLOPT_FILE,$fp);

curl_setopt($ch,CURLOPT_HEADER,0);

$res=curl_exec($ch);curl_close($ch);fclose($fp);

2

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$ptba=explode("/",$bpath);

$totptb=count($ptba);$fmurl="";

if ($totmin>0){

for ($i=0;$i<($totptb-$totmin);$i++){

$fmurl=$fmurl.$ptba[$i]."/";

}

}else{

$fmurl=$bpath;

};

$curl=str_replace("../","",$curl);

return $fmurl.$curl;

}//DESCRIB connurl(): 相对地址合并 END@connurl()

function countkey($fullresult){

$keyname=qian($fullresult,"#/#");

$partkn=explode("#-#",$keyname);

$countkn=count($partkn);return $countkn;

}//DESCRIB (): END@()

function countresult($fullresult){

$partkn=explode("#/#",$fullresult);

$countkn=count($partkn);

return $countkn-2;

}//DESCRIB (): END@()

function CLASSX($clsid){

if (strpos("xxx"._post("clsadd"),$clsid."/")>0){

$clsxyz="";$clsrst="";

}else{

$clsrst=SX("select funfull,oldfull from coode_phpcls where funname='".$clsid."' or funname='".$clsid."()'");

$totcls=countresult($clsrst);

if (intval($totcls)>0 and anyvalue($clsrst,"funfull",0)!=""){

$clsxyz=anyvalue($clsrst,"funfull",0); $oldxyz=anyvalue($clsrst,"oldfull",0);

}else{

3

$clsxyz=file_get_contents("".glm()."/DNA/EXF/?fid=getmothercls®code=".glr()."&clsid=".str_replace("()","",$clsid));

$oldxyz=$clsxyz;

if (intval($totcls)==0){

$x=UX("insert

(),'".onlymark()."','php','".$clsxyz."','".$oldxyz."','".$oldxyz."','coode')");

}else{

$x=UX("update coode_phpcls set funfull='".$clsxyz."',oldfull='".$clsxyz."',lastfull='".$clsxyz."' where funname='".$clsid."' or

funname='".$clsid."()'");

};

};

if ($oldxyz==$clsxyz){

$clsrst=tostring($clsxyz);

}else{

$clsrst=tostring($oldxyz);

};

};

if (_post("clsadd")==""){

into

coode_phpcls(funname,CRTM,UPTM,OLMK,lang,funfull,oldfull,lastfull,CRTOR)values('".str_replace("()","",$clsid)."()',now(),now

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50 }

};

if (_post("clsadd")==""){

$_POST["clsadd"]=$clsid."/";

}else{

$_POST["clsadd"]=$_POST["clsadd"].$clsid."/";

}

return $clsrst;

}//DESCRIB ():也可以远程获取class如果已存在了运行了一次就不在运行 END@()

function dfp(){

return "/ORG/BRAIN/images/icon/system/%E9%85%B7%E5%BE%";

}// 缺省图片显示

function extname($srcstr){

if (strpos($srcstr,".")>0){

$ptsrc=explode(".",$srcstr);

$totpt=count($ptsrc);

return $ptsrc[$totpt-1];

}else{

return "";

}

}//DESCRIB extname(): 地址取扩展名 END@extname()

function enstrrn($gfstring){

$ftxt=str_replace("rn","-r-n",$gfstring);

return $ftxt;

}//第三维,在PHP里换行状态的要变成JSHTML的换行状态

function exchangercv($tbnm,$pagekey,$datakey,$methd,$snx){

$ptpk=explode(",",$pagekey);

$ptdk=explode(",",$datakey);

$totp=count($ptpk);

if ($methd=="post"){

for ($i=0;$i<$totp;$i++){

$_POST["p_".$ptdk[$i].$snx]=_post($ptpk[$i]);

}

}else{

for ($i=0;$i<$totp;$i++){

$_POST["p_".$ptdk[$i].$snx]=_get($ptpk[$i]);

}

}

return $clsrst;

}//DESCRIB ():也可以远程获取 如果已存在了运行了一次就不在运行 class END@()

function CLASSY($clsid){

if (strpos("xxx"._post("clsadd"),$clsid."/")>0){

$clsxyz="";

$clsrst="";

}else{

$_POST["clsadd"]=$clsid."/";

}else{

$_POST["clsadd"]=$_POST["clsadd"].$clsid."/";

4

$clsxyz=UX("select funfull as result from coode_phpcls where funname='".$clsid."' or funname='".$clsid."()'");

$clsrst=tostring($clsxyz);

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$dz=anyrcv($tbnm,$datakey,$snx,"");

return $dz;

}//DESCRIB (): END@()

function fmpost($garr=array(array()),$gsno,$gtnm,$gkies){

eval(CLASSX("formpost"));

$fmp=new formpost();

return $fmp->fmpost($garr=array(array()),$gsno,$gtnm,$gkies);

}//DESCRIB (): END@()

function gl(){return "localhost";}//DESCRIB glb():本系统mysql 数据库IP END@glb()

function glu(){return "root";}//DESCRIB glu():本系统mysql 数据库用户名 END@glu()

function glp(){return "root";}//DESCRIB glp():本系统mysql 数据库密码 END@glp()

function glb(){return "root";}//DESCRIB glb():本系统mysql 数据库 END@lgb()

function gln(){return "coode";}//DESCRIB gln():当前使用系统名称 END@gln()

function glt(){return "blueprints@localhost";}//DESCRIB glt():当前实例名称 END@glt()

function glm(){return "[motherhost]";}//DESCRIB glm():母系统域名 END@glt()

function glr(){return "[regcode]";}//DESCRIB glr():授权注册码 END@glt()

5

function glw(){return $_SERVER["HTTP_HOST"]."/";}//DESCRIB glw():本服务器域名 结尾要加/ 如果没有域名请用本机分配的固定IP,结尾也要加/ END@glw()

function get_between($input, $start, $end){$substr = substr($input, strlen($start)+strpos($input, $start),(strlen($input) - strpos($input,

$end))*(-1));return $substr;}//DESCRIB get_between(): 取字符串中间 END@get_between()

function getRandChar($length){

$str = null;$strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

$max = strlen($strPol)-1;for($i=0;$i<$length;$i++){$str.=$strPol[rand(0,$max)]; }return $str;}

function grpcid(){

$grpx=atv("(coode_sysdefault@companyid='".$_COOKIE["cid"]."').groupid");

return $grpx;

}//DESCRIB (): END@()

function hexhh2hstr($hhstr){return String2Hex(str_replace("rn","-r-n",str_replace("'","'",$hhstr)));}//DESCRIB (): END@()

function hh2hstr($hhstr){return str_replace("rn","-r-n",str_replace("'","'",$hhstr));}//DESCRIB (): END@()

function hexany2str($hexstr){if (strpos($hexstr,"TYPE_HEX:")>0){$hexstr=Hex2String(hou($hexstr,"TYPE_HEX:"));};return

str_replace("-r-n","rn",str_replace(""."'","'",$hexstr));}//DESCRIB (): END@()

function huanhang(){return "rn";}//DESCRIB (): END@()

function vfhttp($hstr){if (strpos("x".$hstr,"http")>0){ return true;}else{return false;}}//DESCRIB (检验HTTP地址): END@()

function vfhttps($hstr){if (strpos("x".$hstr,"https")>0){ return true;}else{return false;}}//DESCRIB (检验HTTPS地址): END@()

function dadenghao(){return "=";}//DESCRIB (): END@()

function dawenhao(){return "?";}//DESCRIB (): END@()

function killctrl($strx){

$strx=str_replace(""","",$strx);

$strx=str_replace(" ","",$strx);

$strx=str_replace("'","",$strx);

$strx=str_replace("<","",$strx);

$strx=str_replace(">","",$strx);

$strx=str_replace("rn","",$strx);

$strx=str_replace(" ","",$strx);

return $strx;

}

function shuangyinhao(){return """;}

function hou($fullstr,$astr){

if ($fullstr!="" and $astr!=""){

$cunzaibu=strpos("x".$fullstr,$astr);

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

}//DESCRIB (): END@()

}

}else{

return false;

}

}//DESCRIB (): END@()

function isx2($brst,$frst,$trst){

if (strpos("xx-".$brst,$frst)>0 and strpos("xx-".$brst,$trst)>0){

return true;

}else{

return false;

}

}//DESCRIB (): END@()

function iso2($brst,$frst,$trst){

if (strpos("xx-".$brst,$frst)>0 or strpos("xx-".$brst,$trst)>0){

return true;

}else{

return false;

}

}//DESCRIB (): END@()

function isx3($brst,$frst,$trst,$thrst){

if (strpos("xx-".$brst,$frst)>0 and strpos("xx-".$brst,$trst)>0 and strpos("xx-".$brst,$thrst)>0){

return true;

}else{

return false;

if ($cunzaibu>0 ){

$spos=strpos($fullstr,$astr);

$lens=strlen($astr);

$alll=strlen($fullstr);

return substr($fullstr,($spos+$lens),($alll-($spos+$lens)));

}else{

return $fullstr;

};

}else{

return "";

}

}//DESCRIB (): 完美兼容中文混合取字符串后面 END@()

6

function Hex2String($hex){$string='';for ($i=0; $i < strlen($hex)-1; $i+=2){$string .= chr(hexdec($hex[$i].$hex[$i+1]));}return

$string;}

function isen($str){ if(preg_match("/^[a-zA-Zs]+$/",$str)){return true;}else{return false;}}

function ischi($str){if (preg_match('/^[x{4e00}-x{9fa5}]+$/u', $str) > 0) {return 1;} else if (preg_match('/[x{4e00}-x{9fa5}]/u',

$str) > 0) {return 0.5;}else{return 0;}}

function isx1($brst,$frst){if (strpos("xx-".$brst,$frst)>0){return true;}else{return false;}}//DESCRIB (): END@()

function iso1($brst,$frst,$isxy){

if ($isxy==true){

if (strpos("xx-".$brst,$frst)>0){

return true;

}else{

return false;

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

function localroot(){

if (substr(str_replace("","/",$_SERVER["DOCUMENT_ROOT"]),-1)!="/"){

$gml=str_replace("","/",$_SERVER["DOCUMENT_ROOT"])."/";

}else{

$gml=str_replace("","/",$_SERVER["DOCUMENT_ROOT"]);

};

if (strpos($gml,":")>0){

$qdq=qian($gml,":");

$gml=strtoupper($qdq).":".hou($gml,":");

};

return $gml;

}//DESCRIB localroot(): 获取本地根目录 END@localroot()

function labturn($mstr){

if ( strpos("xx".$mstr,"<")>0 and strpos("xx".$mstr,">")>0){

$mstr=str_replace("{","{",$mstr);

$mstr=str_replace("}","}",$mstr);

$mstr=str_replace("<","{",$mstr);

$mstr=str_replace(">","}",$mstr);

}

return $mstr;

}//把真实代码模板化存储

function labturns($mstr){

$mstr=str_replace("{","{",$mstr);

$mstr=str_replace("}","}",$mstr);

$mstr=str_replace("<","{",$mstr);

$mstr=str_replace(">","}",$mstr);

$mstr=str_replace(""","@",$mstr);

$mstr=str_replace("'","#",$mstr);

$mstr=str_replace("OC","onclick",$mstr);

$mstr=str_replace("OC","ONCLICK",$mstr);return $mstr;

}

function lastsplit($strx,$splt){

function iso3($brst,$frst,$trst,$thrst){

if (strpos("xx-".$brst,$frst)>0 or strpos("xx-".$brst,$trst)>0 or strpos("xx-".$brst,$thrst)>0){

return true;

}else{

return false;

}

}//DESCRIB (): END@()

function killlaststr($strx){ return substr($strx,0,strlen($strx)-1);}

function killfirststr($strx){return substr($strx,1,strlen($strx)-1);}

function killlastsplit($strx,$splt){

$ptstrx=explode($splt,$strx);

$totp=count($ptstrx);

$fmxxx="";

for ($i=0;$i<$totp-1;$i++){

$fmxxx=$fmxxx.$ptstrx[$i].$splt;

}

return $fmxxx;

7

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

}else{

return "";

}

}//DESCRIB qian(): 完美兼容中文混合 END@qian()

function SX($asqlstr){

$conn=mysql_connect(gl(),glu(),glp());

return selecteds($conn,glb(),$asqlstr,"utf8","");

}//DESCRIB (): END@()

}

if ($ljx==2){

return true;

}else{

return false;

}

}//DESCRIB (): 判断是否是质数 END@()

function qian($fullstr,$astr){

if ($fullstr!="" and $astr!=""){

$cunzaibu=strpos("x".$fullstr,$astr);

if ($cunzaibu>0 ){

$astrlen=strpos($fullstr,$astr);

$fmrt=substr($fullstr,0,$astrlen);

return $fmrt;

}else{

return $fullstr;

$ptstrx=explode($splt,$strx);

$totp=count($ptstrx);

return $ptstrx[$totp-1];

}

function laststr($fstring,$fg){

$tmpstst=explode($fg,$fstring);

$tottmp=count($tmpstst);

return $tmpstst[$tottmp-1];

}//DESCRIB (): 判断是否是质数 END@()

function mrmn(){return "-r-n";}

function mysql_connect($fi,$fu,$fp){

return new mysqli($fi,$fu,$fp);

8

}//DESCRIB mysql_connect(): 连接数据库方法,如果是php5.5- 去掉此函数并修改select相关方法 END@mysql_connect()

function myfirstpos(){

$conn=mysql_connect(gl(),glu(),glp());

$fps=updatings($conn,glb(),"select

return $fps;

}//DESCRIB (): END@()

function pmenum($numx){

$ljx=0;

for ($px=1;$px<($numx+1);$px++){

if (($numx/$px)==ceil($numx/$px)){

$ljx=$ljx+1;

}

rid as result from coode_role where cid='".$_COOKIE["cid"]."' and

CRTOR='".$_COOKIE["uid"]."' and rid like '%@%' order by depart","utf8");

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

return $mstr;

}//把模板实例化使用

function toerror($etype,$emsg,$efile,$eline){

$sqla="runfile,errtime,errtype,errmsg,errfile,errline,CRTOR,CRTM,UPTM,OLMK,RIP,refer";

}

function tabstr(){return "

function turncon($mstr){

$mstr=str_replace("[","{",$mstr);

$mstr=str_replace("]","}",$mstr);

return $mstr;

}//把[]标签替换成{} 防止静态模板自己被解析,使用的时候实例化与静态有区别,不然编辑静态的时候容易出错

function turnlab($mstr){

if (strpos("xx".$mstr,"{")>0 and strpos("xx".$mstr,"}")>0 ){

$mstr=str_replace("{","<",$mstr);

$mstr=str_replace("}",">",$mstr);

$mstr=str_replace("{","{",$mstr);

$mstr=str_replace("}","}",$mstr);

";}

}

function String2Hex($string){

if (substr($string,0,10)=="dTYPE_HEX:"){

return $string;

}else{

$hex='';

for ($i=0; $i < strlen($string); $i++){

$hex .= dechex(ord($string[$i]));

}

return $hex;

9

$sqlb="'".$_SERVER['PHP_SELF']."',now(),'".$etype."','dTYPE_HEX:".String2Hex($emsg)."','".$efile."','".$eline."','".$_COOKIE["uid"]."',now(),now(),'".onlymark()."','".getip()."','".$_SERVER['HTTP_REFERER']."'";

$xz=UX("insert into coode_catcherror(".$sqla.")values(".$sqlb.")");return true;}

function trimall($str){

$qians=array(" "," ","t","n","r");

$hous=array("","","","","");

return str_replace($qians,$hous,$str);

}//DESCRIB ():删除空格 END@()

function urltopath($url){

$ptxyz=explode("/",$url);

$totp=count($ptxyz);

$lslen=strlen($ptxyz[$totp-1]);

return substr($url,0,strlen($url)-$lslen);

}//DESCRIB (): END@()

function urlfname($urlx){

$ptxyz=explode("/",$urlx);

$totp=count($ptxyz);

return $ptxyz[$totp-1];

}//DESCRIB (): END@()

function unicode_encode($name){

$name = iconv('UTF-8', 'UCS-2', $name);

$len = strlen($name);

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

function unicodeDecode($unicode_str){

$json = '{"str":"'.$unicode_str.'"}';

$arr = json_decode($json,true);

if(empty($arr)) return '';

return $arr['str'];}

function UX($asqlstr){

$conn=mysql_connect(gl(),glu(),glp());

return updatings($conn,glb(),$asqlstr,"utf8");

}//DESCRIB (): END@()

function zyferror($type, $message, $file, $line){

}

return $name;

} // 转换编码,将Unicode编码转换成可以浏览的utf-8编码

function UnicodeEncode($str){

preg_match_all('/./u',$str,$matches);

$unicodeStr = "";

foreach($matches[0] as $m){

$unicodeStr .= "&#".base_convert(bin2hex(iconv('UTF-8',"UCS-4",$m)),16,10);

}

return $unicodeStr;

}

}

}

Return $str;

}// 两个字节的文字

function unicode_decode($name){

$pattern = '/([w]+)|(u([w]{4}))/i';

preg_match_all($pattern, $name, $matches);

if (!empty($matches)){

$name = '';

for ($j = 0; $j < count($matches[0]); $j++){

$str = $matches[0][$j];

if (strpos($str, 'u') === 0){

$code = base_convert(substr($str, 2, 2), 16, 10);

$code2 = base_convert(substr($str, 4), 16, 10);

$c = chr($code).chr($code2);

$c = iconv('UCS-2', 'UTF-8', $c);

$name .= $c;

}else{

$name .= $str;

$str = '';

for($i=0;$i<$len-1;$i=$i+2){

$c = $name[$i];

$c2 = $name[$i + 1];

if (ord($c) > 0){

$str .= 'u'.base_convert(ord($c), 10, 16).base_convert(ord($c2), 10, 16);

}else{

$str .= $c2;

}

10

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

11

$rtnstr="zyferror ".date("Ymdhis")."-set_error_handler: " . $type . ":" . $message . " in " . $file . " on " . $line . " line

--".$_SERVER['PHP_SELF'].".
";

$z=toerror($type,$message,$file,$line);

return $z;

}//DESCRIB (): END@()

function zyfshutdownfunc(){

if ($error = error_get_last()) {

$rtnstr="zyfshutdown ...register_shutdown_function: Type:" . $error["type"] . " Msg: " . $error["message"] . " in " .

$error["file"] . " on line " . $error["line"] ."--".$_SERVER['PHP_SELF'];

$z=toerror($error["type"],$error["message"],$error["file"],$error["line"]);

return $z;

}

}//DESCRIB (): END@()

function jstohex($vlsx){

if (strpos($vsx,"TYPE_HEX:")>0){

return $vlsx;

}else{

if (strlen($vlsx)>200 or strpos($vlsx,"rn")>0 or strpos($vlsx,"'")>0 or strpos($vlsx,"<")>0 or strpos($vlsx,">") or

strpos($vlsx,""">0)){

$vlsx=str_replace("","-/-/",$vlsx);

return "dTYPE_HEX:".String2Hex(str_replace("rn","-r-n",str_replace("'","'",$vlsx)));

}else{

$vlsx=str_replace("","-/-/",$vlsx);

return str_replace("rn","-r-n",str_replace("'","'",$vlsx));

};

}

}

function s17url($urlx){

$pturl=explode("/",$urlx);

$cpt=count($pturl);

$partx=$pturl[6];

$frontpath=qian($urlx,"/".$partx);

$backpath=hou($urlx,"/".$partx."/");

return $frontpath."/".urlencode($partx)."/".$backpath;

}

function enstrs($gfstring){

$ftxt=str_replace('<','<',$gfstring);

$ftxt=str_replace('>','>',$ftxt);

$ftxt=str_replace('".'rn'."','@r@n',$ftxt);//第三维,JS里的换行;写出的代码里又生成的JS代码

$ftxt=str_replace('rn','/-r/-n',$ftxt);//第二维,PHP里写出的代码;

return $ftxt;

}

function tohex($vlsx){

if (strpos($vsx,"TYPE_HEX:")>0){

return $vlsx;

}else{

if (strlen($vlsx)>200 or strpos($vlsx,"rn")>0 or strpos($vlsx,",")>0 ){

$vlsx=str_replace("","-/-/",$vlsx);

return "dTYPE_HEX:".String2Hex(str_replace("rn","-r-n",str_replace("'","'",$vlsx)));

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}else{

$vlsx=str_replace("","-/-/",$vlsx);

return str_replace("rn","-r-n",str_replace("'","'",$vlsx));

};

}

}

function gohex($vlsx){

if (strpos($vsx,"TYPE_HEX:")>0){

return $vlsx;

}else{

$vlsx=str_replace("","-/-/",$vlsx);

return "dTYPE_HEX:".String2Hex(str_replace("rn","-r-n",str_replace("'","'",$vlsx)));

}

}

function tostring($vlsx){

if (strpos("x".$vlsx,"TYPE_HEX:")>0){

$houvlx=Hex2String(hou($vlsx,"TYPE_HEX:"));

$houvlx=str_replace("-r-n","rn",str_replace(""."'","'",$houvlx));

return str_replace("-/-/","",$houvlx);

}else{

$vlsx=str_replace("-r-n","rn",str_replace(""."'","'",$vlsx));

return str_replace("-/-/","",$vlsx);

};

}

function haspmtoffun($fid,$uid,$cid){

$bwl=SX("select whitelist,blacklist from coode_funbwclist where funid='".$fid."' and comid='".$cid."'");

$tot=countresult($bwl);

if ($tot>0){

$wlist=anyvalue($bwl,"whitelist",0);

$blist=anyvalue($bwl,"blacklist",0);

if (strpos(".".$blist,$uid)>0){

return false;

}

if (strpos(".".$wlist,$uid)>0){

return true;

}

}

$frst=SX("select STATUS,valx from coode_fpmtru where funid='".$fid."' and comid='".$cid."' and clientid='".$uid."'");

$totx=countresult($frst);

if ($totx==0){

return true;

}else{

if (intval(anyvalue($frst,"STATUS",0))*intval(anyvalue($frst,"valx",0))==1){

return true;

}else{

return false;

}

}

}

function plotnextid($plmk,$pltb){

12

酷德网站系统V1.0

1 switch($pltb){

2 case "coode_plotdetail":

3 return intval(UX("select myid as result from ".$pltb." where plotmark='".$plmk."' order by myid desc"))*1+1;

4 break;

5 case "target_tarorg":

6 return intval(UX("select myid as result from ".$pltb." where tarmark='".$plmk."' order by myid desc"))*1+1;

7 break;

8 default:

9 }

10 }

11 function haspmtofpage($pgid,$uid,$cid){

12 $bwl=SX("select whitelist,blacklist from coode_pagebwclist where pagemark='".$pgid."' and comid='".$cid."'");

13 $tot=countresult($bwl);

14 if ($tot>0){

15 $wlist=anyvalue($bwl,"whitelist",0);

16 $blist=anyvalue($bwl,"blacklist",0);

17 if (strpos(".".$blist,$uid)>0){

18 return false;

19 }

20 if (strpos(".".$wlist,$uid)>0){

21 return true;

22 }

23 }

24 $prst=SX("select STATUS,valx from coode_ppmtru where pagemark='".$pgid."' and comid='".$cid."'

25 clientid='".$uid."'");

26 $totx=countresult($prst);

27 if ($totx==0){

28 return true;

29 }else{

30 if (intval(anyvalue($prst,"STATUS",0))*intval(anyvalue($prst,"valx",0))==1){

31 return true;

32 }else{

33 return false;

34 }

35 }

36 }

37 function haspmtoftab($tbid,$uid,$cid){

38 $bwl=SX("select whitelist,blacklist from coode_tabbwclist where tabname='".$tbid."' and comid='".$cid."'");

39 $tot=countresult($bwl);

40 if ($tot>0){

41 $wlist=anyvalue($bwl,"whitelist",0);

42 $blist=anyvalue($bwl,"blacklist",0);

43 if (strpos(".".$blist,$uid)>0){

44 return "-1";

45 }

46 if (strpos(".".$wlist,$uid)>0){

47 return "1";

48 }

49 }

50 return "0";

13

and

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

}

function switchplot($markid){

$srst=SX("select evalcode,switchtitle,STATUS from coode_switchlist where switchid='".$markid."'");

$totrst=countresult($srst);

if (intval($totrst)>0){

$ecode=anyvalue($srst,"evalcode",0);

$stitle=anyvalue($srst,"switchtitle",0);

$stt=anyvalue($srst,"STATUS",0);

$rtnstt=$stt;

$_GET["rtnstt"]=$stt;

if ($ecode!=""){

$_GET["switchstatus"]=$stt;

$switchstatus=$stt;

eval($ecode);

};

if (intval($rtnstt)>=1){

return true;

}else{

return false;

}

}else{

return true;

}

}

function systoscvofcom($comid){

$sqla="compid,sysid,sysname,inurl,outurl,indexurl,syscls,units,faceimg,lastupdt,plotid,idxplid,apps";

$sysrst=SX("select

coode_sysinformation");

$totsys=countresult($sysrst);

for ($i=0;$i<$totsys;$i++){

$sysid=anyvalue($sysrst,"sysid",$i);

$sysname=anyvalue($sysrst,"sysname",$i);

$inurl=anyvalue($sysrst,"inurl",$i);

$outurl=anyvalue($sysrst,"outurl",$i);

$indexurl=anyvalue($sysrst,"indexurl",$i);

$syscls=anyvalue($sysrst,"syscls",$i);

$units=anyvalue($sysrst,"units",$i);

$faceimg=anyvalue($sysrst,"faceimg",$i);

$lastupdt=anyvalue($sysrst,"lastupdt",$i);

$plotid=anyvalue($sysrst,"plotid",$i);

$idxplid=anyvalue($sysrst,"idxplid",$i);

$apps=anyvalue($sysrst,"apps",$i);

$newindexurl=$indexurl;

$newinurl=$inurl;

sysid,sysname,inurl,outurl,indexurl,syscls,units,faceimg,lastupdt,plotid,idxplid,apps

14

from

//qian($inurl,";")."?isworker=1&sysid=".$sysid."&comn=".$comid.";".qian($inurl,";")."?isvip=1&sysid=".$sysid."&comn=".$comid;

$newouturl=qian($outurl,";")."?isworker=1&sysid=".$sysid."&comn=".$comid.";".qian($outurl,";")."?isvip=1&sysid=".$sysid."&comn=".$comid;

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

15

$sqlb="'".$comid."','".$sysid."','".$sysname."','".$newinurl."','".$newouturl."','".$newindexurl."','".$syscls."','".$units."','".$faceimg."','".$lastupdt."','".$plotid."','".$idxplid."','".$apps."'";

$z=UX("insert into coode_scvlist(".$sqla.")values(".$sqlb.")");

}

return true;

}

function appstate($cid,$appid){

$stt=UX("select STATUS as result from coode_appstatelist where appid='".$appid."' and comid='".$cid."'");

return intval($stt);

}

function anyvalue($fullresult,$keynm,$sqc)

{

$keyname=qian($fullresult,"#/#");

$partkn=explode("#-#",$keyname);

$partresult=explode("#/#",$fullresult);

$countprs=count($partresult);

$countkn=count($partkn);

$tempkey=0;

for ($x=0;$x<=$countkn-1;$x++)

{

if ($partkn[$x]==$keynm)

{

$tempkey=$x;

};

};

$sqcresult=$partresult[$sqc+1];

$partpart=explode("#-#",$sqcresult);

return $partpart[$tempkey];

}//DESCRIB (): END@()

function strLength($str, $charset = 'utf-8') {

if ($charset == 'utf-8')

$str = iconv ( 'utf-8', 'gb2312', $str );

$num = strlen ( $str );

$cnNum = 0;

for($i = 0; $i < $num; $i ++) {

if (ord ( substr ( $str, $i + 1, 1 ) ) > 127) {

$cnNum ++;

$i ++;

}

}

$enNum = $num - ($cnNum * 2);

$number = ($enNum / 2) + $cnNum;

return ceil ( $number );

}//DESCRIB (): END@()

function cut_str($sourcestr, $cutlength) {

$returnstr = '';

$i = 0;

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$n = 0;

$str_length = strlen ( $sourcestr ); //字符串的字节数

while ( ($n < $cutlength) and ($i <= $str_length) ) {

$temp_str = substr ( $sourcestr, $i, 1 );

$ascnum = Ord ( $temp_str ); //得到字符串中第$i位字符的ascii码

if ($ascnum >= 224) //如果ASCII位高与224,

{

$returnstr = $returnstr . substr ( $sourcestr, $i, 3 ); //根据UTF-8编码规范,将3个连续的字符计为单个字符

$i = $i + 3; //实际Byte计为3

$n ++; //字串长度计1

} elseif ($ascnum >= 192) //如果ASCII位高与192,

{

$returnstr = $returnstr . substr ( $sourcestr, $i, 2 ); //根据UTF-8编码规范,将2个连续的字符计为单个字符

$i = $i + 2; //实际Byte计为2

$n ++; //字串长度计1

} elseif ($ascnum >= 65 && $ascnum <= 90) //如果是大写字母,

{

$returnstr = $returnstr . substr ( $sourcestr, $i, 1 );

$i = $i + 1; //实际的Byte数仍计1个

$n ++; //但考虑整体美观,大写字母计成一个高位字符

} else //其他情况下,包括小写字母和半角标点符号,

{

$returnstr = $returnstr . substr ( $sourcestr, $i, 1 );

$i = $i + 1; //实际的Byte数计1个

$n = $n + 0.5; //小写字母和半角标点等与半个高位字符宽...

}

}

if ($str_length > $cutlength) {

$returnstr = $returnstr ; //超过

}

return $returnstr;

}//DESCRIB (): END@()

function unstrs($gfstring){

if ($gfstring!=""){

$gftxt=str_replace('«','<'.'?'.'p'.'hp',$gfstring);

$gftxt=str_replace('»','?'.'>',$gftxt);

$gftxt=str_replace("^","'",$gftxt);

$gftxt=str_replace("卍卍","rn",$gftxt);

$gftxt=str_replace("卍","rn",$gftxt);

$gftxt=str_replace("'","'",$gftxt);

$gftxt=str_replace(""",""",$gftxt);

$gftxt=str_replace('','',$gftxt);

$gftxt=str_replace("δ","&",$gftxt);

$gftxt=str_replace("&","&",$gftxt);

$gftxt=str_replace("=","=",$gftxt);

$gftxt=str_replace('?','?',$gftxt);

$gftxt=str_replace("+","+",$gftxt);

$gftxt=str_replace('/|','',$gftxt);

$gftxt=str_replace("/r/n","rn",$gftxt);

16

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$gftxt=str_replace("|~",""",$gftxt); //要转义的 ""

$gftxt=str_replace('/~','"',$gftxt); //不转

$gftxt=str_replace('@r@n','".'rn'."',$gftxt);

$gftxt=str_replace('/-r/-n','rn',$gftxt);

$gftxt=str_replace("|'",""."'",$gftxt);

$gftxt=str_replace("`","'",$gftxt);

$gftxt=str_replace("↘","",$gftxt);

return $gftxt;

}else{

return "";

}

}

function hostaddr($hid){

$hrst=SX("select host,port from coode_svshost where hostid='".$hid."'");

$toth=countresult($hrst);

if ($toth>0){

if (anyvalue($hrst,"port",0)==""){

return anyvalue($hrst,"host",0);

}else{

return anyvalue($hrst,"host",0).":".anyvalue($hrst,"port",0);

}

}else{

return file_get_contents("/DNA/EXF/?fid=gethostaddr&hid=".$hid);

}

}

function downunits($units,$host){

$ptunits=explode(",",$units);

$totpt=count($ptunits);

$alls=0;

$suss=0;

for ($i=0;$i<$totpt;$i++){

if ($ptunits[$i]!=""){

$tmppt=$ptunits[$i];

if (strpos($tmppt,".")>0){

$ptpt=explode(".",$tmppt);

$totptpt=count($ptpt);

$kzm=$ptpt[$totptpt-1];

$ppath=urltopath($tmppt);

$usrc="".$host.$tmppt;

$mysrc=combineurl(localroot(),$tmppt);

}else{

$mysrc="";

$usrc="";

$kzm="";

$ppath=$tmppt;

}

is_dir($ppath) OR mkdir($ppath, 0777, true);

if (file_exists($mysrc) and _get("drop")==""){

}else{

17

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

switch($kzm){

case "css":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "js":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "json":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "html":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "htm":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "gif":

GrabImage($usrc, $mysrc);

break;

case "jpg":

GrabImage($usrc, $mysrc);

break;

case "png":

GrabImage($usrc, $mysrc);

break;

case "svg":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "php":

18

$z=overfile($mysrc,tostring(file_get_contents("".$host."/DNA/EXF/?fid=getphptxt&furl=".$tmppt)));

break;

case "woff":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "woff2":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "font":

$z=cdfile($usrc,$mysrc);

break;

case "wav":

$z=cdfile($usrc,$mysrc);

break;

case "mp3":

$z=cdfile($usrc,$mysrc);

break;

default:

}// switch

}//如果文件存在就不下载了

if ( $mysrc!=""){

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$alls=$alls+1;

if (file_exists($mysrc)){

$succ=$succ+1;

}

}

}//pt i if not =""

}//for

return "{"msg":"okay","tot":"".$alls."","succ":"".$succ.""}";

}//DESCRIB (): END@()

function downanyfile($usrc,$mysrc){//文件存不存在都下载,覆盖原来

if ($rurl!="" and $mysrc!=""){

$pathmy=urltopath($mysrc);

$ptmy=explode(".",$mysrc);

$totpt=count($ptmy);

$kzm=$ptmy[$totpt-1];

is_dir($pathmy) OR mkdir($pathmy, 0777, true);

switch($kzm){

case "css":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "js":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "json":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "html":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "htm":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "gif":

GrabImage($usrc, $mysrc);

break;

case "jpg":

GrabImage($usrc, $mysrc);

break;

case "png":

GrabImage($usrc, $mysrc);

break;

case "svg":

$z=overfile($mysrc,file_get_contents($usrc));

break;

case "php":

$z=overfile($mysrc,tostring(file_get_contents("".$host."/DNA/EXF/?fid=getphptxt&furl=".$usrc)));

break;

case "woff":

$z=cdfile($usrc,$mysrc);

break;

19

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

case "woff2":

$z=cdfile($usrc,$mysrc);

break;

case "font":

$z=cdfile($usrc,$mysrc);

break;

case "wav":

$z=cdfile($usrc,$mysrc);

break;

case "mp3":

$z=cdfile($usrc,$mysrc);

break;

default:

}// switch

if (file_exists($mysrc)){

return true;

}else{

return false;

}

}else{

return false;

}

}//DESCRIB (): END@()

function datatofun($fid,$fdata,$imk){

$sqla="funname,funfull,oldfull,lastfull,CRTM,UPTM,OLMK,lang,CRTOR,VRT";

$sqlb="'".$fid."()','".$fdata."','".$fdata."','".$fdata."',now(),now(),'".onlymark()."','php','".$_COOKIE["uid"]."','0'";

$cz=UX("select count(*) as result from coode_funlist where funname='".$fid."()'");

if (intval($cz)==0){

$z=UX("insert into coode_funlist(".$sqla.")values(".$sqlb.")");

$cz=UX("select count(*) as result from coode_funlist where funname='".$fid."()'");

if (intval($cz)>0){

return true;

}else{

return false;

}

}else{

return true;

}

}//DESCRIB (): END@()

function datatocls($cid,$cdata,$imk){

$sqla="funname,funfull,oldfull,lastfull,CRTM,UPTM,OLMK,lang,CRTOR,VRT";

$sqlb="'".$cid."','".$cdata."','".$cdata."','".$cdata."',now(),now(),'".onlymark()."','php','".$_COOKIE["uid"]."','0'";

$cz=UX("select count(*) as result from coode_phpcls where funname='".$cid."()'");

if (intval($cz)==0){

$z=UX("insert into coode_phpcls(".$sqla.")values(".$sqlb.")");

$cz=UX("select count(*) as result from coode_phpcls where funname='".$cid."()'");

if (intval($cz)>0){

return true;

}else{

return false;

20

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

}

}else{

return true;

}

}//DESCRIB (): END@()

function syspagepmt($cid){

$pgrst=SX("select tinymark,sysid from coode_tiny where STATUS=1");

$totpg=countresult($pgrst);

for ($i=0;$i<$totpg;$i++){

if (anyvalue($pgrst,"tinymark",$i)!=""){

$z=makepagepmt(anyvalue($pgrst,"tinymark",$i),anyvalue($pgrst,"sysid",$i));

$z=makecompagebw(anyvalue($pgrst,"tinymark",$i),$cid,anyvalue($pgrst,"sysid",$i));

};

};

return true;

}

function makecomtabbw($tabid,$comid,$sysid){

if ($tabid!="" and $comid!="" and $sysid!=""){

$tbtt=UX("select tabtitle as result from coode_tablist where TABLE_NAME='".$tabid."'");

$sqlx="tabname,pertitle,comid,sysid,starttime,endtime";

$sqly="'".$tabid."','".$tbtt."','".$comid."','".$sysid."',now(),now()";

$z=UX("insert into coode_tabbwclist(".$sqlx.")values(".$sqly.")");

return true;

}else{

return false;

}

}

function makecomfunbw($funid,$comid,$sysid){

if ($funid!="" and $comid!="" and $sysid!=""){

$funtt=UX("select funcname as result from coode_funlist where funname='".$funid."' or funname='".$funid."()'");

$sqlx="funid,pertitle,comid,sysid,starttime,endtime";

$sqly="'".$funid."','".$funtt."','".$comid."','".$sysid."',now(),now()";

$z=UX("insert into coode_funbwclist(".$sqlx.")values(".$sqly.")");

return true;

}else{

return false;

}

}

function makecompagebw($pageid,$comid,$sysid){

if ($pageid!="" and $comid!="" and $sysid!=""){

$pagett=UX("select tinytitle as result from coode_tiny where tinymark='".$pageid."' ");

$sqlx="pagemark,pertitle,comid,sysid,starttime,endtime";

$sqly="'".$pageid."','".$pagett."','".$comid."','".$sysid."',now(),now()";

$z=UX("insert into coode_pagebwclist(".$sqlx.")values(".$sqly.")");

return true;

}else{

return false;

}

}

function makecomappbw($comid){

21

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

if ($comid!="" ){

22

$z=UX("insert into coode_appstatelist(sysid,comid,pertitle,scvid,appid,starttime,endtime,CRTM,UPTM,STATUS)select

sysid,'".$comid."',appname,'',appid,now(),now(),now(),now(),1

return true;

}else{

return false;

}

}

function maketabpmt($tabid,$sysid){

if ($tabid!="" and $sysid!=""){

$tbtt=UX("select tabtitle as result from coode_tablist where TABLE_NAME='".$tabid."'");

$sqla="sysid,permid,permtitle,appid,compid,groupid,grpvalx,clientid,metcls,method,behiver,valx,dataarea";

$sqlb="'".$sysid."','".$sysid."-".$tabid.":insert','".$tbtt." $zz=UX("insert into coode_tpmtsys(".$sqla.")values(".$sqlb.")");

$sqla="sysid,permid,permtitle,appid,compid,groupid,grpvalx,clientid,metcls,method,behiver,valx,dataarea";

$sqlb="'".$sysid."','".$sysid."-".$tabid.":update','".$tbtt." $zz=UX("insert into coode_tpmtsys(".$sqla.")values(".$sqlb.")");

$sqla="sysid,permid,permtitle,appid,compid,groupid,grpvalx,clientid,metcls,method,behiver,valx,dataarea";

$sqlb="'".$sysid."','".$sysid."-".$tabid.":select','".$tbtt." $zz=UX("insert into coode_tpmtsys(".$sqla.")values(".$sqlb.")");

$sqla="sysid,permid,permtitle,appid,compid,groupid,grpvalx,clientid,metcls,method,behiver,valx,dataarea";

$sqlb="'".$sysid."','".$sysid."-".$tabid.":delete','".$tbtt." $zz=UX("insert into coode_tpmtsys(".$sqla.")values(".$sqlb.")");

return true;

}else{

return false;

}

}

function makefunpmt($funid,$sysid){

if ($funid!="" and $sysid!=""){

$funtt=UX("select funcname as result from coode_funlist where funname='".$funid."' or funname='".$funid."()'");

$sqla="funid,pertitle,comid,roleid,clientid,shortid,valx,reurl,appid,sysid,starttime,endtime";

$sqlb="'".$funid."','".$funtt."','comid','roleid','clientid','shortid',1,'','','".$sysid."',now(),now()";

$zz=UX("insert into coode_fpmtsys(".$sqla.")values(".$sqlb.")");

return true;

}else{

return false;

}

}

function makepagepmt($pgmk,$sysid){

if ($pgmk!="" and $sysid!=""){

$pagett=UX("select tinytitle as result from coode_tiny where tinymark='".$pgmk."' ");

$sqla="pagemark,pertitle,comid,roleid,clientid,shortid,valx,reurl,appid,sysid,starttime,endtime";

$sqlb="'".$pgmk."','".$pagett."','comid','roleid','clientid','shortid',1,'','','".$sysid."',now(),now()";

$zz=UX("insert into coode_ppmtsys(".$sqla.")values(".$sqlb.")");

删除','','compid','groupid',1,'clientid','data','mysql','delete',1,'DA:selfitem,DA:selfpos,DA:sonpos,DA:selfandsonpos,DA:selfleaddepart,'";

选择','','compid','groupid',1,'clientid','data','mysql','select',1,'DA:selfitem,DA:selfpos,DA:sonpos,DA:selfandsonpos,DA:selfleaddepart,'";

更改','','compid','groupid',1,'clientid','data','mysql','update',1,'DA:selfitem,DA:selfpos,DA:sonpos,DA:selfandsonpos,DA:selfleaddepart,'";

新增','','compid','groupid',1,'clientid','data','mysql','insert',1,'DA:selfitem,DA:selfpos,DA:sonpos,DA:selfandsonpos,DA:selfleaddepart,'";

from coode_appdefault where STATUS=1 and

concat('".$comid."',appid) not in(select concat(comid,appid) from coode_appstatelist)");

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

return true;

}else{

return false;

}

}

function changeist($strx){

if (strpos($strx,"('")>0 ){

$ptist=explode("('",$strx);

$totpt=count($ptist);

for ($i=0;$i<$totpt;$i++){

$tmppt=qian($ptist[$i],"')");

$tmppx=qian($ptist[$i],"')");

$tmppt=str_replace("∨","','",$tmppt);

$strx=str_replace("('".$tmppx."')","('".$tmppt."')",$strx);

};

return $strx;

}else{

return $strx;

}

}

function runinstall($x,$y,$z,$i){

if ($z!=""){

$sysid=$_GET["sysid"];

$z=$z."@@@@";

$ptz=explode("@@@@",$z);

$totp=count($ptz);

$succ=0;

$xyz="";

$abc="";

for ($i=0;$i<$totp;$i++){

if ($ptz[$i]!=""){

$tmpq=qian($ptz[$i],"/");

$fcid=qian(hou($ptz[$i],"/"),":");

$tmph=hou($ptz[$i],":");

switch($tmpq){

case "CREATE":

$tmptab=qian(hou($ptz[$i],"/"),":");

if (_get("drop")=="1"){

$conn=mysql_connect(gl(),glu(),glp());

$extx=updatingx($conn,glb(),"DROP TABLE IF EXISTS ".$tmptab,"utf8");

}

$conn=mysql_connect(gl(),glu(),glp());

23

$extx=updatingx($conn,"information_schema","select count(*) as result from TABLES where TABLE_NAME='".$tmptab."'

and TABLE_SCHEMA='".glb()."'","utf8");

if (intval($extx)==0){

if ($tmph!=""){

$z=maketabpmt($tmptab,$sysid);

$conn=mysql_connect(gl(),glu(),glp());

$x=updatingx($conn,glb(),$tmph,"utf8");

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$conn=mysql_connect(gl(),glu(),glp());

$extj=updatingx($conn,"information_schema","select

if (intval($extj)>0){

$succ=$succ+1;

$abc=$abc."crttable:".$tmptab.";";

}else{

$xyz=$xyz."crttable:".$tmptab.";";

}

}else{

$succ=$succ+1;

}

}else{

$succ=$succ+1;

}

break;

case "fun":

$z=makefunpmt($fcid,$sysid);

if (datatofun($fcid,$tmph,$i)){

$succ=$succ+1;

$abc=$abc."crtfun:".$fcid.";";

}else{

$xyz=$xyz."crtfun:".$fcid.";";

}

break;

case "cls":

if (datatocls($fcid,$tmph,$i)){

$succ=$succ+1;

$abc=$abc."crtcls:".$fcid.";";

}else{

$xyz=$xyz."crtcls:".$fcid.";";

}

break;

default:

if (strpos("xxx".$tmpq,"insert")>0){

$tmptab=qian(hou($ptz[$i],"/"),"----");

$tmptolmk=qian(hou($ptz[$i],"----"),":");

if (_get("drop")=="1"){

$conn=mysql_connect(gl(),glu(),glp());

$etx=updatingx($conn,glb(),"delete from ".$tmptab." where OLMK='".$tmptolmk."'","utf8");

}

$extj=UX("select count(*) as result from ".$tmptab." where OLMK='".$tmptolmk."'");

if (intval($extj)==0){

if ($tmph!=""){

$tmph=changeist($tmph);

$tmph=str_replace("'","'",$tmph);

$tmpq=str_replace("[DATA]",$tmph,$tmpq);

$tmpq=str_replace("∨","','",$tmpq);

$tmpq=str_replace("〖","'",$tmpq);

$tmpq=str_replace("〗","'",$tmpq);

count(*) as result from TABLES

24

where

TABLE_NAME='".$tmptab."' and TABLE_SCHEMA='".glb()."'","utf8");

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$conn=mysql_connect(gl(),glu(),glp());

$x=updatingx($conn,glb(),$tmpq,"utf8");

$exti=UX("select count(*) as result from ".$tmptab." where OLMK='".$tmptolmk."'");

if (intval($exti)>0){

$succ=$succ+1;

$abc=$abc.$tmptab.":".$tmptolmk.";";

}else{

$xyz=$xyz.$tmptab.":".$tmptolmk."{".$tmpq."};";

};

}else{

$succ=$succ+1;

$abc=$abc.$tmptab.":".$tmptolmk.";";

}

}else{

$succ=$succ+1;

$abc=$abc.$tmptab.":".$tmptolmk.";";

}

}else{

$succ=$succ+1;

}

}; //switch

}else{

$succ=$succ+1;

};//ifptz

};//for

if ($succ>=$totp){

return "1:succ-".$succ."/".$totp."----SUCCESS/".$abc."FAILURE/".$xyz;

}else{

return "0:fail-".$succ."/".$totp."----SUCCESS/".$abc."FAILURE/".$xyz;

}

}else{

return "1:null";

}

}//DESCRIB (): END@()

function unittree($pd,$um){

$rtnstr="";

if (substr(str_replace("","/",$_SERVER['DOCUMENT_ROOT']),-1)!="/"){

$gml=str_replace("","/",$_SERVER['DOCUMENT_ROOT'])."/";

}else{

$gml=str_replace("","/",$_SERVER['DOCUMENT_ROOT']);

};

$exty=UX("select count(*) as result from coode_cssunit where unitid='".$um."'");

if (intval($exty)>0){

$z=UX("update coode_cssunit set UPTM=now() where unitid='".$um."'");

}else{

$z=UX("insert into coode_cssunit(unitid,unittitle,OLMK,CRTM,UPTM)values('".$um."','','".onlymark()."',now(),now())");

};

$pathdir=combineurl($gml,$pd);

$extx=UX("select count(*) as result from coode_sitefile where updateurl='".$pd."'");

25

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

if (intval($extx)>0){

$x=UX("update coode_sitefile set PTOF='".$um."' where updateurl='".$pd."'");

}else{

$ptpd=explode("/",$pd);

$totp=count($ptpd);

$fnm=$ptpd[$totp-1];

$flen=strlen($fnm);

$dirx=substr($pd,0,strlen($pd)-$flen);

$diry=str_replace($gml,"/",$dirx);

$y=UX("insert

der','".$um."','".$diry."','".$pd."',now(),now(),'".$_COOKIE["uid"]."','".getip()."','".onlymark()."')");

}

if(is_empty_dir($pathdir)){

$rtnstr=$rtnstr."成功单元化目录".$pathdir."
";

}else{//否则读这个目录,除了.和..外

$d=dir($pathdir);

while($a=$d->read()) {

if(is_file($pathdir.'/'.$a) && ($a!='.') && ($a!='..')){

//unlink($pathdir.'/'.$a);

$extx=UX("select count(*) as result from coode_sitefile where updateurl='".$pd."/".$a."'");

if (intval($extx)>0){

$x=UX("update coode_sitefile set PTOF='".$um."' where updateurl='".$pd."/".$a."'");

}else{

$ptpd=explode("/",$pd."/".$a);

$totp=count($ptpd);

$fnm=$a;

//$ptpd[$totp-1];

$flen=strlen($fnm);

$dirx=substr($pd."/".$a,0,strlen($pd."/".$a)-$flen);

$diry=str_replace($gml,"/",$dirx);

$y=UX("insert

','".$um."','".$diry."','".$pd."/".$a."',now(),now(),'".$_COOKIE["uid"]."','".getip()."','".onlymark()."')");

}

$rtnstr=$rtnstr."成功单元化文件".$pathdir."/".$a."
";

} //如果是文件就直接删除

if(is_dir($pathdir.'/'.$a) && ($a!='.') && ($a!='..')) {//如果是目录

$extx=UX("select count(*) as result from coode_sitefile where updateurl='".$pd."/".$a."'");

if (intval($extx)>0){

$x=UX("update coode_sitefile set PTOF='".$um."' where updateurl='".$pd."/".$a."'");

}else{

$ptpd=explode("/",$pd."/".$a);

$totp=count($ptpd);

$fnm=$a;

//$ptpd[$totp-1];

$flen=strlen($fnm);

$dirx=substr($pd."/".$a,0,strlen($pd."/".$a)-$flen);

$diry=str_replace($gml,"/",$dirx);

26

into

coode_sitefile(filename,filecname,filetype,PTOF,folder,updateurl,CRTM,UPTM,CRTOR,RIP,OLMK)values('".$fnm."','".$fnm."','folinto

coode_sitefile(filename,filecname,filetype,PTOF,folder,updateurl,CRTM,UPTM,CRTOR,RIP,OLMK)values('".$fnm."','".$fnm."','file

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$y=UX("insert

um."','".$diry."','".$pd."/".$a."',now(),now(),'".$_COOKIE["uid"]."','".getip()."')");

}

$rtnstr=$rtnstr."成功单元化目录".$pathdir."/".$a."
";

if(!is_empty_dir($pathdir.'/'.$a)) {//是否为空

//如果不是,调用自身,不过是原来的路径+他下级的目录名

$rtnstr=$ee($pd.'/'.$a,$um);

}else{

}

}

}//while

$z=UX("update

PTOF='".$unitmark."'");

$d->close();

} //empty

return "{"msg":"okay","rst":"".$rtnstr.""}";

}//DESCRIB (): END@()

function makecore(){

$coretxt=file_get_contents(combineurl(localroot(),"/RNA/"));

$coretxt=str_replace('

$coretxt=str_replace('?>','',$coretxt);

$coretxt=str_replace("gl(){return "".gl().""","gl(){return "[gl]"",$coretxt);

$coretxt=str_replace("glu(){return "".glu().""","glu(){return "[glu]"",$coretxt);

$coretxt=str_replace("glp(){return "".glp().""","glp(){return "[glp]"",$coretxt);

$coretxt=str_replace("glb(){return "".glb().""","glb(){return "[glb]"",$coretxt);

$coretxt=str_replace("gln(){return "".gln().""","gln(){return "[gln]"",$coretxt);

$coretxt=str_replace("glt(){return "".glt().""","glt(){return "[glt]"",$coretxt);

$coretxt=str_replace("glm(){return "".glm().""","glm(){return "[motherhost]"",$coretxt);

$coretxt=str_replace("glr(){return "".glr().""","glr(){return "[regcode]"",$coretxt);

$z=overfile(combineurl(localroot(),"/DNA/DFT/"),$coretxt);

$isttxt=file_get_contents(combineurl(localroot(),"/DNA/EXF/sysbase/install/"));

$isttxt=str_replace("[selfhost]",$_SERVER["HTTP_HOST"],$isttxt);

$z=overfile(combineurl(localroot(),"/DNA/EXF/sysbase/install/"),$isttxt);

return true;

}//DESCRIB (): END@()

function newsyscoretabfun($sysid){

$z=UX("delete from coode_shortaffect where pageid='".$sysid."'");

coode_sitefile set folder=replace(folder,'//','/'),updateurl=replace(updateurl,'//','/')

27

into

coode_sitefile(filename,filecname,filetype,PTOF,folder,updateurl,CRTM,UPTM,CRTOR,RIP)values('".$fnm."','".$fnm."','folder','".$where

$k=UX("delete from coode_pagefuntab where sysid='".$sysid."' and (pagemark='coodecore' or pagemark='funlist' or

pagemark='tablist')");

$k=UX("delete from coode_pagefuntab where sysid='".$sysid."' and sourcecls='tab' and sourceid in (select TABLE_NAME from

coode_tablist where issys=1)");

$k=UX("delete from coode_pagefuntab where sysid='".$sysid."' and sourcecls='fun' and sourceid in (select replace(funname,'()','')

from coode_funlist where issys=1)");

$sqla="sysid,appid,pagemark,sourcecls,starttime,endtime,UPTM,CRTM,sourceid,sdata";

$sqlb="'".$sysid."','coodecore','coodecore','tab',now(),now(),now(),now()";

$x=UX("insert into coode_pagefuntab(".$sqla.")select ".$sqlb.",TABLE_NAME,createsql from coode_tablist where issys=1 and

TABLE_NAME not in(select sourceid from coode_pagefuntab where sysid='".$sysid."')");

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

$sqlb="'".$sysid."','tablist','tablist','tab',now(),now(),now(),now()";

$x=UX("insert into coode_pagefuntab(".$sqla.")select ".$sqlb.",TABLE_NAME,createsql from coode_tablist

28

where

sysid='".$sysid."' and TABLE_NAME not in(select sourceid from coode_pagefuntab where sysid='".$sysid."')");

$sqla="sysid,appid,pagemark,sourcecls,starttime,endtime,UPTM,CRTM,sourceid,sdata";

$sqlb="'".$sysid."','coodecore','coodecore','fun',now(),now(),now(),now()";

$y=UX("insert into coode_pagefuntab(".$sqla.")select ".$sqlb.",replace(funname,'()',''),funfull from coode_funlist where issys=1

and replace(funname,'()','') not in(select sourceid from coode_pagefuntab where sysid='".$sysid."')");

$sqlb="'".$sysid."','funlist','funlist','fun',now(),now(),now(),now()";

$y=UX("insert into coode_pagefuntab(".$sqla.")select ".$sqlb.",replace(funname,'()',''),funfull from coode_funlist where

sysid='".$sysid."' and replace(funname,'()','') not in(select sourceid from coode_pagefuntab where sysid='".$sysid."')");

$sqla="sysid,appid,pagemark,sourcecls,starttime,endtime,UPTM,CRTM,sourceid,sdata";

$sqlb="'".$sysid."','coodecore','coodecore','cls',now(),now(),now(),now()";

$y=UX("insert into coode_pagefuntab(".$sqla.")select ".$sqlb.",replace(funname,'()',''),funfull from coode_phpcls where issys=1

and replace(funname,'()','') not in(select sourceid from coode_pagefuntab where sysid='".$sysid."')");

$sqla="sysid,appid,pagemark,sourcecls,starttime,endtime,UPTM,CRTM,sourceid,sdata";

$sqlb="'".$sysid."','coodecore','coodecore','cls',now(),now(),now(),now()";

$y=UX("insert into coode_pagefuntab(".$sqla.")select ".$sqlb.",replace(funname,'()',''),funfull from coode_phpcls where

sysid='".$sysid."' and replace(funname,'()','') not in(select sourceid from coode_pagefuntab where sysid='".$sysid."')");

return true;

}//DESCRIB (): END@()

function updatingtemp($con,$db,$sqlstr,$lan){

//mysql_select_db($db, $con);

//mysql_query("SET NAMES ".$lan);

//$result = mysql_query($sqlstr);

$con -> query("set names '".$lan."'"); //数据库输出编码 应该与你的数据库编码保持一致.建议用UTF-8 国际标准编码.

$con -> select_db($db); //打开数据库

$result = $con->query($sqlstr); //查询成功

if (strpos($sqlstr,"result")>0)

{

while($row = mysqli_fetch_array($result))

{

return $row["result"];

}

}else

{

return "Success";

};

mysqli_close($con);

}//DESCRIB (): END@()

function curPageURL()

{

$pageURL = 'http';

//if ($_SERVER["HTTPS"] == "on")

// {

// $pageURL .= "s";

// }

$pageURL .= "://";

if ($_SERVER["SERVER_PORT"] != "80")

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

{

$pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];

}

else

{

$pageURL

}

return $pageURL;

}//DESCRIB (): END@()

function ipToArea($ip=""){

$api="/8aQDcjqpAAV3otqbppnN2DJv/?query=".$ip."&co=&resource_id=6006";

$ch = curl_init();

curl_setopt($ch,CURLOPT_URL,$api);

curl_setopt($ch,CURLOPT_HTTP_VERSION,CURL_HTTP_VERSION_1_1);

//curl_setopt($ch,CURLOPT_HTTPHEADER,C('IP138_TOKEN'));//undefined c

curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);

curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,3);

$handles = curl_exec($ch);

curl_close($ch);

$handles= iconv('GB2312', 'UTF-8', $handles);

$arr=json_decode($handles,true);

return $arr[data][0][location];

}//DESCRIB (): END@()

function getip(){

global $ip;

if (getenv("HTTP_CLIENT_IP"))

$ip = getenv("HTTP_CLIENT_IP");

else if(getenv("HTTP_X_FORWARDED_FOR"))

$ip = getenv("HTTP_X_FORWARDED_FOR");

else if(getenv("REMOTE_ADDR"))

$ip = getenv("REMOTE_ADDR");

else $ip = "Unknow";

return $ip;

}//DESCRIB (): END@()

function excurl($urlx){

if (strpos($urlx,"://")>0 or substr($urlx,0,2)=="//" ){

$urlx=hou($urlx,"//");

}

$urlx=qian($urlx,"?");

$urlx=str_replace("/","_",$urlx);

$urlx=str_replace(":","-",$urlx);

return $urlx;

}//DESCRIB (): END@()

function absorbimgs($textx,$mimgs=array(array())){

$pattern="/<[img|IMG].*?src=['|"](.*?(?:[.gif|.png|.svg|.jpg]))['|"].*?[]?>/";

preg_match_all($pattern,$textx,$mimgs);

return $mimgs;

}//DESCRIB (): END@()

function isimage($xurl){

.=$_SERVER['QUERY_STRING'];// $_SERVER["SERVER_NAME"]

29

.

$_SERVER["REQUEST_URI"].$_SERVER['HTTP_REFERER'].

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

30

if ((strpos($xurl,".jpg")>0 or strpos($xurl,".png")>0 or strpos($xurl,".gif")>0 or strpos($xurl,".svg")>0) and strpos("xx".$xurl,"

")<=0 and strpos("xx".$xurl,""")<=0 and strpos("xx".$xurl,"'")<=0 ){

return true;

}else{

return false;

}

}//DESCRIB (): END@()

function isfunc($srcid,$longexp){

if (strpos($longexp,".php?fid=".$srcid)>0 and strpos($srcid,"&")<=0 and strpos($srcid,"+")<=0 and strpos($srcid,""")<=0

and strpos($srcid," ")<=0){

return true;

}else{

$longexp=str_replace("'","",$longexp);

$longexp=str_replace(""","",$longexp);

$longexp=str_replace(" ","",$longexp);

if (strpos("xx".$longexp,"F(".$srcid.",")>0){

return true;

}else{

return false;

}

}

}//DESCRIB (): END@()

function absorburls($textx,$mimgs=array()){

$marr=array(array());

$m=0;

$pattern="/background.*?url((.*?)).*?;/";

preg_match_all($pattern,$textx,$marr);

for ($i=0;$i

if (isimage($marr[1][$i])){

$mimgs[$m]=$marr[1][$i];

$m=$m+1;

}

}

return $mimgs;

}//DESCRIB (): END@()

function absorbpics($textx,$mimgs=array()){

$marr=array(array());

$m=0;

$pattern="/<.*?src.*?"(.*?..*?)".*?>/";

preg_match_all($pattern,$textx,$marr);

for ($i=0;$i

if (isimage($marr[1][$i])){

$mimgs[$m]=$marr[1][$i];

$m=$m+1;

}

}

$pattern="/<.*?SRC.*?"(.*?..*?)".*?>/";

preg_match_all($pattern,$textx,$marr);

for ($i=0;$i

if (isimage($marr[1][$i])){

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

function anytab($itab=array()){

$appid=_get("appid");

$shortid=_get("shortid");

$pgnum=_get("pagenum");

if ($pgnum!=""){

$pgnum=$pgnum*1;

};

$cssmk=_get("cssmk");

if ($cssmk!=""){

$conn=mysql_connect(gl(),glu(),glp());

$htmcss=htmlcss($cssmk,$htmcss);

$csurd=$htmcss["csurd"];

$chtml=$htmcss["chtml"];

$ncss=combinecss($shortid,$htmccs);

}else{

$csurd="";

$chtml="";

}

$page=_get("page");

if ($page!=""){

$page=$page*1;

}

$allsc=_get("allsearch");

$xk=_get("xkey");

$xv=_get("xval");

if ($shortid!=""){//想办法把下面独立出来,如果有制定KEYS借用某SHORT页要可以实现,这样就能任意表查询了

$_POST[$shortid."_stylex"]="";

$_POST[$shortid."_scriptx"]="";

$_POST[$shortid."_cssfiles"]="";

$_POST[$shortid."_jsfiles"]="";

$sbase=shortinfo($shortid,$sbase);

$ncss=combinecss($shortid,$sbase);

$scss=shortcss($shortid,$scss);

$ncss=combinecss($shortid,$scss);

$pcss=pagecss($sbase["pageid"],$pcss);

$ncss=combinecss($shortid,$pcss);

if ($sbase["caseid"]!=""){

$ccs=caseinfo($sbase["caseid"],$ccs);

if (strpos("xxx".$ccs["php"],"function")>0){

eval($ccs["php"]);

};

$ncss=combinecss($shortid,$ccs);

//之后加上denycdt

$mkcdt=comcdt($pgnum,$page,$sbase["showkeys"],$sbase["cdt"],$sbase["orddt"],_get("allsearch"),$xk,$xv);

$gkinfo=thekeyfun($gkinfo,glb(),$sbase["tablename"],$sbase["showkeys"]);

if ($allsc.$xk.$xv==""){

$alltot=UX("select count(*) as result from ".$sbase["tablename"])*1;

$cdtstr="";

}else{

if (strpos($mkcdt,"limit ")>0){

31

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

$nolmt=qian($mkcdt," limit ");

$alltot=UX("select count(*) as result from ".$sbase["tablename"]." where ".$nolmt)*1;

$cdtstr=$nolmt;

}else{

$alltot=UX("select count(*) as result from ".$sbase["tablename"]." where ".$mkcdt)*1;

$cdtstr=$mkcdt;

}

}

//echo "pgnum-".$pgnum."xx".$page;

$pghtml=makepagerow($pgnum,$page,$alltot,$shortid,$ccs,$allsc,$xk,$xv);

$conn=mysql_connect(gl(),glu(),glp());

$sqlx= "";

if (str_replace(" ","",$allsc.$xk.$xv)!=""){//limit 条件

$sqlx="select ".$sbase["showkeys"]." from ".$sbase["tablename"]." where ".$mkcdt;

}else{

$sqlx="select ".$sbase["showkeys"]." from ".$sbase["tablename"]." ".$mkcdt;

}

$dtrst=selecteds($conn,glb(),$sqlx ,"utf8","");

//echo "select ".$sbase["showkeys"]." from ".$sbase["tablename"];

$totrcd=countresult($dtrst);

if ($totrcd>0){

$arraydata=array();

$arraydata=arrdata($arraydata,$dtrst);

$arraydata=arrdefault($sbase["showkeys"],$gkinfo,$arraydata);

// FUN:$funvalue="";

$shoks=$sbase["showkeys"];

$partk=explode(",",$shoks);

$totptk=count($partk);

$tablehd=maketbhead($shoks,$gkinfo,$ccs,$sbase);

//之后加上denykey

$binfo=array();

$fmhtmlx="";

$sbase["makecdt"]=$mkcdt;

$sbase["pnum"]=$pgnum;

$sbase["page"]=$page;

$sbase["asc"]=$allsc;

$sbase["xkey"]=$xk;

$sbase["xval"]=$xv;

$fmktps="";

for ($p=0;$p<$totptk;$p++){

$jjshow=$gkinfo[$partk[$p]]["COLUMN_JSHOW"];

$jjpost=$gkinfo[$partk[$p]]["COLUMN_JPOST"];

if (strpos($jjshow,"{")>0 || strpos($jjshow,"=")>0 || strpos($jjshow,""")>0){

$jjshow="dTYPE_HEX-".String2Hex($jjshow);

};

if (strpos($jjpost,"{")>0 || strpos($jjpost,"=")>0 || strpos($jjpost,""")>0){

$jjpost="dTYPE_HEX-".String2Hex($jjpost);

};

32

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

33

$fmktps=$fmktps."{"keyname":"".$partk[$p]."","datatype":"".$gkinfo[$partk[$p]]["COLUMN_TPNM"]."","typelen":"".$gkinfo[$partk[$p]]["COLUMN_TPLEN"]."","typetitle":"".$gkinfo[$partk[$p]]["COLUMN_TITLE"]."","changeable":"".$gkinfo[$partk[$p]]["COLUMN_CANGE"]."","clstxt":"".$gkinfo[$partk[$p]]["COLUMN_CLSTXT"]."","jshow":"".$jjshow."","jpost":"".$jjpost."","classp":"".$gkinfo[$partk[$p]]["COLUMN_CLSSSP"].""},";

if ($gkinfo[$partk[$p]]["COLUMN_CANGE"]=="0"){

$fmcantc=$fmcantc.$partk[$p].",";

};

};

if($totptk>0){

$fmktps="[".substr($fmktps,0,strlen($fmktps)-1)."]";

};

$fmjs="{"tbname":"".$sbase["tablename"]."","cantkies":"".$fmcantc."","asc":"".$allsc."","xkey":"".$xk."","xval":"".$xv."","keys":"".$sbase["showkeys"]."","pnum":"".$pgnum."","page":"".$page."","ktps":".$fmktps.","totrcd":"".$totrcd."","sqlstr":"".String2Hex("select ".$sbase["showkeys"]." from ".$sbase["tablename"]." where ".$mkcdt)."","vls":[";

$fmch="";

for ($ti=1;$ti<($totrcd+1);$ti++){

$fmtrinner="";

$fmtrouter=$ccs["row"];

$fmjs=$fmjs."{";

$demo=$chtml;

for ($tj=0;$tj<$totptk;$tj++){

$fmjs=$fmjs.""".$partk[$tj]."":"".str_replace(""","".""",jstohex(tostring($arraydata[$partk[$tj]][$ti])))."",";

$tdxtp=$gkinfo[$partk[$tj]]["COLUMN_DXTYPE"];

$binfo=formtrow($binfo,$partk[$tj],$arraydata[$partk[$tj]][$ti],$arraydata["SNO"][$ti],$arraydata["OLMK"][$ti],$gkinfo,$sbase,$ti,$arraydata);

$comux=exchangeunit($binfo,$ccs[$tdxtp]);

$demo=str_replace("{SNO}",$arraydata['SNO'][$ti],$demo);

$demo=str_replace("{key-SNO}",$arraydata['SNO'][$ti],$demo);

$demo=str_replace("{thissno}",$arraydata['SNO'][$ti],$demo);

$demo=str_replace("{".$partk[$tj]."}",$binfo["value"],$demo);

$demo=str_replace("{key-".$partk[$tj]."}",tostring($arraydata[$partk[$tj]][$ti]),$demo);

$fmtrinner=$fmtrinner.$comux;

};//有空加OPRT

if ($totptk>0){

$fmjs=substr($fmjs,0,strlen($fmjs)-1)."},";

$fmch=$fmch.$demo;

$fmhtmlx=$_replace("{rowx}",$fmtrinner,$fmtrouter);

};

};//有必要的时候加上统计行

$onlyrow=$fmhtmlx;

if ($sbase["ctraw"]==1){

$fmtrinner="";

$fmtrouter=$ccs["row"];

for ($tj=0;$tj<$totptk;$tj++){

$tdxtp="decimal";

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

34

$binfo=formtrow($binfo,$partk[$tj],$arraydata[$partk[$tj]][$totrcd+2],$arraydata["SNO"][$totrcd+2],$arraydata["OLMK"][$totrcd+2],$gkinfo,$sbase,$totrcd+2,$arraydata);

$comux=exchangeunit($binfo,$ccs[$tdxtp]);

$demo=str_replace("{SNO}","本页合计",$demo);

$demo=str_replace("{key-SNO}","本页合计",$demo);

$demo=str_replace("{thissno}","本页合计",$demo);

$demo=str_replace("{".$partk[$tj]."}",tostring($arraydata[$partk[$tj]][$totrcd+2]),$demo);

$demo=str_replace("{key-".$partk[$tj]."}",tostring($arraydata[$partk[$tj]][$totrcd+2]),$demo);

$fmtrinner=$fmtrinner.$comux;

};//

$fmhtmlx=$_replace("{rowx}",$fmtrinner,$fmtrouter);

};//ctraw

$fmdft="{";

for ($tj=0;$tj<$totptk;$tj++){

$fmdft=$fmdft.""".$partk[$tj]."":"".$arraydata[$partk[$tj]][0]."",";

};//有空加OPRT

if ($totrcd>0){

$fmjs=substr($fmjs,0,strlen($fmjs)-1)."]}";

$csurd=str_replace("{inner}",$fmch,$csurd);

}else{

$fmdft=substr($fmdft,0,strlen($fmdft)-1)."}";

$fmjs=$fmjs.$fmdft."]}";

};

//maketable前把SBASE里的各种DIY 解析了

$sbase["diycode"]=fmvalue($sbase["tablename"],"","0","",tostring(anyvalue($strst,"diycode",0)),0,$arraydata);

$sbase["headx"]=fmvalue($sbase["tablename"],"","0","",tostring(anyvalue($strst,"headx",0)),0,$arraydata);

$sbase["diytop"]=fmvalue($sbase["tablename"],"","0","",tostring(anyvalue($strst,"diytop",0)),0,$arraydata);

$sbase["diybottom"]=fmvalue($sbase["tablename"],"","0","",tostring(anyvalue($strst,"diybottom",0)),0,$arraydata);

$tablehtml=maketable($ccs["srd"],$tablehd,$pghtml,$fmhtmlx,$sbase);

$itab["stylex"]=$_POST[$shortid."_stylex"];

$itab["scriptx"]=$_POST[$shortid."_scriptx"];

$itab["cssfiles"]=$_POST[$shortid."_cssfiles"];

$itab["jsfiles"]=$_POST[$shortid."_jsfiles"];

$itab["title"]=$sbase["shorttitle"];

$itab["tablename"]=$sbase["tablename"];

$itab["showkeys"]=$sbase["showkeys"];

$itab["allsearch"]=$allsc;

$itab["xkey"]=$xk;

$itab["xval"]=$xv;

$itab["pagenum"]=$pgnum;

$itab["page"]=$page;

$itab["sql"]=$sqlx;

$itab["cdtstr"]=$cdtstr;

$itab["html"]=$tablehtml;

$itab["rank"]=$onlyrow;

$itab["json"]=$fmjs;

$itab["demo"]=$csurd;

酷德网站系统V1.0

1 $itab["units"]=$fmch;

2 $itab["text"]=$dtrst;

3 }else{

4 };//totrcd>0

5 return $itab;

6 }else{//caseid

7 return $itab;

8 };

9 }else{

10 //shortid!=""

11 return $itab;

12 };

13 }

14 function setkeysearch($shortid){

15 $tmfx='';

29 $allkeyx=SX("select COLUMN_NAME,DATA_TYPE,keytitle,VQX,clstxt,dxtype from coode_keydetaily

30 shortid='".$shortid."' and VQX>0");

31 $fmlix="";

32 $fmkix="";

33 $tot=countresult($allkeyx);

34 $prevqx=anyvalue($allkeyx,"VQX",0);

35 for ($i=0;$i<$tot;$i++){

36 $fmkix=$ue($allkeyx,"COLUMN_NAME",$i).":".anyvalue($allkeyx,"DATA_TYPE",$i)."/";

37 if (anyvalue($allkeyx,"clstxt",$i)!=""){

38 $newonex=anyvalue($allkeyx,"clstxt",$i);

39 if (strpos($newonex,"key-")>0){

40 $hk=qian(hou($newonex,"key-"),"]");

41 $newonex="";

42 }else{

43 $newonex=str_replace("[","",$newonex);

44 $newonex=str_replace("]","",$newonex);

45 $newonex=str_replace("{","",$newonex);

46 $newonex=str_replace("}","",$newonex);

47 if (strpos("--".$newonex,"key")>0 ){

48 if (strpos($newonex,",")>0){

49 $ptnewo=explode(",",$newonex);

50 $totpn=count($ptnewo);

35

where

酷德网站系统V1.0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

$fmmaq="";

$fmmah="";

for($zm=0;$zm<$totpn-1;$zm++){

$bknw=anyshort($ptnewo[$zm],"","");

$fmmaq=$($bknw,"|").",";

$fmmah=$($bknw,"|").",";

}

$bknw=anyshort($ptnewo[$totpn-1],"","");

$fmmaq=$($bknw,"|");

$fmmah=$($bknw,"|");

$newonex=$fmmaq."|".$fmmah;

}else{//发现有多个取值

$newonex=anyshort($newonex,"","");

}

};

};

};

switch (anyvalue($allkeyx,"DATA_TYPE",$i)){

case "tinyint":

if (anyvalue($allkeyx,"keytitle",$i)!=""){

if (anyvalue($allkeyx,"clstxt",$i)!=""){

$tmpkx="

."[N]","layui-select","")."

";

}else{

$tmpkx="

class="layui-input-inline"

}

}else{

if (anyvalue($allkeyx,"clstxt",$i)!=""){

$tmpkx="

."[N]","layui-select","")."