Example #1
0
    include PrintEot('ystats');
    exit;
} elseif ($action == 'bind') {
    $basename .= '&action=bind';
    $db_ystats_ymail && adminmsg('ystat_ymail_error');
    if ($_POST['step'] != 2) {
        include PrintEot('ystats');
        exit;
    } else {
        S::gp(array('ymail'), 'P');
        if (!$ymail || !preg_match('/^[a-zA-Z][a-zA-Z0-9_]{3,31}\\@(yahoo\\.com\\.cn|yahoo\\.cn)$/', $ymail)) {
            adminmsg('ystat_ymail_format');
        }
        L::loadClass('xml', 'utility', false);
        $xml = new XML();
        $xml->setEncode('UTF-8');
        $response = PostHost($ystatsUrl . '/reg.html?type=3&key=' . $db_ystats_key . '&unit_id=' . $db_ystats_unit_id . '&ymail=' . $ymail);
        $response && ($response = chunkdecode($response));
        $xml->setXMLData($response);
        if (!$xml->isXMLFile()) {
            adminmsg('ystat_xmldata_error');
        }
        $xml->parse();
        $ystats = array();
        $result = XML::getChild($xml->getXMLRoot());
        foreach ($result as $tag) {
            $tagname = XML::getTagName($tag);
            $ystats[$tagname] = XML::getData($tag);
        }
        if ($ystats['status'] != '0') {
            adminmsg($ystats['info']);