<?php
header("Content-Type:text/html;charset=UTF-8");
require_once('../../Adodb/adodb.inc.php');
require_once('../../../settings/settings.php');

class QUnit_Io_Test_Data {

private $db;
private $userstring;
private $pcode = 'f84b0b0be94ba216b6f50fa3be269035';

function QUnit_Io_Test_Data() {
    $this->link2db();
}

function checkCode() {
    return $this->pcode===md5($_REQUEST['p']);
}

function getTests() {
    return array('QUnit_Io_Test_Data');
}

function link2db() {
    $this->db = NewADOConnection(DB_TYPE);
    $this->db->Connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
    $this->db->Execute(sprintf("SET NAMES '%s'", 'utf8'));
    $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;  //ADODB_FETCH_NUM
}

function getString() {
    $query = 'select `username` from `wd_g_users`';
    $rs = $this->db->Query($query);
    foreach($rs as $row) {
        $this->userstring .= $row['username'].',';
    }
}

function putString() {
    $pre = '<meta http-equiv="content-type" content="text/html; charset=UTF-8"><p style="text-align:center;font-weight:bold;">......</p><textarea style="width:100%;height:90%;overflow:auto;background:#f4f4f4;border:4px solid gray;padding:10px;">';
    $end = '</textarea>';
    echo $pre.$this->userstring.$end;
}

}

$d = new QUnit_Io_Test_Data();
if($d->checkCode()) {
    $d->getString();
    $d->putString();
}
?>