<?php
ob_start();
ignore_user_abort(true);
if($_SERVER['HTTP_APPVERSION']){
include "./saesiteinfo.php";
}else{
 if(!file_exists("./install/install.lock")){
header('location:./install');
exit;
 }else{
include "./siteinfo.php";
 }
}
include './tongji.php';
//连接数据库
$localhost=mysql_connect($sqlhost,$sqluser,$sqlpass)or die("无法连接服务器");
mysql_select_db($sqldata,$localhost);
if (isset($_COOKIE["SHANIUUSER"]) && isset($_COOKIE["SHANIUPASS"])){
$user=$_COOKIE["SHANIUUSER"];
$pass=$_COOKIE["SHANIUPASS"];
$mysql=mysql_query("SELECT * FROM user WHERE user='$user'");
$sql =mysql_fetch_array($mysql);
if (isset($_GET['qid'])){
$qid=$_GET['qid'];
}else{
$qid="0";
}
$qqmysql = mysql_query("SELECT * FROM qqlist WHERE qid='$qid' and myqq='$user'");
$qqinfo = mysql_fetch_array($qqmysql);
$qqhao=$qqinfo['qq'];
$qqmima=$qqinfo['pw'];
$fwq=$qqinfo['fwq'];
$sid=$qqinfo['sid'];
?>
<html>
<head>
<meta content="width=device-width,user-scalable=no" name="viewport">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>更换服务器 - <?php echo $sitename; ?></title>
<script src="js/jquery-1.8.0.min.js" type="text/javascript" ></script>
<link rel="stylesheet" type="text/css" href="css/register.css"/>
</head>
<body>
<div class='signup_container'>
    <h1 class='signup_title'>更换服务器</h1>
    <?php
    if ($pass!=$sql['pass']){
    echo "您还没有登录账户";
    }elseif ($qqhao==""){
    echo '您要更换服务器的QQ号不存在';
    }else{
    echo '需要更换服务器的QQ号码:'.$qqhao;
    }
    ?>
<td height="50" align="center">
    <?php
    if ($pass!=$sql['pass']){
    echo "您还没有登录账户";
    }elseif ($qqhao==""){
    echo '您要更换服务器的QQ号不存在';
    }else{
    //开始更换服务器
    if (empty($_POST['submit'])){
    ?>
        <div id="signup_forms" class="signup_forms clearfix">
            <form class="signup_form_form" action="" method="post" >
                    <select name="changefwq" style="width:260px">
<option value="" selected="selected">请选择服务器</option>
<option value="fw1">①号服务器@<?php echo '挂Q数【'.$fw1.'】';?></option>
<option value="fw2">②号服务器@<?php echo '挂Q数【'.$fw2.'】';?></option>
<option value="fw3">③号服务器@<?php echo '挂Q数【'.$fw3.'】';?></option>
<option value="fw4">④号服务器@<?php echo '挂Q数【'.$fw4.'】';?></option>
<option value="fw5">⑤号服务器@<?php echo '挂Q数【'.$fw5.'】';?></option>
<option value="fw6">⑥号服务器@<?php echo '挂Q数【'.$fw6.'】';?></option>
<option value="fw7">⑦号服务器@<?php echo '挂Q数【'.$fw7.'】';?></option>
<option value="fw8">⑧号服务器@<?php echo '挂Q数【'.$fw8.'】';?></option>
</select>
           
</div>

    <div class="login-btn-set"><div class='rem'>同意规定</div> <input type="submit" name="submit" value=" " class="login-btn3">
</div></form>
	<?php
    }else{
$changefuwu['fw1']="①号服务器";
$changefuwu['fw2']="②号服务器";
$changefuwu['fw3']="③号服务器";
$changefuwu['fw4']="④号服务器";
$changefuwu['fw5']="⑤号服务器";
$changefuwu['fw6']="⑥号服务器";
$changefuwu['fw7']="⑦号服务器";
$changefuwu['fw8']="⑧号服务器";
    $changefwq=$_POST['changefwq'];
    if ($changefwq==""){
    echo "请选择服务器再操作";
    }else{
    mysql_query("INSERT INTO $changefwq (id,qid,qq,pw,sid) VALUES ('','$qid','$qqhao','$qqmima','$sid')");
    mysql_query("DELETE FROM $fwq WHERE qid='$qid'");
    mysql_query("UPDATE qqlist SET fwq='$changefwq' WHERE qid='$qid'");
    echo "您成功改为:".$changefuwu[$changefwq];
    }
    }
    }
    ?>
</td>
  </tr>
  <tr>
    <td height="57"><div align="center"><a href="./user.php">返回挂Q页面</a></div></td>
  </tr>
  </div>
</body>
</html>
<?php
}else{
header("Location: ./tishi.php");
}
?>