Example #1
0
            if (ord(substr($string, $i, 1)) > 129) {
                $i++;
            }
        }
        if (strlen($tmpstr) < $strlen) {
            $tmpstr .= "...";
        }
        return $tmpstr;
    }
}
$dbhost = '119.254.229.23';
$dbuser = '******';
$dbpass = '******';
$dbname = 'osscms';
$dbport = 3306;
$dbinst = new MySQLDatabase();
$dbinst->dbconnect($dbhost, $dbuser, $dbpass, $dbname);
$dbinst->query("SET NAMES utf8");
$divstr = "<html><html xmlns=\"http://www.w3.org/1999/xhtml\"><head>  \n<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n<title></title>\n<link href=\"http://soft.csip.org.cn/css/style.css\" rel=\"stylesheet\" type=\"text/css\" >\n<link href=\"http://soft.csip.org.cn/css/layout.css\" rel=\"stylesheet\"  type=\"text/css\" >\n<style type=\"text/css\" >\nbody {\n\tcolor:#333333;\n\tfont-family:\"宋体\" arial;\n\tfont-size:12px;\n\tfont-size-adjust:none;\n\tfont-style:normal;\n\tfont-variant:normal;\n\tfont-weight:normal;\n}\n\n.m03_a_bt a {\n\twidth:280px;\n\tline-height:24px;\n\tfont-size: 12px;\n}\n.nd {font-size:12px;}\n.m03_a_bt a:link, .m03_a_bt a:visited { font-size:12px; color: #333333; text-decoration: none;}\n.m03_a_bt a:hover { font-size:12px; color:#f00;\t}\n\n</style>\n</head>\n<body>";
$divstr .= "<div> <table class=\"m03_a_bt\" width=\"290\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
$strSQL = sprintf("SELECT itemid, subject FROM oss_spaceitems WHERE folder=1 ORDER BY lastpost DESC limit 0, 7");
$result = $dbinst->query($strSQL);
while ($myrow = $dbinst->fetchArray($result)) {
    $news_url = "http://oss.org.cn/?action-viewnews-itemid-" . $myrow['itemid'];
    $news_subject = cutText($myrow['subject'], 0, 30, 'UTF-8') . "...";
    $divstr .= "<tr><td width=\"290\" ><a href=\"{$news_url}\" target=\"_blank\" >{$news_subject}</a></td></tr>";
}
$dbinst->freeRecordSet($result);
$divstr .= "</table></div></body></html>";
echo $divstr;
exit;