<?
#############################################################
#  XYListmail Version 多用户4.0版  ( 星原邮件列表程序 )
#
#  版权所有: 星原商务网络
#
#  制作人  : cxrich   (星原浪子)
#
#  主页地址: http://www.exyweb.com/      星原商务网络
#
####################任何人不得删除此版权部分####################
require("config.php");

$titleurl="<a href=$weburl target=_blank>$titlename</a>";
$mail_copy="<a href=http://www.exyweb.com target=_top><font color=red>星原商务网络</a></font>";

$PHP_SELF = $weburl.$HTTP_SERVER_VARS["PHP_SELF"];

$del=$_REQUEST['del'];
$see=$_REQUEST['see'];
$page=$_REQUEST['page'];
$conent=$_REQUEST['conent'];

$cookie_adminme=$_REQUEST['cookie_adminme'];
$cookie_passwd=$_REQUEST['cookie_passwd'];

$admin="admin.php";

switch($admin or $del or $see or $page or $conent){
case($admin!="" and $del=="" and $see=="" and $page=="" and $conent==""):
//case($_REQUEST['admin']!="" and $_REQUEST['del']=="" and $_REQUEST['see']=="" and $_REQUEST['page']=="" and $_REQUEST['conent']==""):
$adminsub=$_REQUEST['$adminsub'];

$adminsub=$_REQUEST['adminsub'];
if(!$adminsub){
?>
<html>
<head>
<title>邮件列表超级管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<center>
  <table width="750" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td> 
        <form action="<? echo $PHP_SELF;?>" method=post>
          <div align="center"><br>
            <br>
            <font color=red size=3><b>超 级 用 户 管 理</b></font><br>
            <br>
          </div>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr> 
              <td width="50%"> 
                <div align="right">超级用户名：</div>
              </td>
              <td width="50%"> 
                <input type="text" name="adminname">
              </td>
            </tr>
            <tr> 
              <td width="50%"> 
                <div align="right">超级用户密码：</div>
              </td>
              <td width="50%"> 
                <input type="password" name="adminpwd">
              </td>
            </tr>
            <tr> 
              <td colspan="2"> 
                <div align="center"> 
                  <input class="new_input" type="submit" name="adminsub" value="登录">
                </div>
              </td>
            </tr>
          </table>
        </form>
      </td>
    </tr>
    <tr> 
      <td> 
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td> 
        <div align="center"><b>邮件列表服务由 <font color=red> 
          <? echo $titleurl;?>
          </font> 提供　程序制作： 
          <? echo $mail_copy;?>
          </b></div>
      </td>
    </tr>
  </table>
  </center>
</body>
</html>
<?
}else{
	$adminname=$_REQUEST['adminname'];
	$adminpwd=$_REQUEST['adminpwd'];
	$adminname=md5($adminname);
	$adminpwd=md5($adminpwd);
	if(($adminname!=md5($adminme))&&($adminname!=md5($adminme))) showerror("用户名输入有误");
	if(($adminpwd!=md5($passwd))&&($adminpwd!=md5($passwd))) showerror("密码输入有误");
	setcookie("cookie_adminme","$adminme");
	setcookie("cookie_adminpwd","$passwd");
	echo "<meta http-equiv=refresh content=0;url='$PHP_SELF?page=1'>";
}
break;
case($admin!="" and $del=="" and $see=="" and $page!="" and $conent==""):
$admindataname="list.php";
$admindata="$catalogdata/";
$adminfiledata=$admindata.$admindataname;
if(!file_exists($adminfiledata)){
	echo "<link rel=stylesheet href=main.css type=text/css><br><br><center>还没记录<br><br><a href=$filepath/admin.php>返回</a><br><br></center>";
}else{
?>
<html>
<head>
<title>邮件列表超级管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<center><br><font color=red size=3><b>超 级 用 户 管 理</b></font><br><br>
<TABLE width="750">
<TR>
	<TD><? echo "<a href=$PHP_SELF?conent=conent>";?>设置邮件列表申请权限</a></TD>
</TR>
</TABLE></center>
<table width="750" border="1" cellspacing="2" cellpadding="0" align="center" bgcolor="#FFEEEE" bordercolorlight="#008000" bordercolordark="#FFFFFF">
  <tr> 
    <td width="170"> 
      <div align="center">管理人</div>
    </td>
    <td width="371"> 
      <div align="center">列表名称</div>
    </td>
    <td width="52"> 
      <div align="center">订户数</div>
    </td>
    <td width="87"> 
      <div align="center">申请时间</div>
    </td>
    <td width="46"> 
      <div align="center">查看</div>
    </td>
    <td width="46">
      <div align="center">删除</div>
    </td>
  </tr>
<?
if (!isset($page)) $page=1;  //设置没有PAGE参数,PAGE自动为1
$pageno=$pageno;
$x=($page-1)*$pageno;
$nn=1;
$line_array=file($adminfiledata);
$linenum=count($line_array);
while($x<$linenum){
		$name=trim($line_array[$x]);
		$admin_filename="$name.php";
		$admin_fileuser="$cataloguser/$admin_filename";
		$temp=file("$admin_fileuser");
		$tempcount=count("$temp");
//求订户数
$fileread="$catalogdata/";
$filedata_s=$fileread."$name/$name.php";
$fileuser_s=file("$filedata_s");
$counte_s=count($fileuser_s);
//求订户数结束
	for ($i=0; $i<$tempcount; $i++)
		{
		$line="$temp[$i]";
		$info=split(" ‖‖ ",$line);
?>
  <tr> 
    <td width="170" height="21"> 
      <a href=mailto:<? echo $info[3]; ?>><img src="<?echo $imagesurl?>/mail.gif" width="16" height="16" border="0" alt="给列表管理者发送邮件"></a> <? echo $info[1]; ?>
    </td>
    <td width="371" height="21"> 
      <img src="<?echo $imagesurl?>/htm.gif" width="16" height="16" border="0"> <a href=<? echo "$filepath/$setupname?id=$info[1]"; ?> target=_blank><? echo $info[0]; ?></a>
    </td>
    <td width="52" height="21"> 
      <center>
        <? echo $counte_s; ?>
      </center>
    </td>
    <td width="87" height="21"> 
      <center>
        <? echo $info[9]; ?>
      </center>
    </td>
    <td width="46" height="21"> 
      <center>
        <? echo "<a href=$PHP_SELF?see=$info[1]>";?><img src="<?echo $imagesurl?>/fav.gif" width="16" height="16" border="0"></a></center>
    </td>
    <td width="46" height="21">
      <div align="center"><? echo "<a href=$PHP_SELF?del=$info[1]>";?><img src="<?echo $imagesurl?>/del.gif" width="16" height="16" border="0"></a></div>
    </td>
  </tr>
  <?
	}
$x++;
$nn++;
if($nn>$pageno){break;}
}
echo "</table>";
echo "<br><div align=\"center\">";
//计算页面
if($linenum%$pageno==0)
{
 $countsum=$linenum/$pageno;
}
else
{
$countsum=floor($linenum/$pageno)+1;
}
//分页显示数据
print "<a href=$filepath/$admin?page=1>首 页</a>";
$up=$page-1;
$dn=$page+1;
if($page >1){
print " <a href=$filepath/$admin?page=$up>上一页</a> ";
}
else{
echo " 上一页 ";
}
if($page >= $countsum){
print " 下一页 ";
}else{
print " <a href=$filepath/$admin?page=$dn>下一页</a> ";
}
print " <a href=$filepath/$admin?page=$countsum>尾 页</a>";
echo "共 <font color=#FF0000>$linenum</font> 条 每页 <font color=#FF0000>$pageno</font> 条记录";
echo "<p></p></div>";
}
?>
        <div align="center"><b>邮件列表服务由 <font color=red> 
          <? echo $titleurl;?>
          </font> 提供　程序制作：<font color=red> 
          <? echo $mail_copy;?>
          </font> </b></div></center>
<?

break;
case($admin!="" and $del=="$del" and $see=="" and $page=="" and $conent==""):
//删除注册用户
if ($cookie_adminme or $cookie_passwd)
{
if($delsub){
$deldataname="list.php";
$deldata="$catalogdata/";
$delfiledata=$deldata.$deldataname;
$delfileuser=file("$delfiledata");
$delcounte=count($delfileuser);
	for ($j=0; $j<$delcounte; $j++)
	{
		if (trim($delfileuser[$j])!=$del)
		{
			$tt=trim($tt.$delfileuser[$j])."\n";
		}
	}
$fileuser=fopen("$delfiledata",'w+');
fwrite($fileuser,"$tt");
fclose($fileuser);

$datadel=$del;
$datadelfile="$deldata$datadel/$datadel.php";
unlink($datadelfile);
if(!file_exists("$deldata$datadel/list.php")){
rmdir($deldata.$datadel);
}else{
unlink("$deldata$datadel/list.php");
rmdir($deldata.$datadel);
}

$userdata="$cataloguser/";
$userfile=$userdata."$datadel.php";
unlink($userfile);

$admindatadelname="list.php";
$admindatadel="$catalogdata/";
$adminfiledeldata=$admindatadel.$admindatadelname;
if(filesize($adminfiledeldata)==0){
unlink($adminfiledeldata);
}
echo "<center><p><P>操作成功！<BR><FORM><INPUT class=new_input TYPE=button VALUE=按此返回 onClick=history.go(-2)></FORM>";
}else{
echo "<center><p>&nbsp;</p><p>&nbsp;</p><form action=$php_sel?del=$del method=post><input class=new_input type=submit name=delsub value= 确定删除该邮件列表吗？ ><input type=hidden name=del value=$del></form><FORM><INPUT class=new_input TYPE=button VALUE=返回不删除 onClick=history.go(-1)></FORM></center>";
}
}
else
{
showerror("帐号闲置过长或你无此权限、请勿越权操作！");
}
break;
case($admin!="" and $del=="" and $see=="$see" and $page=="" and $conent==""):
//查看注册用户资料
if ($cookie_adminme or $cookie_passwd)
{
$name=$see;
$seename="$name.php";
$seedata="$cataloguser/";
$seedatafile=$seedata.$seename;
$seefile=file("$seedatafile");
$seecounte=count($seefile);
if ($seecounte>0)
  {
     $seeinfo=split(' ‖‖ ',$seefile[0]);
  }
?>
<html>
<head>
<title>查看 <? echo $see; ?> 的邮件列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script src="reg.js"></script>
<link rel="stylesheet" href="main.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
  <table width="750" border="1" cellspacing="1" cellpadding="1" align="center" bgcolor="#FFCC66" bordercolorlight="#008000" bordercolordark="#FFFFFF">
    <tr> 
      <td bgcolor="#6666FF"> 
        <div align="center"><b><font color="#FFFFFF" size="3">查看 <? echo $see; ?> 的邮件列表</font></b></div>
      </td>
    </tr>
    <tr> 
      <td> 
        <table width="99%" border="0" cellspacing="1" cellpadding="0" align="center" bgcolor="#9999FF">
          <tr> 
            <td width="22%"> 
              <div align="right">邮件列表名称：</div>
            </td>
            <td width="78%"> 
              <input type="text" name="mailname" size="50" value="<? echo $seeinfo[0]; ?>">
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">管理员名称：</div>
            </td>
            <td width="78%"> 
              <input type="text" name="name" size="20" value="<? echo $seeinfo[1]; ?>">
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">管理员密码：</div>
            </td>
            <td width="78%"> 
              <input type="password" name="passwd" size="20" value="<? echo $seeinfo[2]; ?>">
			</td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">Email地址：</div>
            </td>
            <td width="78%"> 
              <input type="text" name="email" size="50" value="<? echo $seeinfo[3]; ?>">
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">主页名称：</div>
            </td>
            <td width="78%"> 
              <input type="text" name="urlname" size="50" value="<? echo $seeinfo[4]; ?>">
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">主页的URL：</div>
            </td>
            <td width="78%"> 
              <input type="text" name="urladd" size="50" value="<? echo $seeinfo[5]; ?>">
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">邮件列表简介：</div>
            </td>
            <td width="78%"> 
              <textarea name="mailtext" cols="70" rows="4" value=""><? echo $seeinfo[6]; ?></textarea>
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">邮件列表头部显示信息：<br>
                （支持 html）</div>
            </td>
            <td width="78%"> 
              <textarea name="mailtopinfo" cols="70" rows="4" value=""><? echo $seeinfo[7]; ?></textarea>
            </td>
          </tr>
          <tr> 
            <td width="22%"> 
              <div align="right">邮件列表尾部显示信息：<br>
                （支持 html）</div>
            </td>
            <td width="78%"> 
              <textarea name="mailbminfo" cols="70" rows="4" value=""><? echo $seeinfo[8]; ?></textarea>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr> 
      <td> 
        <div align="center">
          <FORM><INPUT class=new_input TYPE=button VALUE=返回 onClick=history.go(-1)></FORM>
        </div>
      </td>
    </tr>
    <tr> 
      <td> 
        <div align="center"><b>邮件列表服务由 <font color=red> 
          <? echo $titleurl;?>
          </font> 提供　程序制作：<font color=red> 
          <? echo $mail_copy;?>
          </font> </b></div>
      </td>
    </tr>
  </table>
</body>
</html>
<?
}
else
{
showerror("帐号闲置过长或你无此权限、请勿越权操作！");
}
break;
case($admin!="" and $del=="" and $see=="" and $page=="" and $conent=="conent"):
if ($cookie_adminme or $cookie_passwd)
{

if($_REQUEST['conentsub']){
	$concentname="concent.php";
	$concentdata="$catalogdata/";
	$concentfile=$concentdata.$concentname;
	if(!file_exists($concentfile)){
	$fpconcent="1";
	$fp=fopen("$concentfile","w");
	fwrite($fp,"$fpconcent");
	fclose($fp);
	chmod("$concentfile", 0777);
	system("chmod 0777 $concentfile");
	}
	$conenttxt=strip_tags(trim($conenttxt));
	$conentvar="$conentset\n$conenttxt";
	$f=fopen("$concentfile","w");
	fwrite($f,$conentvar);
	fclose($f);
	echo "注册权限修改成功！";
	echo "<meta http-equiv=refresh content=1;url='$filepath/$admin?page=1'>";
}else{
?>
<html>
<head>
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body>
<table width="750" border="0" cellspacing="0" cellpadding="15" align="center">
  <tr> 
    <td> 
      <div align="center"><b><font color="#FF0000" size="3">设置邮件列表是否允许注册</font></b></div>
    </td>
  </tr>
  <tr> 
    <td> 
      <form name=<?echo "$PHP_SELF?conent=conent";?> method="post" action="">
<?
$concentname="concent.php";
$concentdata="$catalogdata/";
$concentfile=$concentdata.$concentname;
if(!file_exists($concentfile)){
$fpconcent="1";
$fp=fopen("$concentfile","w");
fwrite($fp,"$fpconcent");
fclose($fp);
chmod("$concentfile", 0777);
system("chmod 0777 $concentfile");
}
$concentarr=file($concentfile);
if($concentarr[0]==1){
echo"<p>现在状态：<font color=red>允许申请</font></p>";
}else{
echo"<p>现在状态：<font color=red>不允许申请</font></p>";
}
?>
        <p>是否允许申请： 是 
          <input type="radio" name="conentset" value="1" checked>
          否 
          <input type="radio" name="conentset" value="0">
        </p>
        <p>不允许申请的理由：</p>
        <p> 
          <textarea name="conenttxt" cols="100" rows="3"></textarea>
        </p>
        <p align="center">
          <input class=new_input type="submit" name="conentsub" value=" 提交 ">  <FORM><INPUT class=new_input TYPE=button VALUE=不作修改返回 onClick=history.go(-1)></FORM>
        </p>
      </form>
    </td>
  </tr>
</table>
</body>
</html>
<?
}
}
else
{
showerror("帐号闲置过长或你无此权限、请勿越权操作！");
}
}
####################星原商务网络--版权所有#####################
?>