<?php
/**/
$title = "后台管理";
include('head.php');
echo"<div class='w'>";
echo "<a href=ad.php>后台管理</a>";
echo'|';
echo "<a href=ad.php?action=gg>排版管理</a>";
echo'|';
echo "<a href=ad.php?action=set>配置管理</a>";
echo'|';
if ($a == 0) {
echo '<a href="ad.php?action=tj">开启挂机</a>';
} else {
echo '<a href="ad.php?action=tj">停止挂机</a>';
}
echo "</div>";
echo"<div class='nh'>";
if($_COOKIE['admin']){
if($action=='action'){
$qq=mysql_query('select * from niandaledou order by id desc');
while($result=mysql_fetch_array($qq)){
echo "{$result['qq']}:<a href='
http://dld.qzapp.z.qq.com/qpet/cgi-bin/phonepk?cmd=index&zapp_sid={$result['sid']}&zapp_uin={$result['qq']}&from=qqpet'>进入大乐斗游戏</a>";
echo'|';
echo "<a href='ad.php?action=delete&id={$result['id']}'>删除</a><br>";
}
echo "</div>";
include('foot.php');
exit();
}
if($action=='delete'){
echo"您确定要删除吗?<br><a href='ad.php?action=delete2&id={$id}'>确定</a> | <a href='ad.php'>取消</a>";
echo "</div>";
include('foot.php');
exit();
}
if($action=='delete2'){
mysql_query("delete from niandaledou where id='$id'");
echo "删除成功!";
echo "</div>";
include('foot.php');
exit();
}
if ($action == 'set') {
echo '<form action="ad.php" medhod="get"><input type="hidden" name="action" value="num">管理账号:<br><input type="text" name="useradmin" value="' . $useradmin . '"><br>管理密码:<br><input type="text" name="passadmin" value="' . $passadmin . '"><br/>网站网名:<br><input type="text" name="wznc" value="' . $wznc . '"><br>添加挂机最大数量:<br><input type="text" name="num" value="' . $num . '"><br>每次运行数量:<br><input type="text" name="x" value="' . $x . '"> <br><input type="submit"
value="确定修改"></form>';
}
if ($action == 'num') {
$uadmin = $_GET['useradmin'];
$upass = $_GET['passadmin'];
$nc = $_GET['wznc'];
$gjnum = $_GET['num'];
$xx = $_GET['x'];
$num = '<?php
$useradmin = \''.$uadmin.'\';
$passadmin = \''.$upass.'\';
$wznc= \''.$nc.'\';
$num =\''.$gjnum.'\';
$x =\''.$xx.'\';
?>';
file_put_contents('num.php', $num) or die("修改出错!");
echo "修改成功!";
}
if ($action =='tj' ){
if ($a == 0) {
$i = 1;
unlink($fi);
fopen($fi, "x");
$fp = fopen($fi, "a");
fwrite($fp, $i);
fclose($fp);
echo "开启成功!";
} else {
$i = 0;
unlink($fi);
fopen($fi, "x");
$fp = fopen($fi, "a");
fwrite($fp, $i);
fclose($fp);
echo "停止成功!";
}
}
if($action=='gg'){
$gg1 = "gg.php";
$fp1 = fopen($gg1, "a ");
$data1 = fgets($fp1);
fclose($fp1);
$gg2 = "lx.php";
$fp2 = fopen($gg2, "a ");
$data2 = fgets($fp2);
fclose($fp2);
if ($_POST["ok"] != "1") {
echo '<form action="' . $_SERVER[PHP_SELF] . '?action=gg" method="POST"><input type="hidden" name="ok" value="1" >顶部:<br><textarea name="text1" rows="10" cols="32">' . $data1 . '</textarea><br>底部:<br><textarea name="text2" rows="10" cols="32">' . $data2 . '</textarea> <br><input type="submit" value="修改">';
}else{
echo "修改成功";
$data1 = $_POST['text1'];
$data1 = str_replace('<?', '', $data1);
$fp1 = fopen($gg1, "a ");
ftruncate($fp1, 0);
fwrite($fp1, $data1);
fclose($fp1);
$data2=$_POST['text2'];
$data2 = str_replace ('<?','',$data2);
$fp2=fopen($gg2,"a ");
ftruncate($fp2,0);
fwrite($fp2,$data2);
fclose($fp2);
}
}
}else{
if($action=='login'){if($nadmin==$useradmin&&$npass==$passadmin){
setcookie('admin',$nadmin,time() 3600*24);
echo "登录成功!<a href=ad.php>点此刷新</a>";
echo "</div>";
include('foot.php');
exit();
}else{
echo "登录失败,账号或者密码错误!"; echo "</div>";
include('foot.php');
exit();
}
}
echo'<form action="ad.php?action=login" method="post">管理账号:<br />
<input type="text" name="useradmin"/><br />管理密码:<br />
<input type="password" name="passadmin"/><br>
<input type="submit" value="登录"/>';
}
echo "</div>";
include('foot.php');
?>