1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
<?php session_start() ; ?> <html> <head> <meta charset="UTF-8"> <title>news</title> </head> <body> <center> <?php if(isset($_SESSION['uname'])){ echo "<script>alert('欢迎'); </script>"; } ?> <table> <tr> <th>热度</th> <th>标题</th> <th>作者</th> <th>发表时间</th> <th>操作</th> </tr> <?php $f = fopen('data/news.db','r'); $i = 1 ; while (!feof($f)){ $tmp = fgets($f) ; $date = explode('||',$tmp) ; if (count($date) != 8){ continue; } echo_table($date) ; if($i <= 3){ echo_info($date) ;
} $i++ ; }
?> </table> </body> </center> </html> <?php function echo_info ($data){ $content = substr(base64_decode($data[2]),0,100) ; echo <<<EOF <tr> <td><img scr ="1"></td> <td colspan = "4">{$content}</td> </tr> EOF; }
function echo_table($data){ $hot= $data[5] ; $author = $data[3] ; $add_date = $data[4] ; $title = base64_decode($data[1]); $content = base64_decode($data[3]);
echo<<<EOF <tr> <td>{$hot}</td> <td>{$title}</td> <td>{$author}</td> <td>{$add_date}</td> <td>👍|👎</td> </tr> EOF; } ?>
|
近期评论