<?php
require_once 'include/contain.class.php';
if(isset($_COOKIE['login_auth'])) {
    list($User_uid, $User_username) = explode("\t", uc_authcode($_COOKIE['login_auth'], 'DECODE'));
    if($_GET['mod']=='space'){
        if(isset($_GET['uid']) or $_GET['uid']=''){
            $uid=$_GET['uid'];
            mysql_query("set names 'utf8'",$ucon);
            $uc_search=mysql_query("SELECT * FROM ".UC_DBTABLEPRE."members 
WHERE `uid`='{$uid}'",$ucon);
            $iqqol_search=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."members 
WHERE `uid`='{$uid}'",$con);
            $info=mysql_fetch_array($uc_search,true);
            $qinfo=mysql_fetch_array($iqqol_search,true);
            $count_qq=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."online 
WHERE `user`='{$info[username]}'",$con);
            $num_qq=mysql_num_rows($count_qq);
            $style->display('main/space.html');
        }
    }
    elseif($_GET['mod']=='square'){
        $_admincp_power[allowground] = mysql_fetch_array(mysql_query("SELECT * FROM " . $table . "admincp_power
WHERE name='allowground'"));
        if ($_admincp_power[allowground][power] == 'yes') {
            $style->display('main/square.html');
        }
        else{
            $tem_url_return = $lang[system][url_return][index];
            $state = $lang[system][ground]['noallowground'];
            $style->display('login/status.html');
        }
    }
    elseif($_GET['mod']=='spacesearch'){
        $style->display('main/home_search.html');
    }
    elseif($_GET['mod']=='edit'){
            $uid=$User_uid;
            mysql_query("set names 'utf8'",$ucon);
            $uc_search=mysql_query("SELECT * FROM ".UC_DBTABLEPRE."members 
WHERE `uid`='{$uid}'",$ucon);
            $kf_search=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."service_group",$con);
            $iqqol_search=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."members 
WHERE `uid`='{$uid}'",$con);
            $info=mysql_fetch_array($uc_search,true);
            $qinfo=mysql_fetch_array($iqqol_search,true);
            $count_qq=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."online 
WHERE `user`='{$info[username]}'",$con);
            $num_qq=mysql_num_rows($count_qq);
        if($_GET['edit']=='yes'){
            $i=mysql_query("UPDATE ".IQQOL_SQLTABLE."members
 SET `space_header`='{$_POST['space_header']}' 
 WHERE uid = '$User_uid'");
            $i.=mysql_query("UPDATE ".IQQOL_SQLTABLE."members
 SET `space_note`='{$_POST['space_note']}' 
 WHERE uid = '$User_uid'");
            $i.=mysql_query("UPDATE ".UC_DBTABLEPRE."members
 SET `email`='{$_POST['email']}' 
 WHERE uid = '$User_uid'");
            $i.=mysql_query("UPDATE ".IQQOL_SQLTABLE."members
 SET `noticeqq`='{$_POST['noticeqq']}' 
 WHERE uid = '$User_uid'");
            if($i){
                header('location:home.php?mod=space&uid='.$User_uid);
            }
            else{
                $state=$lang[system][home][saveerror];
                $style->display('main/home_status.html');
            }
        }
        $style->display('main/home_edit.html');
    }
    elseif($_GET['mod']=='message'){
        $appurl=IQQOL_ROOT;
        $uid=$User_uid;
            mysql_query("set names 'utf8'",$ucon);
            $uc_search=mysql_query("SELECT * FROM ".UC_DBTABLEPRE."members 
WHERE `uid`='{$uid}'",$ucon);
            $kf_search=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."service_group",$con);
            $iqqol_search=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."members 
WHERE `uid`='{$uid}'",$con);
            $info=mysql_fetch_array($uc_search,true);
            $qinfo=mysql_fetch_array($iqqol_search,true);
            $count_qq=mysql_query("SELECT * FROM ".IQQOL_SQLTABLE."online 
WHERE `user`='{$info[username]}'",$con);
            $num_qq=mysql_num_rows($count_qq);
        $style->display('main/message.html');
    }
}
else {
    $style->display('login.html');
}
?>