1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

读取NFO信息的php代码。

本帖由 小叶 于 2006-02-16 发布。版面名称:后端开发

  1. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    PHP:
    <?php
    $nfo 
    =$_GET['nfo'];
    $nfodata = file_get_contents($nfo.".nfo");
    require_once(
    "nfo2html.php");
    $nfodata = nfo2html($nfodata);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <title>nfo file</title>
        <style type="text/css">
            @font-face {
                font-family: nfo;
                font-style:  normal;
                font-weight: normal;
                src: url(/nfo.eot);
            }
            .nfo {
                padding: 12px;
                font-family: nfo, courier new;
                font-size: 11px;
                line-height: 1em;
            }
        </style>
    </head>
    <body>
        <pre class="nfo"><?=str_replace("\r", "", $nfodata)?></pre>
        <div class="nfo" style="background-color: #000; color: #fff"><?=str_replace("\n", "<br />", str_replace(" ", "&nbsp;", $nfodata))?></div>
    </body>
    </html>
     
  2. Henry

    Henry New Member

    注册:
    2005-09-04
    帖子:
    1,166
    赞:
    4
    where is nfo2html.php ?
     
  3. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    少了个文件。。抱歉。。
     
  4. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    nfo2html.php

    PHP:
    <?php
    /**
    * NFO TO HTML
    *
    * Special thanks to ibic@9down
    * @author: andot([email protected]) & legend([email protected])
    * @link: http://www.ugia.cn/?p=55, http://www.ugia.cn/?p=49
    * @description: convert .nfo file to html
    * @version: 2.0
    */
    /* Copyright 2005 andot & legend (email : [email protected] & [email protected])
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    */
    $conv_table = array(
    /* 0*/ 0x0000, 0x263a, 0x263b, 0x2665, 0x2666,
    /* 5*/ 0x2663, 0x2660, 0x2022, 0x25d8, 0x0000,
    /* 10*/ 0x0000, 0x2642, 0x2640, 0x0000, 0x266b,
    /* 15*/ 0x263c, 0x25ba, 0x25c4, 0x2195, 0x203c,
    /* 20*/ 0x00b6, 0x00a7, 0x25ac, 0x21a8, 0x2191,
    /* 25*/ 0x2193, 0x2192, 0x2190, 0x221f, 0x2194,
    /* 30*/ 0x25b2, 0x25bc, 0x0000, 0x0000, 0x0022,
    /* 35*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0027,
    /* 40*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 45*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 50*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 55*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 60*/ 0x003c, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 65*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 70*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 75*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 80*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 85*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 90*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /* 95*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /*100*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /*105*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /*110*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /*115*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /*120*/ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
    /*125*/ 0x0000, 0x0000, 0x2302, 0x00c7, 0x00fc,
    /*130*/ 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5,
    /*135*/ 0x00e7, 0x00ea, 0x00eb, 0x00e8, 0x00ef,
    /*140*/ 0x00ee, 0x00ec, 0x00c4, 0x00c5, 0x00c9,
    /*145*/ 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2,
    /*150*/ 0x00fb, 0x00f9, 0x00ff, 0x00d6, 0x00dc,
    /*155*/ 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192,
    /*160*/ 0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1,
    /*165*/ 0x00d1, 0x00aa, 0x00ba, 0x00bf, 0x2310,
    /*170*/ 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab,
    /*175*/ 0x00bb, 0x2591, 0x2592, 0x2593, 0x2502,
    /*180*/ 0x2524, 0x2561, 0x2562, 0x2556, 0x2555,
    /*185*/ 0x2563, 0x2551, 0x2557, 0x255d, 0x255c,
    /*190*/ 0x255b, 0x2510, 0x2514, 0x2534, 0x252c,
    /*195*/ 0x251c, 0x2500, 0x253c, 0x255e, 0x255f,
    /*200*/ 0x255a, 0x2554, 0x2569, 0x2566, 0x2560,
    /*205*/ 0x2550, 0x256c, 0x2567, 0x2568, 0x2564,
    /*210*/ 0x2565, 0x2559, 0x2558, 0x2552, 0x2553,
    /*215*/ 0x256b, 0x256a, 0x2518, 0x250c, 0x2588,
    /*220*/ 0x2584, 0x258c, 0x2590, 0x2580, 0x03b1,
    /*225*/ 0x03b2, 0x0393, 0x03c0, 0x03a3, 0x03c3,
    /*230*/ 0x03bc, 0x03c4, 0x03a6, 0x03b8, 0x2126,
    /*235*/ 0x03b4, 0x221e, 0x00f8, 0x03b5, 0x2229,
    /*240*/ 0x2261, 0x00b1, 0x2265, 0x2264, 0x2320,
    /*245*/ 0x2321, 0x00f7, 0x2248, 0x00b0, 0x00b7,
    /*250*/ 0x02d9, 0x221a, 0x207f, 0x00b2, 0x25a0,
    /*255*/ 0x00a0
    );
    /*
    function nfo2html($str) {
    global $conv_table;
    for ($i = 0; $i < strlen($str); $i ++) {
    $asc = ord($str[$i]);
    $output .= ($conv_table[$asc]) ? "&#".$conv_table[$asc].";" : $str[$i];
    }
    return $output;
    }
    */
    function nfo2html($str) {
    global 
    $conv_table;
    $str = str_replace("&", "&", $str);
    for (
    $i = 0; $i < 256; $i++) {
    if (
    $conv_table[$i] != 0) {
    $str = str_replace(chr($i), "&#".$conv_table[$i].";", $str);
    }
    }
    return 
    $str;
    }
    ?>
     
  5. greatqsh

    greatqsh New Member

    注册:
    2005-09-16
    帖子:
    142
    赞:
    1
    有错误!!!:mummy:
     
  6. wm_chief

    wm_chief New Member

    注册:
    2005-09-05
    帖子:
    17,890
    赞:
    46
    哦,有啥用