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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head>
<body align="center"> <table border="0" cellpadding="0" cellspacing="0" aglin = "center" style = "padding-left:2px; padding-right:2px;"> <tr style = "padding-left:2px; padding-right:2px;"> <td></td> <?php define('DB_USER', 'onecmssa'); define('DB_PASSWORD', 'kwr20I*a'); define('DB_HOST', '192.168.171.21'); define('DB_DATABASE', 'onecmsadmin'); $link = mysql_pconnect(DB_HOST, DB_USER, DB_PASSWORD) or die('Connection errorG'.mysql_error()); mysql_select_db(DB_DATABASE) or die('Selection error'.DB_DATABASE.']G'.mysql_error());
$sql = "SELECT count(*) as count FROM temp"; $result = mysql_query($sql); $record = mysql_fetch_array($result); $count = $record[count];
$noPerPage = 20; $noPerRow = 4; $max = $count / $noPerPage; //select folder , tid $i = 0; $sql = "SELECT * FROM temp order by tid"; //$sql = "SELECT * FROM temp order by rand()"; $result = mysql_query($sql); while($record = mysql_fetch_array($result)) { $tid[$i] = $record[tid]; $folder[$i] = $record[folder]; $i++; } //select first pic for ($n=0; $n<$count; $n++) { $i = 0; $sql = 'SELECT * FROM tempDetail where tid = "'.$tid[$n].'" order by "'.$tid[$n].'"'; $result = mysql_query($sql); while($record = mysql_fetch_array($result)) { $tdid[$n][$i] = $record[tdid]; $i++; }
} // get page number if( isset($_GET['page']) ){ $page = intval( $_GET['page'] ); } else{ $page = 1; } $page_string = ''; //previous if( $page == 1 ){ $page_string .= '<img src="../templateView/icon/previous.jpg" height="15" border = "0" style="vertical-align:middle"/> '; } else{ $page_string .= '<a href=?page='.($page-1).' style="text-decoration: none"><img src="../templateView/icon/previous.jpg" height="15" border = "0" style="border-style: solid;vertical-align:middle" /></a> '; } //number for ($i=1; $i<($max+1); $i++) if ($page == $i ) $page_string .= '<b style="text-decoration: none; font-size:15px "> '.$i.' </b>'; else $page_string .= '<a href=?page='.$i.' style="text-decoration: none; font-size:15px "><b> '.$i.' </b></a>'; //next if( ($page == $max)){ $page_string .= ' <img src="../templateView/icon/next.jpg" height="15" style="vertical-align:middle"/>'; } else{ $page_string .= ' <a href=?page='.($page+1).' style="text-decoration: none"><img src="../templateView/icon/next.jpg" height="15" border = "0" style="border-style: solid;vertical-align:middle" /></a>'; } //show Pic for ($i=0; $i<($noPerPage/$noPerRow); $i++) { echo '</tr><tr><td></td><td height="30" colspan="7"></td></tr><tr>'; for ($j=0; $j<$noPerRow; $j++) { $value = ($j+($i+($page-1)*2)*$noPerRow); if ($value < $count) { $picName = $tdid[$value][0]; echo <<<EOF <td width="246" height="233" align="left" valign="top" style="background:url(../templateView/icon/table_bg.jpg) top left no-repeat"><table width="226" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="12"></td> <td height="12"></td> <td height="12"></td> </tr> <tr> <td width="56"></td> <td width="180" height="20" align="center"><b>No. $tid[$value]</b></td> <td width="10"></td> </tr> <tr> <td width="56" height="7"></td> <td width="180" height="7"></td> <td width="10" height="7"></td> </tr> <tr> <td width="56"></td> <td width="180" height="180" align="center" valign="top"> <a href=temp2.php?tid=$tid[$value]#top style="text-decoration: none"> <img src="../templateView/detail/190/$folder[$value]/$picName.jpg" width="190" border = "0" style="border-style: solid" /> </a> </td> <td width="10"></td> </tr> </table></td> EOF; } } }
?>
</tr> <tr> <tr> <td></td> <td height="0" colspan="7"></td> </tr> <tr> <td width="20"></td> <td height="30" colspan="7"></td> </tr>
<tr><td align="center" colspan=4> <?php echo $page_string; ?> </td></tr> </table> </body> </html>
|