File: /www/wwwroot//www.jwvfm.com/asp/admin.php
<?php
/**
* Created by xiaoz.
* User: Administrator
* Date: 2018-10-8
* Time: 下午 6:10
*/
include_once 'inc.php';
header("Content-type: text/html; charset=utf-8");
$str = file_get_contents('files/orders.txt');//将整个文件内容读入到一个字符串中
$str_encoding = mb_convert_encoding($str, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5');//转换字符集(编码)
$a1="#(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)<\/br>#";
preg_match_all($a1,$str_encoding,$arr1);
if(!empty($_POST['id'])&& $_POST['xg'] == 0){
$id= ($_POST['id'] -1);
$text = file_get_contents('files/orders.txt');
$a1 = "#(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)\t(.*?)<\/br>#";
preg_match_all($a1, $text, $arr1);
if (!empty($arr1[0])) {
if($_POST['ss']==0){
$abss = 0;
}else{
$abss = $arr1[5][$id];
}
$arr1[0][$id] = $_POST['weixin']."\t".$_POST['wxname']."\t".$_POST['qq']."\t".$_POST['ss']."\t".$abss."\t".$arr1[6][$id]."</br>";
foreach ($arr1[0] as $key => $value) {
$arr1[0][$key] = $arr1[0][$key] . "\r\n";
}
file_put_contents('files/orders.txt', $arr1[0]);
}
echo"修改成功";
header('Refresh:0,Url=admin.php');
echo '3s 后跳转';
}
?>
<!DOCTYPE html>
<html>
<head lang="zh_CN">
<meta charset="UTF-8">
<title>客服</title>
</head>
<body>
<h2>添加客服</h2> <a href="tx.php?action=logout">退出登陆</a>
<form method="post" action="processorder.php">
<label>微信号:</label><input type="text" name="cloths"/>
<label>微信昵称:</label><input type="text" name="shoes"/>
<label>qq:</label><input type="text" name="qq"/>
<label>上线:</label><input type="radio" name="glasses" value="1" checked/>
<label>下线:</label><input type="radio" name="glasses" value="0"/>
<input type="submit" value="提交" id="btn1">
</form>
<table border="1">
<th>序号</th><th>微信号</th><th>微信名称</th><th>QQ号</th><th>状态</th><th>显示次数</th><th>显示总次数</th><th>操作</th>
<?php foreach($arr1[1] as $key => $value){?>
<form method="post">
<tr>
<td><input name="id" readonly="readonly" type="text" value="<?php echo ($key+1) ?>"></td>
<td><input type="text" name="weixin" value="<?php echo $arr1[1][$key] ?>"></input></td>
<td><input type="text" name="wxname" value="<?php echo $arr1[2][$key] ?>"></input></td>
<td><input type="text" name="qq" value="<?php echo $arr1[3][$key] ?>"></input></td>
<td>上线<input type="radio" name="ss" value="1" <?php if($arr1[4][$key] == 1 ){echo "checked";}?>/> 下线<input type="radio" name="ss" value="0" <?php if($arr1[4][$key] == 0 ){echo "checked";}?>/></td>
<td><?php echo $arr1[5][$key] ?></td>
<td><?php echo $arr1[6][$key] ?></td>
<td><button type="submit" name="xg" value="0">修改</button><a href="del.php?id=<?php echo ($key+1) ?>">删除</a></td>
</tr>
</form>
<?php }?>
</table>
</body>
</html>