Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "config.php";
- error_reporting(0);
- $dataPerPage = 10;
- // apabila $_GET['page'] sudah didefinisikan, gunakan nomor halaman tersebut,
- // sedangkan apabila belum, nomor halamannya 1.
- if(isset($_GET['page']))
- {
- $noPage = $_GET['page'];
- }
- else $noPage = 1;
- // perhitungan offset
- $offset = ($noPage - 1) * $dataPerPage;
- // query SQL untuk menampilkan data perhalaman sesuai offset
- $query = "SELECT * FROM inbox LIMIT $offset, $dataPerPage";
- $result = mysql_query($query) or die('Error');
- // menampilkan data
- $jml_row=mysql_num_rows($result);
- //echo "jumlah record di table inbox halaman $noPage = $jml_row";
- /*if ($_POST['Submit'] == 'search')
- {
- $_POST[''];
- echo"cari";
- }
- else if ($_POST['Submit'] == 'update')
- {
- echo"update";
- }*/
- ?>
- <!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>Untitled Document</title>
- <style type="text/css">
- .clear {
- clear: both;
- width: 100%;
- }
- .tb-all {
- margin: auto;
- width: 700px;
- border: 3px solid #EAEAEA;
- /*padding-bottom: 10px;*/
- }
- .tit-all {
- background-color: #C0C0C0;
- width: 100%;
- height: 35px;
- }
- .bod-all {
- /*border: 2px solid #ABABAB;*/
- padding-left:10px;
- padding-right:10px;
- padding-bottom:10px;
- }
- .sleft {
- width: 200px;
- padding: 5px;
- float: left;
- height: 25px;
- background-color: #0F0;
- }
- .sright {
- padding: 5px;
- height: 25px;
- width: 200px;
- float: right;
- background-color: #C00;
- }
- .bod-all table {
- /*background-color: #818181;*/
- border-collapse:collapse;
- border: none;
- width:100%;
- }
- .bod-all table thead th {
- background: #eeeeee;
- background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc));
- background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
- background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
- background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%);
- background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 );
- padding: 10px 0px 10px 5px;
- text-align:left;
- }
- .bod-all table tr:hover td{
- background-color: #FCFCFC;
- cursor:pointer;
- }
- .bod-all table tr td {
- border-bottom:1px solid #EBEBEB;
- padding: 5px 0px 5px 5px;
- background-color: #F8F8F8;
- }
- .tb-form {
- padding: 10px;
- width: 100%;
- }
- .tb-form form {
- float: right;
- margin-right: 30px;
- }
- .tb-fot {
- height: 45px;
- width: 100%;
- background-color: #EBEBEB;
- /*border:1px solid blue;*/
- line-height:50px;
- text-align: right;
- letter-spacing: 1px;
- }
- .tb-fot span a {
- background-color: #6C6C6C;
- margin-right: 3px;
- margin-left: 3px;
- padding-top: 3px;
- padding-right: 5px;
- padding-bottom: 3px;
- padding-left: 5px;
- border: 1px inset #EBEBEB;
- text-decoration:none;
- }
- .tb-fot span a:hover {
- background-color: #D6D6D6;
- border: 1px outset #EBEBEB;
- }
- .tb-fot span a:active{
- background-color: #C1C1C1;
- border: 1px inset #EBEBEB;
- }
- .tb-form .left-con {
- float: left;
- height: 30px;
- width: 200px;
- }
- .left-con span {
- float: left;
- margin-left: 10px;
- margin-top: 10px;
- font-size: 25px;
- }
- .left-con img {
- float: left;
- }
- .tb-form form input[type=text] {
- border: 1px solid #D5D5D5;
- padding: 5px;
- }
- .tb-form form input[type=submit] {
- border: thin solid #ABABAB;
- padding: 5px;
- background-color: #E9E9E9;
- }
- </style>
- </head>
- <body>
- <div class="tb-all">
- <!--<div class="tit-all">
- <span class="sleft">record sms inbox</span><span class="sright">tit kanan</span>
- <div class="clear"></div></div>-->
- <div class="tb-form">
- <div class="left-con"><img src="../img/folder-a.png" width="52" height="46" /><span>inbox</span></div>
- <form method="get" action="<?php echo $_SERVER["PHP_SELF"];?>">
- <input type="text" name="q" /> <input value="search" type="submit">
- </form>
- <div class="clear"></div>
- </div>
- <div class="bod-all">
- <table>
- <thead>
- <th>no</th>
- <th>asd</th>
- <th>ads</th>
- <th>Prosesed</th>
- <th>action</th>
- </thead>
- <?php
- $a_war = 1;
- $a_war_genap="#EBEBEB";
- $a_war_ganjil="#FEFEFE";
- if (!empty($_GET['q'])) {
- $word=$_GET['q'];
- $result12 = mysql_query("SELECT * FROM inbox WHERE TextDecoded LIKE '%$word%' LIMIT $offset, $dataPerPage")or die ("ERROR");
- echo "cari-> " .$word;
- }else{
- $query1 = "SELECT * FROM inbox LIMIT $offset, $dataPerPage";
- $result12 = mysql_query($query1) or die('Error');
- echo "tampilkan";
- }
- while($data = mysql_fetch_array($result12))
- {
- if ($a_war % 2 == 0) $warna = $a_war_genap;
- else $warna = $a_war_ganjil;
- ?>
- <tr>
- <td><?php echo $a_war;?></td>
- <td><?php echo $data['ReceivingDateTime'] ;?></td>
- <td><?php echo $data['TextDecoded'];?></td>
- <td><?php echo $data['Processed'];?></td>
- <td>
- <a href="action.php?op=edit&id=<?php echo $data['ID'];?>" target="_blank">edit</a>|
- <a href="action.php?dem=view&id=<?php echo $data['ID'];?>" target="_blank">view</a>|
- <a href="action.php?op=drop&id=<?php echo $data['ID'];?>" target="_blank">drop</a>
- </td>
- </tr>
- <?php
- $a_war++;
- }
- echo "</table>";
- // mencari jumlah semua data dalam tabel guestbook
- $query = "SELECT COUNT(*) AS jumData FROM inbox";
- $hasil = mysql_query($query);
- $data = mysql_fetch_array($hasil);
- $jumData = $data['jumData'];
- // menentukan jumlah halaman yang muncul berdasarkan jumlah semua data
- $jumPage = ceil($jumData/$dataPerPage);
- ?>
- <div class="clear"></div></div>
- <div class="tb-fot">
- <?php
- // menampilkan link previous
- if ($noPage > 1) echo "<span><a href='".$_SERVER['PHP_SELF']."?module=act&folder=inbox&page=".($noPage-1)."'><< Prev</a></span>";
- // memunculkan nomor halaman dan linknya
- for($page = 1; $page <= $jumPage; $page++)
- {
- if ((($page >= $noPage - 3) && ($page <= $noPage + 3)) || ($page == 1) || ($page == $jumPage))
- {
- if (($showPage == 1) && ($page != 2)) echo "...";
- if (($showPage != ($jumPage - 1)) && ($page == $jumPage)) echo "...";
- if ($page == $noPage) echo " <b>".$page."</b> ";
- else echo " <span><a href='".$_SERVER['PHP_SELF']."?module=act&folder=inbox&page=".$page."'>".$page."</a></span> ";
- $showPage = $page;
- }
- }
- // menampilkan link next
- if ($noPage < $jumPage) echo "<span><a href='".$_SERVER['PHP_SELF']."?module=act&folder=inbox&page=".($noPage+1)."'>Next >></a></span>";
- ?>
- <!--<span><a href="">1</a></span><span><a href="">1</a></span>-->
- <div class="clear"></div>
- </div>
- <div class="clear"></div>
- </div>
- <div class="clear"></div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement