<?php
if(IN_IQQOL){
if($_COOKIE['iQQol_Administrator']!=IQQOL_SPPASS)
{
    $style->assign("state",'COOKIE失效');
    $style->display('admin/index.html');exit();
}
    $robot_search=mysql_query("SELECT * FROM ".$table."service_group",$con);
        if($_GET['act']=='delete'){
            $info=mysql_fetch_array($robot_search);
            $i=mysql_query("DELETE FROM {$table}service_group
WHERE qq='{$_GET['qq']}'",$con);echo mysql_error();
            if($i){
                $tem_url_return='admin.php?action=setting&operation=robot';
                $state=$_GET['qq'].' 删除成功';
                $style->display('admin/status.html');
                }
            else{
                $tem_url_return='admin.php?action=setting&operation=robot';
                $state=$_GET['qq'].' 删除失败';
                $style->display('admin/status.html');
            }
        }

        if($_GET['act']=='insert'){
            $info=mysql_fetch_array($robot_search);
            if($_GET['edit']=='yes'){
                $i=mysql_query("INSERT INTO {$table}service_group (`qq`,`password`) VALUES ('{$_POST['qq']}','".md5($_POST['password'])."')",$con);echo mysql_error();
                if($i){
                    $tem_url_return='admin.php?action=setting&operation=robot';
                    $state=$_POST['qq'].' 添加成功';
                    $style->display('admin/status.html');
                    }
                else{
                    $tem_url_return='admin.php?action=setting&operation=robot';
                    $state=$_POST['qq'].' 修改失败,请检查链接是否已经存在！';
                    $style->display('admin/status.html');
                }
            }
            else{
                $style->display('admin/setting/robotinsert.html');
            }
        }

        if($_GET['act']=='edit'){
            $info=mysql_fetch_array($robot_search);
            $i=mysql_query("SELECT * FROM {$table}service_group
WHERE qq='{$_GET['qq']}'",$con);echo mysql_error();
            if($_GET['edit']=='yes'){
                $i=mysql_query("UPDATE ".IQQOL_SQLTABLE."service_group
 SET `qq`='{$_POST['qq']}' 
 WHERE qq='{$_GET['qq']}'",$con);
                $i.=mysql_query("UPDATE ".IQQOL_SQLTABLE."service_group
 SET `password`='".md5($_POST['password'])."' 
 WHERE qq='{$_GET['qq']}'",$con);
                echo mysql_error();
                if($i){
                    $tem_url_return='admin.php?action=setting&operation=robot';
                    $state=$_POST['qq'].' 修改成功';
                    $style->display('admin/status.html');
                    }
                else{
                    $tem_url_return='admin.php?action=setting&operation=robot';
                    $state=$_POST['qq'].' 修改失败';
                    $style->display('admin/status.html');
                }
            }
            else{
                $style->display('admin/setting/robotedit.html');
            }
        }
        if(!isset($_GET['act'])){
                $style->display('admin/setting/robotlist.html');
            }
}
?>