/Quản lý website bán quần áo PHP/quanly/cumchucnang/hotro_tructuyen/quan_ly.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien · PHP · 161 lines · 152 code · 6 blank · 3 comment · 20 complexity · ddd9665862e64a314af205a332761611 MD5 · raw file

  1. <?php
  2. chong_pha_hoai();
  3. //echo "chao <hr>";
  4. ?>
  5. <style type="text/css">
  6. a.sua_xoa:link { font-size: 16px; text-decoration: none; color: #FF00FF; font-weight: bold}
  7. a.sua_xoa:visited { font-size: 16px; color: #FF00FF; text-decoration: none; font-weight: bold}
  8. a.sua_xoa:hover { font-size: 16px; text-decoration: underline; color: #FF8C00; font-weight: bold; font-style: normal; }
  9. a.thua__link_1:link { font-size: 16px; text-decoration: none; color: #0b55c4; }
  10. a.thua__link_1:visited { font-size: 16px; color: #0b55c4; text-decoration: none; }
  11. a.thua__link_1:hover { font-size: 16px; text-decoration: none; color: #084095; font-style: normal; }
  12. </style>
  13. <?php
  14. function xuat_link($st)
  15. {
  16. //if($_GET['trang']==""){$_GET['trang']=1;}
  17. ?>
  18. <style>
  19. a.pt3
  20. {
  21. color:black;
  22. text-decoration: none;
  23. font-weight:bold;
  24. }
  25. a.pt3:hover
  26. {
  27. color:red;
  28. text-decoration: none;
  29. font-weight:bold;
  30. }
  31. </style>
  32. <?php
  33. echo "<center>";
  34. if($_GET['trang']!="")
  35. {
  36. if(ereg("&trang=",$_SERVER['REQUEST_URI']))
  37. {
  38. $_SERVER['REQUEST_URI']=str_replace("&trang=","",$_SERVER['REQUEST_URI']);
  39. $_SERVER['REQUEST_URI']=substr($_SERVER['REQUEST_URI'],0,-strlen($_GET['trang']));
  40. $lpt=$_SERVER['REQUEST_URI']."&trang=";
  41. }
  42. else
  43. {
  44. $lpt=$_SERVER['REQUEST_URI']."&trang=";
  45. }
  46. }
  47. else
  48. {
  49. $_SERVER['REQUEST_URI']=str_replace("&trang=","",$_SERVER['REQUEST_URI']);
  50. $lpt=$_SERVER['REQUEST_URI']."&trang=";
  51. }
  52. if($_GET['trang']!="" and $_GET['trang']!="1")
  53. {
  54. if($_GET['trang']=="" or $_GET['trang']==1)
  55. {
  56. $k=1;
  57. }
  58. else
  59. {
  60. $k=$_GET['trang']-1;
  61. }
  62. $link_t=$lpt.$k;
  63. $link_d=$lpt."1";
  64. echo '<a href="'.$link_d.'" style="margin-right:10px" class="pt3">Đầu</a>';
  65. echo '<a href="'.$link_t.'" style="margin-right:10px" class="pt3">Trước</a>';
  66. }
  67. if($_GET['trang']==""){$a=1;}else{$a=$_GET['trang'];}
  68. $b_1=$_GET['trang']-5;$n_1=$b_1;
  69. if($b_1<1){$b_1=1;}
  70. $b_2=$_GET['trang']+5;
  71. if($b_2>=$st){$n_2=$b_2;$b_2=$st;}
  72. //echo $b_1."<hr>";
  73. if($n_1<0){$v=(-1)*$n_1;$b_2=$b_2+$v;}
  74. if($n_2>=$st){$v_2=$n_2-$st;$b_1=$b_1-$v_2;}
  75. if($b_1>1){echo ' ... ';}
  76. for($i=$b_1;$i<=$b_2;$i++)
  77. {
  78. $lpt_1=$lpt.$i;
  79. if($i>0 && $i<=$st)
  80. {
  81. if($i!=$a)
  82. {
  83. ?>
  84. <a href="<?php echo $lpt_1; ?>" class="pt3"><?php echo $i;?> </a>
  85. <?php
  86. }
  87. else
  88. {
  89. echo "<b style=\"color:red\">$i</b>";
  90. }
  91. }
  92. }
  93. if($b_2<$st){echo ' ... ';}
  94. if($_GET['trang']!=$st && $st!=1)
  95. {
  96. if($_GET['trang']==$st)
  97. {
  98. $k=$st;
  99. }
  100. else
  101. {
  102. $k=$_GET['trang']+1;
  103. if($_GET['trang']==""){$k=2;}
  104. }
  105. $link_s=$lpt.$k;
  106. $link_cuoi=$lpt.$st;
  107. echo '<a href="'.$link_s.'" style="margin-left:10px" class="pt3">Sau</a>';
  108. echo '<a href="'.$link_cuoi.'" style="margin-left:10px" class="pt3">Cuối</a>';
  109. }
  110. echo "</center>";
  111. }
  112. ?>
  113. <?php
  114. $sd=20;
  115. $b_tv="select count(*) from hotro_tructuyen";
  116. $b_tv_1=mysql_query($b_tv);
  117. $b_tv_2=mysql_fetch_row($b_tv_1);
  118. $st=ceil($b_tv_2[0]/$sd);
  119. if($_GET['trang']==""){$vtbd=0;}else{$vtbd=($_GET['trang']-1)*$sd;}
  120. $tv="select * from hotro_tructuyen order by id limit $vtbd,$sd";
  121. $tv_1=mysql_query($tv);
  122. ?>
  123. <table id="er" style="text-align:left;margin:6px 6px 6px 6px;font-size:16px;color:#666666">
  124. <tr>
  125. <td width="350px">Tên nick</td>
  126. <td width="100px">Loại nick</td>
  127. <td width="100px" align="center">Sữa</td>
  128. <td width="100px" align="center">Xóa</td>
  129. </tr>
  130. <?php
  131. while($tv_2=mysql_fetch_array($tv_1))
  132. {
  133. $link_sua="?thamso=sua_nick_httt&id=$tv_2[id]&trang=$_GET[trang]";
  134. $link_xoa="?thamso=xoa_nick_httt&id=$tv_2[id]&trang=$_GET[trang]";
  135. ?>
  136. <tr>
  137. <td ><a href="<?php echo $link_sua; ?>" class="thua__link_1"><?php echo $tv_2['nickname']; ?></a></td>
  138. <td ><?php echo $tv_2['loai_nick']; ?></td>
  139. <td width="100px" align="center"><a href="<?php echo $link_sua; ?>" class="sua_xoa">Sữa</a></td>
  140. <td width="100px" align="center"><a href="<?php echo $link_xoa; ?>" class="sua_xoa">Xóa</a></td>
  141. </tr>
  142. <?php
  143. }
  144. ?>
  145. <tr>
  146. <td colspan="6">
  147. <?php
  148. xuat_link($st);
  149. ?>
  150. </td>
  151. </tr>
  152. </table>
  153. <script type="text/javascript">
  154. table_css_2("er");
  155. </script>