<?
Require "config. php ";
Dl ("extensions/php_mssql70.dll ");
If (! Isset ($ page) {$ page = 1 ;}
If ($ page <= 0) {$ page = 1 ;}
$ Db = mssql_connect ($ local, $ user, $ pass );
Mssql_select_db ($ name, $ db );
$ Query = mssql_query ("select count (*) as date from news", $ db );
$ Query = mssql_fetch_array ($ query );
$ Pages = ceil ($ query [0]/$ userperpage );
If ($ page >$ pages) {$ page = $ pages ;}
If ($ query [0] <$ userperpage) {$ userperpage = $ query [0];}
$ Dangqian = ($ page-1) * $ userperpage;
Echo "<title> News </title> ";
Echo "<style type = text/css> \ n ";
Echo "<! -- \ N ";
Echo "A {text-decoration: none} \ n ";
Echo "A: hover {color: blue; text-decoration: underline} \ n ";
Echo "td {font-size: 9pt} \ n ";
Echo "--> </style> \ n ";
Echo "<div align = center> <center> \ n ";
Echo "<table border = 0 width = 100% cellspacing = 0 cellpadding = 0 height = 19 \ n ";
Echo "<tr> ";
Echo "<td width = 52% colspan = 5> </td> </tr> \ n ";
Echo "<tr> ";
Echo "<td width = 52% height = 19 valign = bottom bgcolor = # B5C6B0> <p align = center> <font \ n ";
Echo "color = #408080> News Title </font> </td> \ n ";
Echo "<td width = 14% height = 19 valign = bottom align = center bgcolor = # B5C6B0> <font \ n ";
Echo "color = #408080> publication date </font> </td> \ n ";
Echo "<td width = 19% height = 19 valign = bottom align = center bgcolor = # B5C6B0> <font \ n ";
Echo "color = #408080> posting Department </font> </td> \ n ";
Echo "<td width = 7% height = 19 valign = bottom align = center bgcolor = # B5C6B0> <font \ n ";
Echo "color = #408080> Read </font> </td> \ n ";
Echo "<td width = 8% height = 19 valign = bottom align = center bgcolor = # B5C6B0> <font \ n ";
Echo "color = #408080> image </font> </td> \ n ";
Echo "</tr> \ n ";
Echo "</table> \ n ";
Echo "</center> </div> \ n ";
Echo "<div align = center> <center> \ n ";
Echo "<table border = 0 width = 100% cellspacing = 0 cellpadding = 0 height = 19> \ n ";
$ Db = mssql_connect ($ local, $ user, $ pass );
Mssql_select_db ($ name, $ db );
$ Query = mssql_query ("select * from news order by date desc", $ db );
$ Roro = mssql_num_rows ($ query );
If ($ roro = 0 ){
Echo "<br> <p align = \" center \ "> <font color = \" # FF0000 \ "size = \" 2 \ "> <marquee behavior = \ "alternate \" border = \ "0 \" width = \ "300 \" height = \ "16 \" scrolldelay = \ "70 \"> no record exists in the database currently! </Marquee> </font> </p> ";
Exit;
}
Mssql_data_seek ($ query, $ dangqian );
$ I = 0;
While ($ arr = mssql_fetch_array ($ query )){
If ($ I >=$ userperpage) {break ;}
Echo "<tr> \ n ";
Echo "<td width = 52% bgcolor = # F3F3F3 height = 19 valign = bottom> <p align = left> <a href = \" readnews. php? Id = $ arr [date] \ "target = \" _ blank \ "> <font color = #3D5449> $ arr [title] </font> </a> </ td> \ n ";
$ Datee = date ("Y-m-d", $ arr [date]);
Echo "<td width = 14% bgcolor = # F3F3F3 height = 19 valign = bottom align = center> <font color = #3D5449> $ datee </font> </td> \ n ";
Echo "<td width = 19% bgcolor = # F3F3F3 height = 19 valign = bottom align = center> <font color = #3D5449> $ arr [type] </font> </td> \ n ";
Echo "<td width = 7% bgcolor = # F3F3F3 height = 19 valign = bottom align = center> <font color = #808080> $ arr [click] </font> </td> \ n ";
Echo "<td width = 8% bgcolor = # F3F3F3 height = 19 valign = bottom align = center> \ n ";
$ Arr [photo] = trim ($ arr [photo]);
If ($ arr [photo] <> "") | (file_exists ($ arr [photo]) {
Echo " ";
}
Else {echo "";}
Echo "</td> \ n ";
Echo "</tr> \ n ";
$ I ++;
} // While
Echo "<tr> \ n ";
Echo "<td width = 100% height = 20 colspan = 5> </td> \ n ";
Echo "</tr> \ n ";
Echo "<tr> <td width = 100% colspan = 5> <center> \ n ";
If ($ page <> 1 ){
Echo "<a href = $ PHP_SELF? Page = 1> <font color = #408080> homepage </font> </a> \ n ";
}
If ($ page> 1 ){
$ Upage = $ page-1;
Echo "<a href = $ PHP_SELF? Page = $ upage> <font color = red> previous page </font> </a> \ n ";
}
For ($ y = 1; $ y <= $ pages; $ y ++ ){
Echo "<a href = $ PHP_SELF? Page = $ y> $ y </a> \ n ";
}
If ($ page <$ pages ){
$ Npage = $ page + 1;
Echo "<a href = $ PHP_SELF? Page = $ npage> <font color = red> next page </font> </a> \ n ";
}
If ($ page <> $ pages ){
Echo "<a href = $ PHP_SELF? Page = $ pages> <font color = #408080> last page </font> </a> \ n ";
}
Echo "</center> </td> \ n ";
Echo "</tr> \ n ";
Echo "</table> \ n ";
Echo "</center> </div> \ n ";
?>