001.
<?php
002.
session_start();
003.
include
(
"connect/connect.inc"
);
004.
005.
006.
$perpages
= 2;
007.
008.
009.
$gpages
=
$_GET
[
"pages"
];
010.
011.
012.
if
(
empty
(
$gpages
) ||
$gpages
== 1)
013.
{
014.
015.
$gpages
= 1;
016.
017.
018.
$numpiece
=
$gpages
- 1;
019.
}
020.
else
021.
022.
$numpiece
= (
$gpages
- 1) *
$perpages
;
023.
024.
025.
026.
$table
= mysql_query(
"SELECT * FROM insight"
)
or
die
(
"ไม่สามารถเรียกดูข้อมูลทั้งหมดได้"
. mysql_error());
027.
028.
029.
$countrecord
= mysql_num_rows(
$table
);
030.
031.
$divide
=
$countrecord
/
$perpages
;
032.
033.
$mod
=
$countrecord
%
$perpages
;
034.
035.
$numberno
= ((
floor
(
$divide
) - (
$gpages
- 1)) *
$perpages
) +
$mod
;
036.
037.
038.
if
(
$mod
!= 0)
039.
$mod
= 1;
040.
041.
for
(
$loop
=1;
$loop
<=
$divide
+
$mod
;
$loop
++)
042.
{
043.
044.
if
(
$gpages
==
$loop
)
045.
046.
$listpages
.=
"["
.
$loop
.
"] "
;
047.
else
048.
049.
$listpages
.=
"<a href=\"insight.php?pages="
.
$loop
.
"\" target=\"_parent\">"
.
$loop
.
"</a> "
;
050.
}
051.
052.
053.
054.
?>
055.
058.
<head>
059.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
060.
<title></title>
061.
<meta name=
"title"
content=
""
/>
062.
<link rel=
"stylesheet"
type=
"text/css"
href=
"style.css"
/>
063.
<script type=
"text/javascript"
language=
"JavaScript1.2"
src=
"popup.js"
></script>
064.
</head>
065.
066.
<body>
067.
068.
<div id=
"container"
>
069.
070.
<div id=
"head"
>
071.
<div id=
"header-left"
style=
"font-size:24px; font-family:Arial, Helvetica, sans-serif; color: #e46c0a; line-height: 80px; font-weight: bold;"
>
072.
<div style=
" float: left;"
>
073.
074.
<span>Insights
and
Publications</span>
075.
</div>
076.
</div>
077.
078.
<div id=
"header-right"
style=
"text-align: right;"
>
079.
<img src=
"images/logo.png"
width=
"190"
height=
"65"
alt=
""
/>
080.
</div>
081.
<span style=
"padding-top: 15px; "
><img src=
"images/line.png"
width=
"1000"
height=
"3"
alt=
""
/></span>
082.
</div>
083.
084.
085.
086.
<br
class
=
"clearboth"
/>
087.
088.
<div id=
"bodymain"
>
089.
<div id=
"body-left"
style=
"font-size: 16px;"
>
090.
<div style=
" float: left;"
>
091.
092.
<span style=
"font-size: 18px;"
>Search
for
Publications</span>
093.
094.
</div>
095.
096.
<div style=
"padding-top: 30px; font-size: 16px;"
>
097.
<table width=
"500"
border=
"0"
align=
"center"
cellspacing=
"1"
>
098.
<tr>
099.
<?
100.
if
(!
empty
(
$_SESSION
[
"sessfirstname"
]))
101.
{
102.
?>
103.
<td colspan=
"6"
> <div align=
"center"
>| <a href=
"javascript:popup_update('addinsight.php')"
>Add New!</a> |<br />
104.
105.
106.
<br /></div>
107.
</td>
108.
<?
109.
}
110.
?>
111.
</tr>
112.
</table>
113.
<?php
114.
115.
$tbfiles
= mysql_query(
"SELECT * FROM insight ORDER BY inid DESC LIMIT $numpiece, $perpages "
)
or
die
(
"ไม่สามารถเรียกดูข้อมูลได้"
. mysql_error());
116.
echo
"<table border=\"0\" width=\"400px;\" cellspacing=\"1\" cellpadding=\"1\"><tr>"
;
117.
$intRows
= 0;
118.
while
(
$rwfiles
= mysql_fetch_array(
$tbfiles
))
119.
{
120.
121.
$intRows
++;
122.
$fdfilesid
=
$rwfiles
[
"inid"
];
123.
$fdname
=
$rwfiles
[
"incat"
];
124.
$fddatebook
=
$rwfiles
[
"indate"
];
125.
$fdtitle
=
$rwfiles
[
"intitle"
];
126.
$fdlink
=
$rwfiles
[
"inlink"
];
127.
$fddescription
=
$rwfiles
[
"indetail"
];
128.
$fdfilesname
=
$rwfiles
[
"filesname"
];
129.
130.
echo
"<td>"
;
131.
132.
?>
133.
<table border=
"0"
width=
"650px;"
cellspacing=
"1"
cellpadding=
"1"
align=
"top"
>
134.
135.
<tr>
136.
<td width=
"60"
rowspan=
"4"
><?php
echo
"<a href=\"$fdlink\" target=\"_blank\"><img src=\"insight/$fdfilesname\" width=\"60px;\" height=\"90px;\" border=\"1\" align=\"top\"
></a></td>
137.
138.
<td width=\
"361\"
></td></tr>
139.
<tr><td > </td></tr>
140.
<tr><td ></td></tr>
141.
<tr><td><span style=\
" font-weight: bold; \">$fdname </span> <br /><span>$fddatebook</span> <br /><span class=\"insighttext\" style=\" font-weight: bold; font-style: italic;\"><a href=\"$fdlink\" target=\"_blank\"
>
$fdtitle
</a></span></td></tr>
142.
<tr><td></td>
143.
<td><span style=\
"margin: 0px; padding: 0px;\">$fddescription</span></td></tr><br /><br />"
;
144.
145.
146.
if
(
$_SESSION
[
"sessfirstname"
] ==
"admin"
)
147.
{
148.
echo
"<td align=center width=\"50px;\"
><a href=javascript:popup_update(
'editinsight.php?id=$fdfilesid'
)>แก้ไข</a></td>
149.
<td align=center width=\
"50px;\"><a href=\"deleteinsight.php?id=$fdfilesid\" onclick=\"confirmdelete($fdfilesid, '$fdfilesname');\">ลบ</a></td>"
;
150.
151.
}
152.
echo
"</tr></table>"
;
153.
154.
echo
"</td>"
;
155.
if
((
$intRows
)%1==0)
156.
{
157.
echo
"</tr>"
;
158.
}
159.
else
160.
{
161.
echo
"<td>"
;
162.
}
163.
}
164.
echo
"</tr></table>"
;
165.
?>
166.
167.
<br />
168.
<!-- ตัวเลขให้เลือกหน้า -->
169.
<?php
echo
"<div style=\"text-align: center;\">หน้า "
.
$listpages
.
"</div>"
; ?>
170.
</div>
171.
172.
173.
</div>
174.
175.
<div id=
"body-right1"
>
176.
177.
<?php
178.
require
(
"menu.php"
);
179.
?>
180.
181.
</div>
182.
183.
184.
185.
186.
187.
</div>
188.
</div>
189.
<?php
190.
include
(
"connect/disconnect.inc"
);
191.
?>
192.
193.
194.
</div>
195.
</div>
196.
197.
198.
<br
class
=
"clearboth"
/>
199.
200.
</div>
201.
</div>
202.
</div>
203.
</body>
204.
</html>