<?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['operation']=='up'){
            $info = mysql_fetch_array(mysql_query("SELECT * FROM ".$table."members
WHERE `uid`='$User_uid'"));
            $_admincp_power[buyqq] = mysql_fetch_array(mysql_query("SELECT * FROM ".$table."admincp_power
WHERE name='buyqq'"));
            $max =$info[integral]/$_admincp_power[buyqq][power];
        if($_GET[edit]=='yes'){
                if($_POST[num]<$max){
                    $reduce=$_POST[num]*$_admincp_power[buyqq][power];
                    $nn=$info[integral]-$reduce;
                    $gn=$info[largest]+$_POST[num];
                    $i=mysql_query("UPDATE ".IQQOL_SQLTABLE."members
 SET `integral`='".$nn."' 
 WHERE uid = '$User_uid'",$con);
                    $i=mysql_query("UPDATE ".IQQOL_SQLTABLE."members
 SET `largest`='".$gn."' 
 WHERE uid = '$User_uid'",$con);
                    $state = $lang[system][user_buyqq][buyok];
                    $style->display('main/buyqq.html');
                }
                else{
                    $state = $lang[system][user_buyqq][buyfalse];
                    $style->display('main/buyqq.html');
                }
            }
            else{
                $style->display('main/buyqq.html');
            }
    }
}
else {
    $style->display('login.html');
}
?>