<?php
if($_COOKIE['iQQol_Administrator']!=IQQOL_SPPASS)
{
    $style->assign("state",'COOKIE失效');
    $style->display('admin/index.html');exit();
}
else {
    if($_GET['edit']=='yes'){
        $edit=mysql_query("UPDATE ".IQQOL_SQLTABLE."config
 SET webdescript='{$_POST['webdescript']}' 
 WHERE id = '1'");
        $edit.=mysql_query("UPDATE ".IQQOL_SQLTABLE."config
 SET webkeyword='{$_POST['webkeyword']}' 
 WHERE id = '1'");
        $edit.=mysql_query("UPDATE ".IQQOL_SQLTABLE."config
 SET webname='{$_POST['webname']}' 
 WHERE id = '1'");
        $edit.=mysql_query("UPDATE ".IQQOL_SQLTABLE."config
 SET status='{$_POST['status']}' 
 WHERE id = '1'");
        $edit.=mysql_query("UPDATE ".IQQOL_SQLTABLE."config
 SET webnum='{$_POST['webnum']}' 
 WHERE id = '1'");
        $edit.=mysql_query("UPDATE ".IQQOL_SQLTABLE."config
 SET pcwapid='{$_POST['pcwapid']}' 
 WHERE id = '1'");
        $edit.=mysql_query("UPDATE ".IQQOL_SQLTABLE."admincp_power
 SET power='{$_POST['proxyip']}' 
 WHERE name = 'proxyip'");
        if(strlen($_POST['url'])<10){
            $url='00000000000';
        }else{
            $url=$_POST['url'];
        }
        if(strlen($_POST['dlappid'])<10){
            $dlappid='11111111111';
        }else{
            $dlappid=$_POST['dlappid'];
        }
        if(strlen($_POST['dlapikey'])<10){
            $dlapikey='2222222222';
        }else{
            $dlapikey=$_POST['dlapikey'];
        }
        if($_POST['dlapikey']==$_POST['dlappid']){
            die('Error!');
        }elseif($_POST['dlapikey']==$_POST['url']){
            die('Error!');
        }elseif($_POST['dlappid']==$_POST['url']){
            die('Error!');
        }
    $fp=fopen(IQQOL_FILE_ROOT.'/config.inc.php','r+');
    $field=fread($fp,filesize(IQQOL_FILE_ROOT.'/config.inc.php'));
    fclose($fp);
    $field=str_replace(IQQOL_ROOT,$url,$field);
    $field=str_replace(DL_APPID,$dlappid,$field);
    $field=str_replace(DL_APIKEY,$dlapikey,$field);
    $fp=fopen(IQQOL_FILE_ROOT.'/config.inc.php','w+');
    $fw=fwrite($fp,$field);
    if($fw){
        fclose($fp);
        $tem_url_return=$_SERVER["PHP_SELF"].'?action=setting&operation=basic';
        $state='修改成功';
        $style->display('admin/status.html');
        exit();
    }else{
        $fw=fwrite($fp,$f2);
        fclose($fp);
        $tem_url_return=$_SERVER["PHP_SELF"].'?action=setting&operation=basic';
        $state='修改失败';
        $style->display('admin/status.html');
        exit();
    }
    }
    if(IN_IQQOL){
        $style->display('admin/setting/basic.html');
    }
}