Advertisement
mqnoy

ini halamannya

Apr 15th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.81 KB | None | 0 0
  1. <?php
  2. include "config.php";
  3. error_reporting(0);
  4. $dataPerPage = 10;
  5.  
  6. // apabila $_GET['page'] sudah didefinisikan, gunakan nomor halaman tersebut,
  7. // sedangkan apabila belum, nomor halamannya 1.
  8. if(isset($_GET['page']))
  9. {
  10.     $noPage = $_GET['page'];
  11. }
  12. else $noPage = 1;
  13.  
  14. // perhitungan offset
  15. $offset = ($noPage - 1) * $dataPerPage;
  16.  
  17. // query SQL untuk menampilkan data perhalaman sesuai offset
  18. $query = "SELECT * FROM inbox LIMIT $offset, $dataPerPage";
  19. $result = mysql_query($query) or die('Error');
  20.  
  21. // menampilkan data
  22. $jml_row=mysql_num_rows($result);
  23. //echo "jumlah record di table inbox halaman $noPage = $jml_row";
  24.  
  25. /*if ($_POST['Submit'] == 'search')
  26. {
  27. $_POST[''];
  28. echo"cari";
  29. }
  30. else if ($_POST['Submit'] == 'update')
  31. {
  32. echo"update";
  33.  
  34. }*/
  35.  
  36.  
  37. ?>
  38. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  39.  
  40. <html xmlns="http://www.w3.org/1999/xhtml">
  41. <head>
  42. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  43. <title>Untitled Document</title>
  44. <style type="text/css">
  45. .clear {
  46.     clear: both;
  47.     width: 100%;
  48. }
  49. .tb-all {
  50.     margin: auto;
  51.     width: 700px;
  52.     border: 3px solid #EAEAEA;
  53.     /*padding-bottom: 10px;*/
  54. }
  55.  
  56. .tit-all {
  57.     background-color: #C0C0C0;
  58.     width: 100%;
  59.     height: 35px;
  60. }
  61. .bod-all {
  62.     /*border: 2px solid #ABABAB;*/
  63.     padding-left:10px;
  64.     padding-right:10px;
  65.     padding-bottom:10px;
  66. }
  67. .sleft {
  68.     width: 200px;
  69.     padding: 5px;
  70.     float: left;
  71.     height: 25px;
  72.     background-color: #0F0;
  73. }
  74. .sright {
  75.     padding: 5px;
  76.     height: 25px;
  77.     width: 200px;
  78.     float: right;
  79.     background-color: #C00;
  80. }
  81.  
  82.  
  83. .bod-all table {
  84.     /*background-color: #818181;*/
  85.     border-collapse:collapse;
  86.     border: none;
  87.     width:100%;
  88.  
  89. }
  90. .bod-all table thead th {
  91.     background: #eeeeee;
  92. background: -moz-linear-gradient(top,  #eeeeee 0%, #cccccc 100%);
  93. background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc));
  94. background: -webkit-linear-gradient(top,  #eeeeee 0%,#cccccc 100%);
  95. background: -o-linear-gradient(top,  #eeeeee 0%,#cccccc 100%);
  96. background: -ms-linear-gradient(top,  #eeeeee 0%,#cccccc 100%);
  97. background: linear-gradient(to bottom,  #eeeeee 0%,#cccccc 100%);
  98. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 );
  99.  
  100.  
  101.  
  102.     padding: 10px 0px 10px 5px;
  103.     text-align:left;
  104. }
  105. .bod-all table tr:hover td{
  106.     background-color: #FCFCFC;
  107.     cursor:pointer;
  108. }
  109. .bod-all table tr td {
  110.     border-bottom:1px solid #EBEBEB;
  111.     padding: 5px 0px 5px 5px;
  112.     background-color: #F8F8F8;
  113. }
  114. .tb-form {
  115.     padding: 10px;
  116.     width: 100%;
  117. }
  118. .tb-form form {
  119.     float: right;
  120.     margin-right: 30px;
  121. }
  122. .tb-fot {
  123.     height: 45px;
  124.     width: 100%;
  125.     background-color: #EBEBEB;
  126.     /*border:1px solid blue;*/
  127.     line-height:50px;
  128.     text-align: right;
  129.     letter-spacing: 1px;
  130. }
  131. .tb-fot span a {
  132.     background-color: #6C6C6C;
  133.     margin-right: 3px;
  134.     margin-left: 3px;
  135.     padding-top: 3px;
  136.     padding-right: 5px;
  137.     padding-bottom: 3px;
  138.     padding-left: 5px;
  139.     border: 1px inset #EBEBEB;
  140.     text-decoration:none;
  141.    
  142. }
  143. .tb-fot span a:hover {
  144.     background-color: #D6D6D6;
  145.     border: 1px outset #EBEBEB;
  146.     }
  147. .tb-fot span a:active{
  148.     background-color: #C1C1C1;
  149.     border: 1px inset #EBEBEB;
  150.     }
  151. .tb-form .left-con {
  152.     float: left;
  153.     height: 30px;
  154.     width: 200px;
  155. }
  156. .left-con span {
  157.     float: left;
  158.     margin-left: 10px;
  159.     margin-top: 10px;
  160.     font-size: 25px;
  161. }
  162. .left-con img {
  163.     float: left;
  164. }
  165.  
  166. .tb-form form input[type=text] {
  167.     border: 1px solid #D5D5D5;
  168.     padding: 5px;
  169. }
  170. .tb-form form input[type=submit] {
  171.     border: thin solid #ABABAB;
  172.     padding: 5px;
  173.     background-color: #E9E9E9;
  174. }
  175. </style>
  176. </head>
  177.  
  178. <body>
  179. <div class="tb-all">
  180. <!--<div class="tit-all">
  181. <span class="sleft">record sms inbox</span><span class="sright">tit kanan</span>
  182. <div class="clear"></div></div>-->
  183. <div class="tb-form">
  184. <div class="left-con"><img src="../img/folder-a.png" width="52" height="46" /><span>inbox</span></div>
  185. <form method="get" action="<?php echo $_SERVER["PHP_SELF"];?>">
  186. <input type="text" name="q" /> <input value="search" type="submit">
  187. </form>
  188. <div class="clear"></div>
  189. </div>
  190. <div class="bod-all">
  191.  
  192. <table>
  193.   <thead>
  194.     <th>no</th>
  195.     <th>asd</th>
  196.     <th>ads</th>
  197.     <th>Prosesed</th>
  198.     <th>action</th>
  199.   </thead>
  200. <?php
  201. $a_war = 1;
  202. $a_war_genap="#EBEBEB";
  203. $a_war_ganjil="#FEFEFE";
  204.  
  205.                                
  206. if (!empty($_GET['q'])) {
  207. $word=$_GET['q'];
  208. $result12 = mysql_query("SELECT * FROM inbox WHERE TextDecoded LIKE '%$word%' LIMIT $offset, $dataPerPage")or die ("ERROR");
  209.  
  210.        echo "cari-> " .$word;
  211.  
  212. }else{
  213. $query1 = "SELECT * FROM inbox LIMIT $offset, $dataPerPage";
  214. $result12 = mysql_query($query1) or die('Error');
  215. echo "tampilkan";
  216. }
  217.  
  218.  
  219.  
  220.  
  221. while($data = mysql_fetch_array($result12))
  222. {
  223. if ($a_war % 2 == 0) $warna = $a_war_genap;
  224.  else $warna = $a_war_ganjil;
  225. ?>
  226.    <tr>
  227.     <td><?php echo $a_war;?></td>
  228.     <td><?php echo $data['ReceivingDateTime'] ;?></td>
  229.     <td><?php echo $data['TextDecoded'];?></td>
  230.     <td><?php echo $data['Processed'];?></td>
  231.     <td>
  232.     <a href="action.php?op=edit&id=<?php echo $data['ID'];?>" target="_blank">edit</a>|
  233.     <a href="action.php?dem=view&id=<?php echo $data['ID'];?>" target="_blank">view</a>|
  234.     <a href="action.php?op=drop&id=<?php echo $data['ID'];?>" target="_blank">drop</a>
  235.     </td>
  236.   </tr>
  237. <?php
  238. $a_war++;
  239. }
  240. echo "</table>";
  241.  
  242. // mencari jumlah semua data dalam tabel guestbook
  243. $query   = "SELECT COUNT(*) AS jumData FROM inbox";
  244. $hasil   = mysql_query($query);
  245. $data    = mysql_fetch_array($hasil);
  246. $jumData = $data['jumData'];
  247.  
  248. // menentukan jumlah halaman yang muncul berdasarkan jumlah semua data
  249. $jumPage = ceil($jumData/$dataPerPage);
  250. ?>
  251. <div class="clear"></div></div>
  252. <div class="tb-fot">
  253. <?php
  254. // menampilkan link previous
  255. if ($noPage > 1) echo  "<span><a href='".$_SERVER['PHP_SELF']."?module=act&folder=inbox&page=".($noPage-1)."'>&lt;&lt; Prev</a></span>";
  256.  
  257. // memunculkan nomor halaman dan linknya
  258. for($page = 1; $page <= $jumPage; $page++)
  259. {
  260.          if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage))
  261.          {
  262.             if (($showPage == 1) && ($page != 2))  echo "...";
  263.             if (($showPage != ($jumPage - 1)) && ($page == $jumPage))  echo "...";
  264.             if ($page == $noPage) echo " <b>".$page."</b> ";
  265.             else echo " <span><a href='".$_SERVER['PHP_SELF']."?module=act&folder=inbox&page=".$page."'>".$page."</a></span> ";
  266.             $showPage = $page;
  267.          }
  268. }
  269.  
  270. // menampilkan link next
  271.  
  272. if ($noPage < $jumPage) echo "<span><a href='".$_SERVER['PHP_SELF']."?module=act&folder=inbox&page=".($noPage+1)."'>Next &gt;&gt;</a></span>";
  273. ?>
  274. <!--<span><a href="">1</a></span><span><a href="">1</a></span>-->
  275. <div class="clear"></div>
  276. </div>
  277. <div class="clear"></div>
  278. </div>
  279. <div class="clear"></div>
  280. </div>
  281.  
  282. </body>
  283. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement