<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: memcp.inc.php 12326 2010-07-05 06:42:42Z monkey $
 */

if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}
if(!$_G['uid']) {
	showmessage('not_loggedin', NULL, array(), array('login' => 1));
}
if($_POST['add'])
{
	DB::insert('qqrobot_qa', array('q' => $_POST['q'], 'a' => $_POST['a']));
}
else if($_POST['edit'])
{
	DB::update('qqrobot_qa', array('q' => $_POST['q'], 'a' => $_POST['a']), 'id='.$_POST['id']);
}
else if($_POST['delete'])
{
	DB::delete('qqrobot_qa', 'id='.$_POST['id']);
}

$sql = "SELECT * FROM ".DB::table('qqrobot_qa')." ORDER BY id DESC";

$query = DB::query($sql);
$list = array();
while($qa = DB::fetch($query))
	$list[] = $qa;
include template('qqrobot:qqrobot_qa');

?>