/source code/admin_phim/quanlyphim.php
PHP | 151 lines | 149 code | 2 blank | 0 comment | 8 complexity | a900e124315c139028c2ebd400546667 MD5 | raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Qu?n lý phim</title>
- <style type="text/css">
- p#tieude{ color:#0000FF; font-size:28px;}
- td{ color:#CC00CC; font-size:18px; font-style:oblique;}
- table{ background:#CCFF99;}
- </style>
- </head>
-
- <body>
- <p align="center" id="tieude"><b><u>Danh Sách Phim</u></b> <br></p>
- <p align="center"> <a href="themphim.php">Thęm M?i</a> <a href="admin.php">Trang Admin </a></p>
- <table width="800" border="1" align="center" cellpadding="0" cellspacing="0">
- <tr bgcolor="#FFFFCC">
- <td width="25"><div align="center" class="style1">STT</div></td>
- <td width="50"><div align="center" class="style1">Mă Phim </div></td>
- <td width="175"><div align="center" class="style1">Tęn ??a Phim </div></td>
- <td width="150"><div align="center" class="style1">Th? Lo?i Phim </div></td>
- <td width="150"><div align="center" class="style1">Di?n Vięn Chính </div></td>
- <td width="100"><div align="center" class="style1">N??c S?n Xu?t </div></td>
- <td width="50"><div align="center" class="style1">S? T?p </div></td>
- <td width="100"><div align="center" class="style1">Hěnh ?nh</div></td>
- <td width="50"><div align="center" class="style1">S?a</div></td>
- <td width="50"><div align="center" class="style1">Xóa</div></td>
- </tr>
- <?php
- require_once("..\ketnoi.php");
- $sodong=5;
- $sonhom=3;
- if(!isset($_GET["tst"]))
- {
- $kq=mysql_query("select * from phim", $link);
- $tongsotrang=ceil(mysql_num_rows($kq)/$sodong);
- $tongsonhom=ceil($tongsotrang/$sonhom);
- }
- else
- {
- $tongsotrang=intval($_GET["tst"]);
- $tongsonhom=ceil($tongsotrang/$sonhom);
- }
- if(!isset($_GET["p"]))
- {
- if(!isset($_GET["n"]))
- {
- $p=1;$n=1;
- }
- else
- {
- $n=intval($_GET["n"]);
- $p=$n*$sonhom - $sonhom + 1;
- }
- }
- else
- {
- $p=intval($_GET["p"]);
- $n=ceil($p/$sonhom);
- }
- $x=($p-1)*$sodong;
- $s="select * from phim limit ".$x.",".$sodong;
- $k=mysql_query($s,$link);
- $b=0;
- while($dong=mysql_fetch_array($k))
- {
- $b++;
- ?>
- <tr>
- <td align="center"><?php echo $b;?></td>
- <td align="center"><?php echo $dong["maphim"];?></td>
- <td align="center"><?php echo $dong["tenphim"];?></td>
- <td align="center">
- <?php
- $h=mysql_query("select tentheloaiphim from theloaiphim where matheloaiphim='".$dong["matheloaiphim"]."' ",$link);
- while($d=mysql_fetch_array($h))
- {
- echo $d["tentheloaiphim"];
- }
- ?>
- </td>
- <td align="center">
- <?php
- $h1=mysql_query("select tendvphim from dienvienphim where madvphim='".$dong["madvphim"]."' ",$link);
- while($d1=mysql_fetch_array($h1))
- {
- echo $d1["tendvphim"];
- }
- ?>
- </td>
- <td align="center">
- <?php
- $h2=mysql_query("select tennuocsx from nuocsanxuat where manuocsx='".$dong["manuocsx"]."' ",$link);
- while($d2=mysql_fetch_array($h2))
- {
- echo $d2["tennuocsx"];
- }
- ?>
- </td>
- <td align="center">
- <?php
- echo $dong["sotap"];
- ?>
- </td>
- <td width="100"><div align="center"><img src="../anhphim/<?php echo $dong["hinhphim"]; ?>" width="100" height="75"></div></td>
- <td width="50"><div align="center"><a href="suaphim.php?idphim=<?php echo $dong["maphim"]; ?>">S?a</a></div></td>
- <td width="50"><div align="center"><a href="xoaphim.php?idphim=<?php echo $dong["maphim"]; ?>">Xóa</a></div></td>
- </tr>
- <?php
- }
-
- ?>
- </table>
- <p align="center"><font color="#CC0000" size="+1">Trang </font>
- <?php if ($n>1)
- {
- $n1=$n - 1;
- ?>
- <a href="quanlyphim.php?n=<?php echo $n1;?>&tst=<?php echo $tongsotrang;?>"> Back </a>
- <?php } ?>
- <?php
- $dau=($n-1)*$sonhom +1;
- if ($n<=$tongsonhom)
- {
- $cuoi=$dau + $sonhom -1;
- }
- else
- {
- $cuoi=$tongsonhom;
- }
- for($i=$dau; $i<=$cuoi; $i++)
- {
- if ($i==$p)
- {
- echo $i." ";
- }
- else
- {
- ?>
- <a href="quanlyphim.php?p=<?php echo $i;?>&tst=<?php echo $tongsotrang;?>"><?php echo $i." ";?></a>
- <?php } }
- ?>
- <?php if ($n<=$tongsonhom)
- {
- $n2=$n+1;
- ?>
- <a href="quanlyphim.php?n=<?php echo $n2;?>&tst=<?php echo $tongsotrang;?>"> Next </a>
- <?php } ?>
- </p>
- </body>
- </html>