PageRenderTime 34ms CodeModel.GetById 4ms RepoModel.GetById 0ms app.codeStats 0ms

/source code/admin_phim/quanlyphim.php

http://quan-li-cua-hang-bang-dia.googlecode.com/
PHP | 151 lines | 149 code | 2 blank | 0 comment | 8 complexity | a900e124315c139028c2ebd400546667 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Qu?n phim</title>
  6. <style type="text/css">
  7. p#tieude{ color:#0000FF; font-size:28px;}
  8. td{ color:#CC00CC; font-size:18px; font-style:oblique;}
  9. table{ background:#CCFF99;}
  10. </style>
  11. </head>
  12. <body>
  13. <p align="center" id="tieude"><b><u>Danh Sách Phim</u></b> <br></p>
  14. <p align="center"> <a href="themphim.php">Thęm M?i</a> <a href="admin.php">Trang Admin </a></p>
  15. <table width="800" border="1" align="center" cellpadding="0" cellspacing="0">
  16. <tr bgcolor="#FFFFCC">
  17. <td width="25"><div align="center" class="style1">STT</div></td>
  18. <td width="50"><div align="center" class="style1"> Phim </div></td>
  19. <td width="175"><div align="center" class="style1">Tęn ??a Phim </div></td>
  20. <td width="150"><div align="center" class="style1">Th? Lo?i Phim </div></td>
  21. <td width="150"><div align="center" class="style1">Di?n Vięn Chính </div></td>
  22. <td width="100"><div align="center" class="style1">N??c S?n Xu?t </div></td>
  23. <td width="50"><div align="center" class="style1">S? T?p </div></td>
  24. <td width="100"><div align="center" class="style1">Hěnh ?nh</div></td>
  25. <td width="50"><div align="center" class="style1">S?a</div></td>
  26. <td width="50"><div align="center" class="style1">Xóa</div></td>
  27. </tr>
  28. <?php
  29. require_once("..\ketnoi.php");
  30. $sodong=5;
  31. $sonhom=3;
  32. if(!isset($_GET["tst"]))
  33. {
  34. $kq=mysql_query("select * from phim", $link);
  35. $tongsotrang=ceil(mysql_num_rows($kq)/$sodong);
  36. $tongsonhom=ceil($tongsotrang/$sonhom);
  37. }
  38. else
  39. {
  40. $tongsotrang=intval($_GET["tst"]);
  41. $tongsonhom=ceil($tongsotrang/$sonhom);
  42. }
  43. if(!isset($_GET["p"]))
  44. {
  45. if(!isset($_GET["n"]))
  46. {
  47. $p=1;$n=1;
  48. }
  49. else
  50. {
  51. $n=intval($_GET["n"]);
  52. $p=$n*$sonhom - $sonhom + 1;
  53. }
  54. }
  55. else
  56. {
  57. $p=intval($_GET["p"]);
  58. $n=ceil($p/$sonhom);
  59. }
  60. $x=($p-1)*$sodong;
  61. $s="select * from phim limit ".$x.",".$sodong;
  62. $k=mysql_query($s,$link);
  63. $b=0;
  64. while($dong=mysql_fetch_array($k))
  65. {
  66. $b++;
  67. ?>
  68. <tr>
  69. <td align="center"><?php echo $b;?></td>
  70. <td align="center"><?php echo $dong["maphim"];?></td>
  71. <td align="center"><?php echo $dong["tenphim"];?></td>
  72. <td align="center">
  73. <?php
  74. $h=mysql_query("select tentheloaiphim from theloaiphim where matheloaiphim='".$dong["matheloaiphim"]."' ",$link);
  75. while($d=mysql_fetch_array($h))
  76. {
  77. echo $d["tentheloaiphim"];
  78. }
  79. ?>
  80. </td>
  81. <td align="center">
  82. <?php
  83. $h1=mysql_query("select tendvphim from dienvienphim where madvphim='".$dong["madvphim"]."' ",$link);
  84. while($d1=mysql_fetch_array($h1))
  85. {
  86. echo $d1["tendvphim"];
  87. }
  88. ?>
  89. </td>
  90. <td align="center">
  91. <?php
  92. $h2=mysql_query("select tennuocsx from nuocsanxuat where manuocsx='".$dong["manuocsx"]."' ",$link);
  93. while($d2=mysql_fetch_array($h2))
  94. {
  95. echo $d2["tennuocsx"];
  96. }
  97. ?>
  98. </td>
  99. <td align="center">
  100. <?php
  101. echo $dong["sotap"];
  102. ?>
  103. </td>
  104. <td width="100"><div align="center"><img src="../anhphim/<?php echo $dong["hinhphim"]; ?>" width="100" height="75"></div></td>
  105. <td width="50"><div align="center"><a href="suaphim.php?idphim=<?php echo $dong["maphim"]; ?>">S?a</a></div></td>
  106. <td width="50"><div align="center"><a href="xoaphim.php?idphim=<?php echo $dong["maphim"]; ?>">Xóa</a></div></td>
  107. </tr>
  108. <?php
  109. }
  110. ?>
  111. </table>
  112. <p align="center"><font color="#CC0000" size="+1">Trang </font>
  113. <?php if ($n>1)
  114. {
  115. $n1=$n - 1;
  116. ?>
  117. <a href="quanlyphim.php?n=<?php echo $n1;?>&tst=<?php echo $tongsotrang;?>"> Back </a>
  118. <?php } ?>
  119. <?php
  120. $dau=($n-1)*$sonhom +1;
  121. if ($n<=$tongsonhom)
  122. {
  123. $cuoi=$dau + $sonhom -1;
  124. }
  125. else
  126. {
  127. $cuoi=$tongsonhom;
  128. }
  129. for($i=$dau; $i<=$cuoi; $i++)
  130. {
  131. if ($i==$p)
  132. {
  133. echo $i."&nbsp;";
  134. }
  135. else
  136. {
  137. ?>
  138. <a href="quanlyphim.php?p=<?php echo $i;?>&tst=<?php echo $tongsotrang;?>"><?php echo $i."&nbsp;";?></a>
  139. <?php } }
  140. ?>
  141. <?php if ($n<=$tongsonhom)
  142. {
  143. $n2=$n+1;
  144. ?>
  145. <a href="quanlyphim.php?n=<?php echo $n2;?>&tst=<?php echo $tongsotrang;?>"> Next </a>
  146. <?php } ?>
  147. </p>
  148. </body>
  149. </html>