复制代码 代码如下:
<?php
class cat
{
public $data;
public function __construct()
{
@include "data.php";
$this->data = $class;
}
public function CreateSortLevel($fatherlevel)
{
if(empty($fatherlevel))
{
if(is_array($this->data))
{
$fast_level = array();
foreach($this->data as $value)
{
if(strlen($value["sortlevel"]) == 3)
{
$fast_level[] = $value["sortlevel"];
}
}
$max_fast_level = max($fast_level);
unset($fast_level);
$sub = ceil($max_fast_level) + 1;
switch(strlen($sub))
{
case 1:
return "00{$sub}";
break;
case 2:
return "0{$sub}";
break;
case 3:
return $sub;
break;
}
}
else
{
return "001";
}
}
foreach($this->data as $val)
{
if(eregi("^".$fatherlevel.".{3}$",$val["sortlevel"]))
{
$level[] = $val["sortlevel"];
}
}
if(is_array($level))
{
$max_two_level = max($level);
$sub = ceil(substr($max_two_level,-3)) + 1;
switch(strlen($sub))
{
case 1:
return substr($max_two_level,0,strlen($max_two_level)-1).$sub;
break;
case 2:
return substr($max_two_level,0,strlen($max_two_level)-2).$sub;
break;
case 3:
return substr($max_two_level,0,strlen($max_two_level)-3).$sub;
break;
}
}
else
{
return $fatherlevel."001";
}
}
public function orders()
{
$op = $this->data;
$this->array_usort($op,"sortlevel",SORT_ASC);
return $op;
}
public function add_cat($sortname,$sortlevel)
{
$data = time();
$arr = array
(
"{$data}" => array
(
"sortname" => $sortname,
"sortlevel" => $this->CreateSortLevel($sortlevel)
)
);
$rs = $this->data + $arr;
$this->add_wirte($rs);
}
private function array_usort(&$array)
{
$args = func_get_args();
for($i=1,$cmd='',$size=count($args);$i<$size;$i++)
{
$num = $i;
$order = "";
$con = "@strcmp($a['$args[$num]'],$b['$args[$num]'])";
while(++$i < $size)
{
if($args[$i] === SORT_NUMERIC)
{
$con = "($a['$args[$num]']-$b['$args[$num]'])";
}
else if($args[$i] === SORT_DESC)
{
$order = "-1*";
}
else if(is_string($args[$i]))
{
$i--;
break;
}
}
$cmd .= "if($num = $con)return $order$num;else ";
if($order != '')
{
$i++;
}
}
@usort($array,@create_function('$a,$b',"$cmd return 0;"));
}
public function wirte($sortname,$sortlevel)
{
$array = "<?phprn";
$array .= '$class = array'."rn(rn";
$array .= ' "'.time().'" => array'."rn";
$array .= ' ('."rn";
$array .= ' "sortname" => "'.$sortname.'"'.",rn";
$array .= ' "sortlevel" => "'.$this->CreateSortLevel($sortlevel).'"'."rn";
$array .= ' )'."rn";
$array .= ")rn?>";
file_put_contents("data.php",$array);
}
public function add_wirte($rs)
{
$array = "<?phprn";
$array .= '$class = array'."rn(rn";
foreach($rs as $key=>$value)
{
$array .= "rn";
$array .= ' "'.$key.'" => array'."rn";
$array .= ' ('."rn";
$array .= ' "sortname" => "'.$value["sortname"].'"'.",rn";
$array .= ' "sortlevel" => "'.$value["sortlevel"].'"'."rn";
$array .= ' ),';
}
$array = substr($array,0,-1);
$array .= "rn)rn?>";
file_put_contents("data.php",$array);
}
}
$cat = new cat();
if($_GET["action"] == "add")
{
if(strlen($_POST["sortname"]) < 2)
{
echo '<script language="JavaScript">alert("请添加分类名字")</script>';
echo '<script language="JavaScript">location.href="/cat.php?action=tpl"</script>';
exit;
}
if(file_exists("data.php"))
{
$cat->add_cat($_POST["sortname"],$_POST["sortlevel"]);
echo '<script language="JavaScript">alert("添加成功")</script>';
echo '<script language="JavaScript">location.href="/cat.php"</script>';
exit;
}
else
{
$cat->wirte($_POST["sortname"],$_POST["sortlevel"]);
echo '<script language="JavaScript">alert("添加成功")</script>';
echo '<script language="JavaScript">location.href="/cat.php"</script>';
exit;
exit;
}
}
if($_GET["action"] == "tpl")
{
echo '<form id="form1" name="form1" method="post" action="cat.php?action=add">';"rn";
echo '<select name="sortlevel">'."rn";
echo '<option value="" selected="selected">根分类</option>'."rn";
foreach($cat->orders() as $val)
{
echo '<option value="'.$val["sortlevel"].'">';
$clevel = strlen(substr($val['sortlevel'],0,-3));
for($i = 0; $i < $clevel; $i++)
{
echo "-";
}
echo $val['sortname']."</option>rn";
}
echo "</select>rn";
echo ' <input name="sortname" type="text" id="sortname" />'."rn";
echo '<input type="submit" name="Submit" value="提交" />';
echo "</form>";
exit;
}
foreach($cat->orders() as $value)
{
$level = strlen(substr($value['sortlevel'],0,-3));
for($i = 0; $i < $level; $i++)
{
echo "-";
}
echo $value["sortname"];
echo "<br>";
}
?>
<?php
class cat
{
public $data;
public function __construct()
{
@include "data.php";
$this->data = $class;
}
public function CreateSortLevel($fatherlevel)
{
if(empty($fatherlevel))
{
if(is_array($this->data))
{
$fast_level = array();
foreach($this->data as $value)
{
if(strlen($value["sortlevel"]) == 3)
{
$fast_level[] = $value["sortlevel"];
}
}
$max_fast_level = max($fast_level);
unset($fast_level);
$sub = ceil($max_fast_level) + 1;
switch(strlen($sub))
{
case 1:
return "00{$sub}";
break;
case 2:
return "0{$sub}";
break;
case 3:
return $sub;
break;
}
}
else
{
return "001";
}
}
foreach($this->data as $val)
{
if(eregi("^".$fatherlevel.".{3}$",$val["sortlevel"]))
{
$level[] = $val["sortlevel"];
}
}
if(is_array($level))
{
$max_two_level = max($level);
$sub = ceil(substr($max_two_level,-3)) + 1;
switch(strlen($sub))
{
case 1:
return substr($max_two_level,0,strlen($max_two_level)-1).$sub;
break;
case 2:
return substr($max_two_level,0,strlen($max_two_level)-2).$sub;
break;
case 3:
return substr($max_two_level,0,strlen($max_two_level)-3).$sub;
break;
}
}
else
{
return $fatherlevel."001";
}
}
public function orders()
{
$op = $this->data;
$this->array_usort($op,"sortlevel",SORT_ASC);
return $op;
}
public function add_cat($sortname,$sortlevel)
{
$data = time();
$arr = array
(
"{$data}" => array
(
"sortname" => $sortname,
"sortlevel" => $this->CreateSortLevel($sortlevel)
)
);
$rs = $this->data + $arr;
$this->add_wirte($rs);
}
private function array_usort(&$array)
{
$args = func_get_args();
for($i=1,$cmd='',$size=count($args);$i<$size;$i++)
{
$num = $i;
$order = "";
$con = "@strcmp($a['$args[$num]'],$b['$args[$num]'])";
while(++$i < $size)
{
if($args[$i] === SORT_NUMERIC)
{
$con = "($a['$args[$num]']-$b['$args[$num]'])";
}
else if($args[$i] === SORT_DESC)
{
$order = "-1*";
}
else if(is_string($args[$i]))
{
$i--;
break;
}
}
$cmd .= "if($num = $con)return $order$num;else ";
if($order != '')
{
$i++;
}
}
@usort($array,@create_function('$a,$b',"$cmd return 0;"));
}
public function wirte($sortname,$sortlevel)
{
$array = "<?phprn";
$array .= '$class = array'."rn(rn";
$array .= ' "'.time().'" => array'."rn";
$array .= ' ('."rn";
$array .= ' "sortname" => "'.$sortname.'"'.",rn";
$array .= ' "sortlevel" => "'.$this->CreateSortLevel($sortlevel).'"'."rn";
$array .= ' )'."rn";
$array .= ")rn?>";
file_put_contents("data.php",$array);
}
public function add_wirte($rs)
{
$array = "<?phprn";
$array .= '$class = array'."rn(rn";
foreach($rs as $key=>$value)
{
$array .= "rn";
$array .= ' "'.$key.'" => array'."rn";
$array .= ' ('."rn";
$array .= ' "sortname" => "'.$value["sortname"].'"'.",rn";
$array .= ' "sortlevel" => "'.$value["sortlevel"].'"'."rn";
$array .= ' ),';
}
$array = substr($array,0,-1);
$array .= "rn)rn?>";
file_put_contents("data.php",$array);
}
}
$cat = new cat();
if($_GET["action"] == "add")
{
if(strlen($_POST["sortname"]) < 2)
{
echo '<script language="JavaScript">alert("请添加分类名字")</script>';
echo '<script language="JavaScript">location.href="/cat.php?action=tpl"</script>';
exit;
}
if(file_exists("data.php"))
{
$cat->add_cat($_POST["sortname"],$_POST["sortlevel"]);
echo '<script language="JavaScript">alert("添加成功")</script>';
echo '<script language="JavaScript">location.href="/cat.php"</script>';
exit;
}
else
{
$cat->wirte($_POST["sortname"],$_POST["sortlevel"]);
echo '<script language="JavaScript">alert("添加成功")</script>';
echo '<script language="JavaScript">location.href="/cat.php"</script>';
exit;
exit;
}
}
if($_GET["action"] == "tpl")
{
echo '<form id="form1" name="form1" method="post" action="cat.php?action=add">';"rn";
echo '<select name="sortlevel">'."rn";
echo '<option value="" selected="selected">根分类</option>'."rn";
foreach($cat->orders() as $val)
{
echo '<option value="'.$val["sortlevel"].'">';
$clevel = strlen(substr($val['sortlevel'],0,-3));
for($i = 0; $i < $clevel; $i++)
{
echo "-";
}
echo $val['sortname']."</option>rn";
}
echo "</select>rn";
echo ' <input name="sortname" type="text" id="sortname" />'."rn";
echo '<input type="submit" name="Submit" value="提交" />';
echo "</form>";
exit;
}
foreach($cat->orders() as $value)
{
$level = strlen(substr($value['sortlevel'],0,-3));
for($i = 0; $i < $level; $i++)
{
echo "-";
}
echo $value["sortname"];
echo "<br>";
}
?>
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2024年11月28日
2024年11月28日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]