google.com, pub-4169750801100201, DIRECT, f08c47fec0942fa0
Script PHP Website Online Store Dengan Dreamweaver Lengkap | MUDA MUDI CONDROWANGSAN

Script PHP Website Online Store Dengan Dreamweaver Lengkap


BAB V
IMPLEMENTASI

            Berdasarkan hasil dari perancangan, dilakukan implementasi sebuah Sistem Aplikasi Pemesanan Makanan berbasis SMS Gateway dengan menggunakan GAMMU, Dreamweaver CS5, PHP dan MySQL (database). Implementasi merupakan tahap dimana sistem ini siap dioperasikan pada keadaan yang sebenarnya.
Dari pembahasan ini akan diketahui apakah sistem yang dibuat benar-benar dapat menghasilkan tujuan yang diinginkan yang didasarkan pada analisa dan design yang telah dilakukan.
5.1       Aplikasi Sistem
Adapun spesifikasi dari program yang digunakan adalah sebagai berikut :
5.1.1 Tampilan Halaman Login Admin
            Pada Tampilan Halaman Login, input Username dan Password Admin. Tampilan dapat dilihat pada gambar 4.1 berikut:

Gambar 4.1 Tampilan Halaman Login
<!DOCTYPE html>

<head>
           
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
           
            <title>Login</title>
           
            <!--                       CSS                       -->
       
            <!-- Reset Stylesheet -->
            <link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
       
            <!-- Main Stylesheet -->
            <link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
           
            <!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
            <link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
           
            <!-- Colour Schemes
       
            Default colour scheme is green. Uncomment prefered stylesheet to use it.
           
            <link rel="stylesheet" href="resources/css/blue.css" type="text/css" media="screen" />
           
            <link rel="stylesheet" href="resources/css/red.css" type="text/css" media="screen" /> 
       
            -->
           
            <!-- Internet Explorer Fixes Stylesheet -->
           
            <!--[if lte IE 7]>
                  <link rel="stylesheet" href="resources/css/ie.css" type="text/css" media="screen" />
            <![endif]-->
           
            <!--                       Javascripts                       -->
       
            <!-- jQuery -->
            <script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
           
            <!-- jQuery Configuration -->
            <script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
           
            <!-- Facebox jQuery Plugin -->
            <script type="text/javascript" src="resources/scripts/facebox.js"></script>
           
            <!-- jQuery WYSIWYG Plugin -->
            <script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>
           
            <!-- Internet Explorer .png-fix -->
           
            <!--[if IE 6]>
                  <script type="text/javascript" src="resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
                  <script type="text/javascript">
                        DD_belatedPNG.fix('.png_bg, img, li');
                  </script>
            <![endif]-->
           
      </head>
 
      <body id="login">
           
            <div id="login-wrapper" class="png_bg">
                  <div id="login-top">
                 
                        <h1>Login</h1>
                        <!-- Logo (221px width) -->
                        <img id="logo" src="resources/images/pesansj.png" alt="pesansaja" />
                  </div> <!-- End #logn-top -->
                 
                  <div id="login-content">
                       
                        <form action="index.html">
                       
                              <div class="notification information png_bg">
                                   
                              </div>
                             
                              <p>
                                    <label>Username</label>
                                    <input class="text-input" type="text" />
                              </p>
                              <div class="clear"></div>
                              <p>
                                    <label>Password</label>
                                    <input class="text-input" type="password" />
                              </p>
                              <div class="clear"></div>
                              <p id="remember-password">
                                    <input type="checkbox" />Remember me
                              </p>
                              <div class="clear"></div>
                              <p>
                                    <input class="button" type="submit" value="Sign In" />
                              </p>
                             
                        </form>
                  </div> <!-- End #login-content -->
                 
            </div> <!-- End #login-wrapper -->
           
  </body>
  </html>
Modul Program 5.1 Halaman login
5.1.2 Tampilan Halaman Beranda
            Tampilan Menu Beranda merupakan sebuah tampilan yang tertampil ketika kita telah sukses melakukan proses Login. Tampilan dapat dilihat pada gambar 4.2 berikut:


Gambar 4.2 Tampilan Halaman Beranda
<?php
session_start();
include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur = "home";

include("inc/header.php");


$_SESSION['inboxbaru']=$inbox;
if($_SESSION['inboxbaru']>$_SESSION['inboxlama'])
{
?>
      <embed src="sms_tone.mp3" autostart="true">
<?php
$_SESSION['alertsms']="<font color='red'><b>Ada SMS Coy.. Segera dicek di <a href='inbox.php'>sini</a></b></font>";
}
if($_SESSION['inboxbaru']==$_SESSION['inboxlama'])
{
      $_SESSION['alertsms']="";
}

$_SESSION['inboxlama']=$_SESSION['inboxbaru'];


?>

<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Pesansaja SMS Service</h2>
                  <p id="page-intro">horeee</p>
                  <img id="logo" src="web.png" alt="web"/>
                 
<p>

<br>
                  <!-- End .shortcut-buttons-set -->
                 
<div class="clear"></div> <!-- End .clear -->
                 
                 
           

                  <div class="clear"></div>
                 
                             
           
<?php
include("inc/footer.php");
?>           
Modul Program 5.2 Halaman beranda


5.1.3 Tampilan Halaman Kirim SMS

Gambar 4.3 Tampilan Halaman Kirim SMS
<?php
session_start();
include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur="tulis";

include("inc/header.php");

$nohp = "";
if(isset($_GET['nohp']))
{
      $nohp =  $_GET['nohp'];
}




?>

<script type="text/javascript">
function textCounter(field,cntfield) {
cntfield.value = field.value.length;
//cntfield.value = maxlimit - field.value.length;
}
      function KirimKonfirmasi() {
     var txt = prompt('Masukkan Nomor HP dan sapaan<spasi>nama pelanggan, pisahkan dengan titik koma (;)', '');
     if (txt) window.location.href = 'kirimkonfirmasi.php?txt='+txt;
      }
</script>

<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Tulis SMS</h2>
<br>


<div class="content-box-content">
            <div class="tab-content default-tab" id="tab2">

   
   
<form name="myForm" method="post" action="send.php">
<table class="inputan" cellpadding="3px" style="width:700px;">
<?php
if($_GET['nama']!="")
{?>
<tr>
      <td valign="top" width="100">Nama Penerima</td>
       <td valign="top"><h3>: <?php echo $_GET['nama']; ?></h3></td>
</tr>
<?php
}
?>
<tr>
  <td valign="top">Nomor</td>
  <td valign="top">
    <input name="nomor" id="nomor" type="text" size="20" value="<?php echo $nohp; ?>" />
  </td>
</tr>
<tr>
   <th valign="top" >Isi Pesan</th>
   <td valign="top" align="left">
      <textarea name="pesan" wrap="physical" cols="28" rows="5"
             onKeyDown="textCounter(this,document.myForm.remLen1)"
             onKeyUp="textCounter(this,document.myForm.remLen1)"></textarea>
    <br>
    <input readonly type="text" name="remLen1" size="3" disabled maxlength="3" value="0">
   </td>
</tr>
<tr><td valign="top">&nbsp;</td><td valign="top"><input class="button" type="submit" value="Kirim"></td></tr>
</table>
</form>


            </div> <!-- End #tab2 -->  

                 
      <div class="clear"></div> <!-- End .clear -->
                 
                 
           

                  <div class="clear"></div>
                 
                              
           
<?php
include("inc/footer.php");
?>           
Modul Program 5.3 Halaman writesms

<html>
<head>
<title>
SMS CS pesansaja.com
</title>
</head>
<body>

<?php
include "function.php";
?>



<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<table>
<tr valign="top"><td><b>No HP</b></td><td>:</td><td><input type="text" name="nohp"></td></tr>
<tr valign="top"><td><b>Isi SMS</b><br>(maksimum panjang SMS adalah 160 karakter)</td><td>:</td><td><textarea name="sms" rows="5" cols="40"></textarea></td></tr>

</table>
<input type="submit" name="submit" value="Kirim SMS">
</form>

<?php
  if ($_POST)
  {
   $nohp = $_POST['nohp'];
   $sms = $_POST['sms'];
   $phone = "smsdrc1";
  
   echo "<b>Status :</b><br>";
   echo "<pre>";
   passthru('gammu-smsd-inject -c '.$phone.' TEXT '.$nohp.' -text "'.$sms.'"');
   echo "</pre>";
  }
?>

</body>
</html>
Modul Program 5.3.1 Halaman kirimsms

<?php
session_start();
include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur="tulis";

include("inc/header.php");

?>
<?php
$nohp = "";
if(isset($_GET['nohp']))
{
      $nohp =  $_GET['nohp'];
}

$jam =  date("G");

if($jam <11)
{
      $selamat = "pagi";
}
elseif(($jam >10)&&($jam <15))
{
      $selamat = "siang";
}
elseif($jam >14)
{
      $selamat = "sore";
}

$data = explode(";",$_GET['txt']);

?>
<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
<h2>Kirim Konfirmasi SMS pesansaja.com untuk konfirmasi pesanan</h2>
<br>

<div class="content-box-content">
            <div class="tab-content default-tab" id="tab2">
<form name="myForm" method="post" action="send.php">
<table class="inputan" cellpadding="3px" style="width:700px;">
<?php
if($_GET['nama']!="")
{?>
<tr>
      <td valign="top" width="100">Nama Penerima</td>
       <td valign="top"><h3>: <?php echo $_GET['nama']; ?></h3></td>
</tr>
<?php
}
?>
<tr>
  <td valign="top">Nomor</td>
  <td valign="top">
    <input name="nomor" id="nomor" type="text" size="20" value="<?php echo $data[0]; ?>" />
  </td>
</tr>
<tr>
   <th valign="top" >Isi Pesan</th>
   <td valign="top" align="left">
      <textarea name="pesan" wrap="physical" cols="28" rows="5"
             onKeyDown="textCounter(this,document.myForm.remLen1)"
             onKeyUp="textCounter(this,document.myForm.remLen1)">Selamat <?php echo $selamat." ".$data[1]; ?>. Konfirmasi pesanan dari pesansaja.com. Apakah pesanan Anda sudah benar? Jika sudah akan kami proses. Terima kasih.</textarea>
    <br>
    <input readonly type="text" name="remLen1" size="3" disabled maxlength="3" value="0">
   </td>
</tr>
<tr><td valign="top">&nbsp;</td><td valign="top"><input class="button" type="submit" value="Kirim"></td></tr>
</table>
</form>
            </div> <!-- End #tab2 -->  
      <div class="clear"></div> <!-- End .clear -->
                  <div class="clear"></div>
<?php
include("inc/footer.php");
?>
Modul Program 5.3.2 Halaman kirimkonfirmasi
<?php
session_start();
include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur="tulis";

include("inc/header.php");

?>
<?php
$nohp = "";
if(isset($_GET['nohp']))
{
      $nohp =  $_GET['nohp'];
}

$jam =  date("G");

if($jam <11)
{
      $selamat = "pagi";
}
elseif(($jam >10)&&($jam <15))
{
      $selamat = "siang";
}
elseif($jam >14)
{
      $selamat = "sore";
}

$data = explode(";",$_GET['txt']);

?>
<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Kirim Konfirmasi SMS pesansaja.com untuk konfirmasi proses pengiriman</h2>
<br>

<div class="content-box-content">
            <div class="tab-content default-tab" id="tab2">
<form name="myForm" method="post" action="send.php">
<table class="inputan" cellpadding="3px" style="width:700px;">
<?php
if($_GET['nama']!="")
{?>
<tr>
      <td valign="top" width="100">Nama Penerima</td>
       <td valign="top"><h3>: <?php echo $_GET['nama']; ?></h3></td>
</tr>
<?php
}
?>
<tr>
  <td valign="top">Nomor</td>
  <td valign="top">
    <input name="nomor" id="nomor" type="text" size="20" value="<?php echo $data[0]; ?>" />
  </td>
</tr>
<tr>
   <th valign="top" >Isi Pesan</th>
   <td valign="top" align="left">
      <textarea name="pesan" wrap="physical" cols="28" rows="5"
             onKeyDown="textCounter(this,document.myForm.remLen1)"
             onKeyUp="textCounter(this,document.myForm.remLen1)">Selamat <?php echo $selamat." ".$data[1]; ?>.Pesanan Anda sdh kami kirim.Ekspedisi:<?php echo $data[2];?>, No.AWB:<?php echo $data[3]; ?>.Mhn infonya jika paket sudah diterima.Terima kasih.</textarea>
    <br>
    <input readonly type="text" name="remLen1" size="3" disabled maxlength="3" value="0">
   </td>
</tr>
<tr><td valign="top">&nbsp;</td><td valign="top"><input class="button" type="submit" value="Kirim"></td></tr>
</table>
</form>
            </div> <!-- End #tab2 -->  
      <div class="clear"></div> <!-- End .clear -->
                  <div class="clear"></div>
<?php
include("inc/footer.php");
?>
Modul Program 5.3.3 Halaman konfirmasipengiriman
<?php
session_start();
include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur="tulis";

include("inc/header.php");

?>
<?php
$nohp = "";
if(isset($_GET['nohp']))
{
      $nohp =  $_GET['nohp'];
}

$jam =  date("G");

if($jam <11)
{
      $selamat = "pagi";
}
elseif(($jam >10)&&($jam <15))
{
      $selamat = "siang";
}
elseif($jam >14)
{
      $selamat = "sore";
}

$data = explode(";",$_GET['txt']);

?>
<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Kirim Konfirmasi SMS pesansaja.com untuk konfirmasi pengiriman sudah terkirim.
<br>
<div class="content-box-content">
            <div class="tab-content default-tab" id="tab2">
<form name="myForm" method="post" action="send.php">
<table class="inputan" cellpadding="3px" style="width:700px;">
<?php
if($_GET['nama']!="")
{?>
<tr>
      <td valign="top" width="100">Nama Penerima</td>
       <td valign="top"><h3>: <?php echo $_GET['nama']; ?></h3></td>
</tr>
<?php
}
?>
<tr>
  <td valign="top">Nomor</td>
  <td valign="top">
    <input name="nomor" id="nomor" type="text" size="20" value="<?php echo $data[0]; ?>" />
  </td>
</tr>
<tr>
   <th valign="top" >Isi Pesan</th>
   <td valign="top" align="left">
      <textarea name="pesan" wrap="physical" cols="28" rows="5"
             onKeyDown="textCounter(this,document.myForm.remLen1)"
             onKeyUp="textCounter(this,document.myForm.remLen1)">Baik Bapak/Ibu/Mbak/Mas <?php echo $data[1]; ?>. Terima kasih atas informasinya. Kami tunggu pemesanan berikutnya.</textarea>
    <input readonly type="text" name="remLen1" size="3" disabled maxlength="3" value="0">
   </td>
</tr>
<tr><td valign="top">&nbsp;</td><td valign="top"><input class="button" type="submit" value="Kirim"></td></tr>
</table>
</form>
            </div> <!-- End #tab2 -->  
      <div class="clear"></div> <!-- End .clear -->
                  <div class="clear"></div>
<?php
include("inc/footer.php");
?>
Modul Program 5.3.4 Halaman konfirmasi.terkirim
<?php
include("inc/m.i.s.c.php");
$query = file_get_contents('http://www.pesansaja.com/atur/tambahnamasms.php?no='.$_GET['no']);
sql_exec($query);
header("Location: inbox.php");
?>
Modul Program 5.3.5 Halaman get.namapelanggan
5.1.4 Tampilan Halaman Outbox

Gambar 4.4 Tampilan Halaman Outbox
<?php

include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur = "outbox";

include("inc/header.php");


$_SESSION['inboxbaru']=$inbox;
if($_SESSION['inboxbaru']>$_SESSION['inboxlama'])
{
?>
      <embed src="sms_tone.mp3" autostart="true">
<?php
$_SESSION['alertsms']="<font color='red'><b>Ada SMS Coy.. Segera dicek di <a href='inbox.php'>sini</a></b></font>";
}
if($_SESSION['inboxbaru']==$_SESSION['inboxlama'])
{
      $_SESSION['alertsms']="";
}

$_SESSION['inboxlama']=$_SESSION['inboxbaru'];


?>

<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Outbox SMS Service</h2>
                  <p id="page-intro">horeee</p>
                 
<?php
if($day==0)
{
      $query = "SELECT ID, SendingDateTime, DestinationNumber, TextDecoded FROM sentitems
                    WHERE CreatorID = 'Gammu' AND  DATE(SendingDateTime) = CURDATE()
                    ORDER BY SendingDateTime DESC";
}
else
{
      $query = "SELECT ID, SendingDateTime, DestinationNumber, TextDecoded FROM sentitems
                    WHERE CreatorID = 'Gammu' AND 
                    SendingDateTime BETWEEN  CURDATE() - INTERVAL ".($day)." DAY AND CURDATE() - INTERVAL ".($day-1)." DAY
                    ORDER BY SendingDateTime DESC";
}


$data = ambil_data($query);

if($_GET['day']!="")
{
      $tgl=ambil_data("SELECT CURDATE() - INTERVAL ".$_GET['day']." DAY");
      $tanggal = $tgl[0][0];
}
else
{
      $tanggal = date("Y-m-d");
}

?>
<br>
                  <!-- End .shortcut-buttons-set -->
                 
      <div class="clear"></div> <!-- End .clear -->
                 
                  <div class="content-box"><!-- Start Content Box -->
                       
                        <div class="content-box-header">
                             
                              <h3>Outbox Tanggal <?php echo $tanggal; ?></h3>                  
                             
                              <div class="clear"></div>
                             
                        </div> <!-- End .content-box-header -->
                       
                        <div class="content-box-content">
                             
                              <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->

                                <table>
                          <thead>
                              <tr>
                                    <tr>
                                        <td colspan="6">
                                            <div class="pagination">
                                                <?php
                                                for($i=0;$i<10;$i++)
                                                {
                                                    $tgl=ambil_data("SELECT CURDATE() - INTERVAL ".$i." DAY");
                                               
                                                    if($i==0)
                                                    {
                                                        echo '<a href="outbox.php" title="Hari Ini">Hari Ini</a>';
                                                    }
                                                    else
                                                    {
                                                        echo '<a href="outbox.php?day='.($i).'" class="number" title="'.$tgl[0][0].'">'.$tgl[0][0].'</a>';                                                                             
                                                    }
                                                }
                                                ?>
                                            </div>  <!-- End .pagination -->
                                            <div class="clear"></div>
                                        </td>
                                    </tr>
                                </tr>
                                                <tr bgcolor="#">                                              
                                   <th width="120">Waktu</th>
                                   <th width="150">nama / nomor HP</th>                                             
                                                   <th width="250">Isi Pesan</th>
                                                   <th width="80">Opsi</th>
                                            </tr>
                                      </thead>
                                          <tbody>
                                                <?php
                                                for($i=0;$i<sizeof($data);$i++)
                                                {
                                                $nama = GetNama2($data[$i][2]);
                                ?>
                                                <tr>
                                                      <td><?php echo $data[$i][1]; ?></td>
                                                      <td><?php echo GetNama($data[$i][2]); ?></td>
                                                      <td><?php echo $data[$i][3]; ?></td>
                                                      <td>
                                                            <!-- Icons -->
                                                             <a href="writesms.php?nohp=<?php echo str_replace("+62","0",$data[$i][2])?>&nama=<?php echo $nama; ?>" title="Replay SMS"><img src="resources/images/icons/reply.png" alt="Edit" /></a>                                                                                                                       
                                         <a href="do.doneoutbox.php?id=<?php echo $data[$i][0]; ?>&day=<?php echo $_GET['day']; ?>" onclick="return done();" title="Done"><img src="resources/images/icons/done-icon.gif" width="15" alt="Delete" /></a>
                                         <a href="deloutbox.php?id=<?php echo $data[$i][0]; ?>&day=<?php echo $_GET['day']; ?>" onclick="return del();" title="Delete"><img src="resources/images/icons/cross.png" alt="Reply" /></a>
                                                      </td>
                                                </tr>
                                                <?php
                                                }
                                                ?>
                                          </tbody>
                                         
                                    </table>
                                   
          </div> <!-- End #tab1 -->
                             
                               
                             
                        </div> <!-- End .content-box-content -->
                       
                  </div> <!-- End .content-box -->
                 
           

                  <div class="clear"></div>
                 
                                         
<?php
include("inc/footer.php");
?>           
Modul Program 5.4 Halaman outbox
<?php
include("inc/m.i.s.c.php");

sql_exec("DELETE FROM sentitems WHERE ID='".$_GET['id']."'");

header("Location: outbox.php?day=".$_GET['day']);

?>
                Modul Program 5.4.1 Halaman hapus outbox
<?php

include("inc/m.i.s.c.php");

// pesan asli
$pesan = "Pelanggan pesansaja.com yg terhormat,kami infokan bahwa ongkos kirim area Jogja sekitarnya Rp 6000 per 1 Mei 2013.Terima kasih. www.pesansaja.com";


$nomor = ambil_data("SELECT DISTINCT(pelanggan_notelp) FROM  pelanggan WHERE  pelanggan_notelp <>  ''");

for($no=0;$no<sizeof($nomor);$no++)
{
      $nohp = trim($nomor[$no][0]);
      // menghitung jumlah pecahan
      $jmlSMS = ceil(strlen($pesan)/153);
     
      // memecah pesan asli
      $pecah  = str_split($pesan, 153);
     
      // proses untuk mendapatkan ID record yang akan disisipkan ke tabel OUTBOX
      $query = "SHOW TABLE STATUS LIKE 'outbox'";
      $hasil = mysql_query($query);
      $data  = mysql_fetch_array($hasil);
      $newID = $data['Auto_increment'];
     
      // proses penyimpanan ke tabel mysql untuk setiap pecahan
      for ($i=1; $i<=$jmlSMS; $i++)
      {
         // membuat UDH untuk setiap pecahan, sesuai urutannya
         $udh = "050003A7".sprintf("%02s", $jmlSMS).sprintf("%02s", $i);
     
         // membaca text setiap pecahan
         $msg = $pecah[$i-1];
     
         if ($i == 1)
         {
              // jika merupakan pecahan pertama, maka masukkan ke tabel OUTBOX
              $query = "INSERT INTO outbox (DestinationNumber, UDH, TextDecoded, ID, MultiPart, CreatorID)
                              VALUES ('".$nohp."', '".$udh."', '".$msg."', '".$newID."', 'true', 'Gammu')";
         }
         else
         {
              // jika bukan merupakan pecahan pertama, simpan ke tabel OUTBOX_MULTIPART
              $query = "INSERT INTO outbox_multipart(UDH, TextDecoded, ID, SequencePosition)
                              VALUES ('".$udh."', '".$msg."', '".$newID."', '".$i."')";
         }
        
         echo $query."<br>";
     
         // jalankan query
         sql_exec($query);
        
      }
}

?>
Modul Program 5.4.2 Halaman baca outbox




5.1.5 Tampilan Halaman Inbox

Gambar 4.5 Tampilan Halaman Inbox
<?php

include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur = "inbox";

include("inc/header.php");


$_SESSION['inboxbaru']=$inbox;
if($_SESSION['inboxbaru']>$_SESSION['inboxlama'])
{
?>
      <embed src="sms_tone.mp3" autostart="true">
<?php
$_SESSION['alertsms']="<font color='red'><b>Ada SMS Coy.. Segera dicek di <a href='inbox.php'>sini</a></b></font>";
}
if($_SESSION['inboxbaru']==$_SESSION['inboxlama'])
{
      $_SESSION['alertsms']="";
}

$_SESSION['inboxlama']=$_SESSION['inboxbaru'];


?>

<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Pesansaja SMS Service</h2>
                  <p id="page-intro">horeee</p>
                 
<p>

</p>

<?php
if($day==0)
{
      $query = "SELECT ID, ReceivingDateTime, SenderNumber, TextDecoded FROM inbox
                    WHERE Processed = 'false' AND  DATE(ReceivingDateTime) = CURDATE()
                    ORDER BY ReceivingDateTime DESC";
}
else
{
      $query = "SELECT ID, ReceivingDateTime, SenderNumber, TextDecoded FROM inbox
                    WHERE Processed = 'false' AND 
                    ReceivingDateTime BETWEEN  CURDATE() - INTERVAL ".($day)." DAY AND CURDATE() - INTERVAL ".($day-1)." DAY
                    ORDER BY ReceivingDateTime DESC";
}


$data = ambil_data($query);

if($_GET['day']!="")
{
      $tgl=ambil_data("SELECT CURDATE() - INTERVAL ".$_GET['day']." DAY");
      $tanggal = $tgl[0][0];
}
else
{
      $tanggal = date("Y-m-d");
}

?>
<br>
                  <!-- End .shortcut-buttons-set -->
                 
      <div class="clear"></div> <!-- End .clear -->
                 
                  <div class="content-box"><!-- Start Content Box -->
                       
                        <div class="content-box-header">
                             
                              <h3>Inbox Tanggal <?php echo $tanggal; ?></h3>                   
                             
                              <div class="clear"></div>
                             
                        </div> <!-- End .content-box-header -->
                       
                        <div class="content-box-content">
                             
                              <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->

                                <table>
                                         
                                    <thead>
                                          <tr>
                                                <tr>
                                                      <td colspan="6">
                                                            <div class="pagination">
                                            <?php
                                                                  for($i=0;$i<10;$i++)
                                                                  {
                                                                        $tgl=ambil_data("SELECT CURDATE() - INTERVAL ".$i." DAY");
                                                                 
                                                                        if($i==0)
                                                                        {
                                                                              echo '<a href="inbox.php" title="Hari Ini">Hari Ini</a>';
                                                                        }
                                                                        else
                                                                        {
                                                           
                  echo '<a href="inbox.php?day='.($i).'" class="number" title="'.$tgl[0][0].'">'.$tgl[0][0].'</a>';                                                                            
                                                                        }
                                                                  }
                                                                  ?>
                                                            </div> <!-- End .pagination -->
                                                            <div class="clear"></div>
                                                      </td>
                                                </tr>
                                          </tr>                       
                                                <tr bgcolor="#">                                              
                                   <th width="120">Waktu</th>
                                   <th width="150">nama / nomor HP</th>                                             
                                                   <th width="250">Isi Pesan</th>
                                                   <th width="80">Opsi</th>
                                            </tr>
                                               
                                      </thead>
                                          <tbody>
                                                <?php
                                                for($i=0;$i<sizeof($data);$i++)
                                                {
                                                $nama = GetNama2($data[$i][2]);
                                ?>
                                                <tr>
                                                      <td><?php echo $data[$i][1]; ?></td>
                                                      <td><?php echo GetNama($data[$i][2]); ?></td>
                                                      <td><?php echo $data[$i][3]; ?></td>
                                                      <td>
                                                            <!-- Icons -->
                                                             <a href="writesms.php?nohp=<?php echo str_replace("+62","0",$data[$i][2])?>&nama=<?php echo $nama; ?>" title="Replay SMS"><img src="resources/images/icons/reply.png" alt="Edit" /></a>                                                                                                                       
                                         <a href="do.doneinbox.php?id=<?php echo $data[$i][0]; ?>&day=<?php echo $_GET['day']; ?>" onclick="return done();" title="Done"><img src="resources/images/icons/done-icon.gif" width="15" alt="Delete" /></a>
                                         <a href="delinbox.php?id=<?php echo $data[$i][0]; ?>&day=<?php echo $_GET['day']; ?>" onclick="return del();" title="Delete"><img src="resources/images/icons/cross.png" alt="Reply" /></a>
                                                      </td>
                                                </tr>
                                                <?php
                                                }
                                                ?>
                                          </tbody>
                                         
                                    </table>
                                   
          </div> <!-- End #tab1 -->
                             
                               
                             
                        </div> <!-- End .content-box-content -->
                       
                  </div> <!-- End .content-box -->
                 
           

                  <div class="clear"></div>
                 
                             
           
<?php
include("inc/footer.php");
?>           
Modul Program 5.5 Halaman inbox
<?php
include("inc/m.i.s.c.php");

sql_exec("DELETE FROM inbox WHERE ID='".$_GET['id']."'");

header("Location: inbox.php?day=".$_GET['day']);

?>
Modul Program 5.5.1 Halaman hapus inbox
5.1.6 Tampilan Halaman Done Outbox
Gambar 4.6 Tampilan Halaman Done Outbox
<?php

include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur = "doneoutbox";

include("inc/header.php");


$_SESSION['inboxbaru']=$inbox;
if($_SESSION['inboxbaru']>$_SESSION['inboxlama'])
{
?>
      <embed src="sms_tone.mp3" autostart="true">
<?php
$_SESSION['alertsms']="<font color='red'><b>Ada SMS Coy.. Segera dicek di <a href='inbox.php'>sini</a></b></font>";
}
if($_SESSION['inboxbaru']==$_SESSION['inboxlama'])
{
      $_SESSION['alertsms']="";
}

$_SESSION['inboxlama']=$_SESSION['inboxbaru'];


?>

<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Done Outbox SMS Service</h2>
                  <p id="page-intro">horeee</p>
                 
<?php
if($day==0)
{
      $query = "SELECT ID, SendingDateTime, DestinationNumber, TextDecoded FROM sentitems
                    WHERE CreatorID = 'oke' AND  DATE(SendingDateTime) = CURDATE()
                    ORDER BY SendingDateTime DESC";
}
else
{
      $query = "SELECT ID, SendingDateTime, DestinationNumber, TextDecoded FROM sentitems
                    WHERE CreatorID = 'oke' AND 
                    SendingDateTime BETWEEN  CURDATE() - INTERVAL ".($day)." DAY AND CURDATE() - INTERVAL ".($day-1)." DAY
                    ORDER BY SendingDateTime DESC";
}


$data = ambil_data($query);
?>
<br>
                  <!-- End .shortcut-buttons-set -->
                 
      <div class="clear"></div> <!-- End .clear -->
                 
                  <div class="content-box"><!-- Start Content Box -->
                       
                        <div class="content-box-header">
                             
                              <h3>Inbox</h3>                     
                             
                              <div class="clear"></div>
                             
                        </div> <!-- End .content-box-header -->
                       
                        <div class="content-box-content">
                             
                              <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->

                                <table>
                                          <thead>
                                <tr>
                                    <tr>
                                        <td colspan="6">
                                            <div class="pagination">
                                                <?php
                                                for($i=0;$i<10;$i++)
                                                {
                                                    $tgl=ambil_data("SELECT CURDATE() - INTERVAL ".$i." DAY");
                                               
                                                    if($i==0)
                                                    {
                                                        echo '<a href="doneoutbox.php" title="Hari Ini">Hari Ini</a>';
                                                    }
                                                    else
                                                   
{

                                                        echo '<a href="doneoutbox.php?day='.($i).'" class="number" title="'.$tgl[0][0].'">'.$tgl[0][0].'</a>';                                                                             
                                                    }
                                                }
                                                ?>
                                            </div> <!-- End .pagination -->
                                            <div class="clear"></div>
                                        </td>
                                    </tr>
                                </tr>                           
                                                <tr bgcolor="#">                                              
                                   <th width="120">Waktu</th>
                                   <th width="150">nama / nomor HP</th>                                             
                                                   <th width="250">Isi Pesan</th>
                                                   <th width="80">Opsi</th>
                                            </tr>
                                      </thead>
                                          <tbody>
                                                <?php
                                                for($i=0;$i<sizeof($data);$i++)
                                                {
                                ?>
                                                <tr>
                                                      <td><?php echo $data[$i][1]; ?></td>
                                                      <td><?php echo GetNama($data[$i][2]); ?></td>
                                                      <td><?php echo $data[$i][3]; ?></td>
                                                      <td>
                                                            <!-- Icons -->
                                                             <a href="writesms.php?nohp=<?php echo str_replace("+62","0",$data[$i][2])?>&nama=<?php echo $nama; ?>" title="Replay SMS"><img src="resources/images/icons/reply.png" alt="Edit" /></a>
                                                             <a href="deldoneoutbox.php?id=<?php echo $data[$i][0]; ?>&day=<?php echo $_GET['day']; ?>" onclick="return del();" title="Delete"><img src="resources/images/icons/cross.png" alt="Reply" /></a>
                                                      </td>
                                                </tr>
                                                <?php
                                                }
                                                ?>
                                          </tbody>
                                         
                                    </table>
                                   
          </div> <!-- End #tab1 -->
                             
                               
                             
                        </div> <!-- End .content-box-content -->
                       
                  </div> <!-- End .content-box -->
                 
           

                  <div class="clear"></div>
                 
                             
           
<?php
include("inc/footer.php");
?>      
     Modul Program 5.6 Halaman done outbox
<?php
include("inc/m.i.s.c.php");

sql_exec("DELETE FROM sentitems WHERE ID='".$_GET['id']."'");

header("Location: doneoutbox.php?day=".$_GET['day']);

?>
Modul Program 5.6.1 Halaman hapus done outbox
<?php
include("inc/m.i.s.c.php");

sql_exec("UPDATE sentitems SET CreatorID = 'oke' WHERE ID='".$_GET['id']."'");

header("Location: outbox.php?day=".$_GET['day']);

?>
Modul Program 5.6.2 Halaman update done outbox
5.1.7 Tampilan Halaman Done Inbox

Gambar 4.7 Tampilan Halaman Done Inbox

<?php

include("inc/m.i.s.c.php");
include("inc/function.php");
$inbox = CountInbox();
$day=0;
$day=$day+$_GET['day'];

$cur = "doneinbox";

include("inc/header.php");


$_SESSION['inboxbaru']=$inbox;
if($_SESSION['inboxbaru']>$_SESSION['inboxlama'])
{
?>
      <embed src="sms_tone.mp3" autostart="true">
<?php
$_SESSION['alertsms']="<font color='red'><b>Ada SMS Coy.. Segera dicek di <a href='inbox.php'>sini</a></b></font>";
}
if($_SESSION['inboxbaru']==$_SESSION['inboxlama'])
{
      $_SESSION['alertsms']="";
}

$_SESSION['inboxlama']=$_SESSION['inboxbaru'];


?>

<div id="main-content"> <!-- Main Content Section with everything -->
                 
                  <noscript> <!-- Show a notification if the user has disabled javascript -->
          </noscript>
                 
                  <!-- Page Head -->
                  <h2>Done Outbox SMS Service</h2>
                  <p id="page-intro">horeee</p>
                 
<?php
if($day==0)
{
      $query = "SELECT ID, ReceivingDateTime, SenderNumber, TextDecoded FROM inbox
                    WHERE Processed = 'true' AND  DATE(ReceivingDateTime) = CURDATE()
                    ORDER BY ReceivingDateTime DESC";
}
else
{
      $query = "SELECT ID, ReceivingDateTime, SenderNumber, TextDecoded FROM inbox
                    WHERE Processed = 'true' AND 
                    ReceivingDateTime BETWEEN  CURDATE() - INTERVAL ".($day)." DAY AND CURDATE() - INTERVAL ".($day-1)." DAY
                    ORDER BY ReceivingDateTime DESC";
}


$data = ambil_data($query);
?>
<br>
                  <!-- End .shortcut-buttons-set -->
                 
      <div class="clear"></div> <!-- End .clear -->
                 
                  <div class="content-box"><!-- Start Content Box -->
                       
                        <div class="content-box-header">
                             
                              <h3>Inbox</h3>                     
                             
                              <div class="clear"></div>
                             
                        </div> <!-- End .content-box-header -->
                       
                        <div class="content-box-content">
                             
                              <div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->

                                <table>
                          <thead>
                              <tr>
                                    <tr>
                                        <td colspan="6">
                                            <div class="pagination">
                                                <?php
                                                for($i=0;$i<10;$i++)
                                                {
                                                    $tgl=ambil_data("SELECT CURDATE() - INTERVAL ".$i." DAY");
                                               
                                                    if($i==0)
                                                    {
                                                        echo '<a href="doneinbox.php" title="Hari Ini">Hari Ini</a>';
                                                    }
                                                    else
                                                    {
                                                        echo '<a href="doneinbox.php?day='.($i).'" class="number" title="'.$tgl[0][0].'">'.$tgl[0][0].'</a>';                                                                             
                                                    }
                                                }
                                                ?>
                                            </div> <!-- End .pagination -->
                                            <div class="clear"></div>
                                        </td>
                                    </tr>
                                </tr>
                                                <tr bgcolor="#">                                              
                                   <th width="120">Waktu</th>
                                   <th width="150">nama / nomor HP</th>                                             
                                                   <th width="250">Isi Pesan</th>
                                                   <th width="80">Opsi</th>
                                            </tr>
                                      </thead>
                                          <tbody>
                                                <?php
                                                for($i=0;$i<sizeof($data);$i++)
                                                {
                                ?>
                                                <tr>
                                                      <td><?php echo $data[$i][1]; ?></td>
                                                      <td><?php echo GetNama($data[$i][2]); ?></td>
                                                      <td><?php echo $data[$i][3]; ?></td>
                                                      <td>
                                                            <!-- Icons -->
                                                             <a href="writesms.php?nohp=<?php echo str_replace("+62","0",$data[$i][2])?>&nama=<?php echo $nama; ?>" title="Replay SMS"><img src="resources/images/icons/reply.png" alt="Edit" /></a>
                                                             <a href="deldoneinbox.php?id=<?php echo $data[$i][0]; ?>&day=<?php echo $_GET['day']; ?>" onclick="return del();" title="Delete"><img src="resources/images/icons/cross.png" alt="Reply" /></a>
                                                      </td>
                                                </tr>
                                                <?php
                                                }
                                                ?>
                                          </tbody>
                                         
                                    </table>
                                   
          </div> <!-- End #tab1 -->
                             
                               
                             
                        </div> <!-- End .content-box-content -->
                       
                  </div> <!-- End .content-box -->
                 
           

                  <div class="clear"></div>
                 
                             
            
<?php
include("inc/footer.php");
?>           
Modul Program 5.7 Halaman done inbox
<?php
include("inc/m.i.s.c.php");

sql_exec("DELETE FROM inbox WHERE ID='".$_GET['id']."'");

header("Location: doneinbox.php?day=".$_GET['day']);

?>
Modul Program 5.7.1 Halaman hapus done inbox
<?php
include("inc/m.i.s.c.php");

sql_exec("UPDATE inbox SET Processed = 'true' WHERE ID='".$_GET['id']."'");


header("Location: inbox.php?day=".$_GET['day']);

?>
Modul Program 5.7.2 Halaman update done inbox


















5.1.8 Tampilan Halaman Addressbook


Gambar 4.8 Tampilan Halaman Addressbook
<?php
session_start();
include("inc/m.i.s.c.php");
include("inc/function.php");
?>
<html>
<head>
<title>
SMS CS pesansaja.com
</title>
<?php
if($_POST)
{
      if($_POST['jenis_data']==1)
      {
            sql_exec("INSERT INTO pelanggan VALUES ('', '".$_POST['nama']."', '', '".$_POST['nomor']."', '".$_POST['keterangan']."', '', '', '1', '', '', '')");
      }
      elseif($_POST['jenis_data']==2)
      {
            sql_exec("INSERT INTO addressbook_penting VALUES ('', '".$_POST['nomor']."','".$_POST['nama']."','".$_POST['keterangan']."', '1')");
      }
}

if($_GET['q'])
{
      if($_GET['jenis_data']==1)
      {
            $data = ambil_data("SELECT pelanggan_notelp, pelanggan_nama FROM pelanggan WHERE pelanggan_nama LIKE '%".$_GET['q']."%'");
      }
      elseif($_GET['jenis_data']==2)
      {
            $data = ambil_data("SELECT addressbook_penting_nomor, addressbook_penting_nama FROM addressbook_penting WHERE addressbook_penting_nama LIKE '%".$_GET['q']."%'");
      }
}
?>
</head>
<body>
<br>
<br>
<br>
<center>
Addressbook pesansaja.com
<h2><input type="button" value="Reload Inbox" onClick="window.location.reload()"> <h2><a href="index.php">KIRIM SMS</a> <a href="#" onClick="KirimKonfirmasi()">KIRIM KONFIRMASI</a></h2>
<br>
</h2>
<br>
<a href="inbox.php">Inbox</a> <a href="outbox.php">Outbox</a> <a href="doneoutbox.php">Done Outbox</a> <a href="doneinbox.php">Done Inbox</a>
<br>
<br>

<?php
if($_GET)
{
?>
<table>
      <?php
      for($i=0;$i<sizeof($data);$i++)
      {
      ?>
      <tr><td><font size="+4"><?php echo $data[$i][0]; ?></font></td></tr>
      <tr><td><font size="+1"><?php echo $data[$i][1]; ?></font>
    <br>
    <hr></td></tr>
      <?php
      }
?>
</table>
<?php
}
?>
</table>

<hr>
         
<form id="form2" action="" method="get" enctype="multipart/form-data">    
<table>
<tr>
<td colspan="2">
      <b>Pencarian Nomor</b>
</td>
</tr>              
<tr>
<td>Nama </td><td>: <input name="q" style="width:200px;" value="" type="text" tabindex="1" /></td>
</tr>
<tr>
<td>Jenis</td><td><label><input type="radio" checked name="jenis_data" value="1">Pelanggan</label> <label><input type="radio" name="jenis_data" value="2">Nomor Penting/Gerai</label></td>
</tr>
<td colspan="2">
      <input id="button1" type="submit" value="Cari Nomor" />
</td>
</form>
</table>

<hr>

<table>
<form name="upload-kota" id="form" method="post" action="" enctype="multipart/form-data">
<tr>
<td colspan="2">
      <b>Simpan Nomor</b>
</td>
</tr>
<tr>
<td>Nomor </td><td>: <input type="text" name="nomor" /></td>
</tr>
<tr>
<td>Nama </td><td>: <input type="text" name="nama" /></td>
</tr>
<tr>
<td>Keterangan </td><td>: <textarea name="keterangan"></textarea></td>
</tr>
<td>Jenis</td><td><label><input type="radio" checked name="jenis_data" value="1">Pelanggan</label> <label><input type="radio" name="jenis_data" value="2">Nomor Penting/Gerai</label></td>
</tr>
<td colspan="2">
      <input id="button1" type="submit" name="input" value="Simpan">
</td>
</table>
</form>
</center>
</body>
</html>
Modul Program 5.8 Halaman addressBook
5.1.9 Tampilan Halaman Web pesansaja.com

Gambar 4.9 Tampilan Halaman Web pesansaja.com
5.1.10 Tampilan Halaman Setting GAMMU
<?php include "menu2.php"; ?>

<h2>Langkah 1 - Setting GAMMURC</h2>

<?php
$handle = @fopen("gammurc", "r");
$baris = array();
$i = 1;
$j = 1;
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               if ($i == 1)
               {
                  $split = explode("port = ", $buffer);
                  $port1 = str_replace(":", "", $split[1]);
               }
              
               if ($i == 2)
               {
                  $split = explode("port = ", $buffer);
                  $port2 = str_replace(":", "", $split[1]);
               }
              
               if ($i == 3)
               {
                  $split = explode("port = ", $buffer);
                  $port3 = str_replace(":", "", $split[1]);
               }
              
               if ($i == 4)
               {
                  $split = explode("port = ", $buffer);
                  $port4 = str_replace(":", "", $split[1]);
               }
              
               $i++;
            }
           
            if (substr_count($buffer, 'connection = ') > 0)
            {
               if ($j == 1)
               {
                  $split = explode("connection = ", $buffer);
                  $connection1 = $split[1];
               }
              
               if ($j == 2)
               {
                  $split = explode("connection = ", $buffer);
                  $connection2 = $split[1];
               }
              
               if ($j == 3)
               {
                  $split = explode("connection = ", $buffer);
                  $connection3 = $split[1];
               }
              
               if ($j == 4)
               {
                  $split = explode("connection = ", $buffer);
                  $connection4 = $split[1];
               }
              
               $j++;
            }
           
            $baris[] = $buffer;
    }
    fclose($handle);
}

if ($_GET['op'] == "simpan")
{
  $port1 = $_POST['port1'];
  $connection1 = $_POST['connection1'];
 
  $port2 = $_POST['port2'];
  $connection2 = $_POST['connection2'];

  $port3 = $_POST['port3'];
  $connection3 = $_POST['connection3'];

  $port4 = $_POST['port4'];
  $connection4 = $_POST['connection4']; 
 
  $handle = @fopen("gammurc", "w");

  $text = "[gammu]\nport = ".$port1.":\nconnection = ".$connection1."\n[gammu1]\nport = ".$port2.":\nconnection = ".$connection2."\n[gammu2]\nport = ".$port3.":\nconnection = ".$connection3."\n[gammu3]\nport = ".$port4.":\nconnection = ".$connection4;
 
  fwrite($handle, $text);
  fclose($handle);
  echo "<p>Konfigurasi GAMMURC sudah disimpan</p>"; 
}

?>

<p>Masukkan nomor port dan jenis connection pada form di bawah ini!</p>

<p><b>Modem/HP 1</b></p>

<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>?op=simpan">
<table>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port1" value="<?php echo $port1;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection1" value="<?php echo $connection1;?>"></td></tr>
</table>

<p><b>Modem/HP 2</b></p>

<table>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port2" value="<?php echo $port2;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection2" value="<?php echo $connection2;?>"></td></tr>
</table>

<p><b>Modem/HP 3</b></p>

<table>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port3" value="<?php echo $port3;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection3" value="<?php echo $connection3;?>"></td></tr>
</table>

<p><b>Modem/HP 4</b></p>

<table>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port4" value="<?php echo $port4;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection4" value="<?php echo $connection4;?>"></td></tr>
</table>

<input type="submit" name="submit" value="Simpan">
</form>

<a href="connection.xls">Lihat Jenis Connection</a>
Modul Program 5.9 Halaman Step1
<html>
<head>
  <title>Fungsi terbilang</title>
</head>
<body>
<form action="terbilang.php" method="post">
        Masukkan angka: <input type="text" value="" name="angka">
    <input type="submit" value="Send">
</form>
<pre>
<?php
$angka = isset($_POST['angka']) ? $_POST['angka'] : "0";
if ($angka)
{
        echo number_format($angka, 0) . "<br>";
        echo ucwords(Terbilang($angka));
}
?>
</pre>
</body>
</html>
<?php

function Terbilang($x)
{
  $abil = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
  if ($x < 12)
    return " " . $abil[$x];
  elseif ($x < 20)
    return Terbilang($x - 10) . "belas";
  elseif ($x < 100)
    return Terbilang($x / 10) . " puluh" . Terbilang($x % 10);
  elseif ($x < 200)
    return " seratus" . Terbilang($x - 100);
  elseif ($x < 1000)
    return Terbilang($x / 100) . " ratus" . Terbilang($x % 100);
  elseif ($x < 2000)
    return " seribu" . Terbilang($x - 1000);
  elseif ($x < 1000000)
    return Terbilang($x / 1000) . " ribu" . Terbilang($x % 1000);
  elseif ($x < 1000000000)
    return Terbilang($x / 1000000) . " juta" . Terbilang($x % 1000000);
}

?>
Modul Program 5.10 Halaman Step2
<html>
<head>
  <title>Fungsi terbilang</title>
</head>
<body>
<form action="terbilang.php" method="post">
        Masukkan angka: <input type="text" value="" name="angka">
    <input type="submit" value="Send">
</form>
<pre>
<?php
$angka = isset($_POST['angka']) ? $_POST['angka'] : "0";
if ($angka)
{
        echo number_format($angka, 0) . "<br>";
        echo ucwords(Terbilang($angka));
}
?>
</pre>
</body>
</html>
<?php

function Terbilang($x)
{
  $abil = array("", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
  if ($x < 12)
    return " " . $abil[$x];
  elseif ($x < 20)
    return Terbilang($x - 10) . "belas";
  elseif ($x < 100)
    return Terbilang($x / 10) . " puluh" . Terbilang($x % 10);
  elseif ($x < 200)
    return " seratus" . Terbilang($x - 100);
  elseif ($x < 1000)
    return Terbilang($x / 100) . " ratus" . Terbilang($x % 100);
  elseif ($x < 2000)
    return " seribu" . Terbilang($x - 1000);
  elseif ($x < 1000000)
    return Terbilang($x / 1000) . " ribu" . Terbilang($x % 1000);
  elseif ($x < 1000000000)
    return Terbilang($x / 1000000) . " juta" . Terbilang($x % 1000000);
}

?>
Modul Program 5.11 Halaman Step3
<?php include "menu2.php"; ?>

<h2>Langkah 4 - Setting Konfigurasi SMSDRC</h2>

<?php
$handle = @fopen("smsdrc1", "r");
$baris = array();
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port1 = str_replace(":", "", $split[1]);
            }
           
            if (substr_count($buffer, 'connection = ') > 0)
            {
               $split = explode("connection = ", $buffer);
               $connection1 = $split[1];
            }

            if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id1 = $split[1];
            }          

            if (substr_count($buffer, 'user = ') > 0)
            {
               $split = explode("user = ", $buffer);
               $user = $split[1];
            }

            if (substr_count($buffer, 'password = ') > 0)
            {
               $split = explode("password = ", $buffer);
               $pass = $split[1];
            }

            if (substr_count($buffer, 'database = ') > 0)
            {
               $split = explode("database = ", $buffer);
               $db = $split[1];
            }
           
            $baris[] = $buffer;
    }
    fclose($handle);
}

$handle = @fopen("smsdrc2", "r");
$baris = array();
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port2 = str_replace(":", "", $split[1]);
            }
           
            if (substr_count($buffer, 'connection = ') > 0)
            {
               $split = explode("connection = ", $buffer);
               $connection2 = $split[1];
            }

            if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id2 = $split[1];
            }
           
            $baris[] = $buffer;
    }
    fclose($handle);
}

$handle = @fopen("smsdrc3", "r");
$baris = array();
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port3 = str_replace(":", "", $split[1]);
            }
           
            if (substr_count($buffer, 'connection = ') > 0)
            {
               $split = explode("connection = ", $buffer);
               $connection3 = $split[1];
            }

            if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id3 = $split[1];
            }
           
            $baris[] = $buffer;
    }
    fclose($handle);
}

$handle = @fopen("smsdrc4", "r");
$baris = array();
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port4 = str_replace(":", "", $split[1]);
            }
           
            if (substr_count($buffer, 'connection = ') > 0)
            {
               $split = explode("connection = ", $buffer);
               $connection4 = $split[1];
            }          
           
            if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id4 = $split[1];
            }
           
            $baris[] = $buffer;
    }
    fclose($handle);
}

if ($_GET['op'] == "simpan")
{
  $port1 = $_POST['port1'];
  $connection1 = $_POST['connection1'];
  $id1 = $_POST['id1']; 
  $port2 = $_POST['port2'];
  $connection2 = $_POST['connection2'];
  $id2 = $_POST['id2'];
  $port3 = $_POST['port3'];
  $connection3 = $_POST['connection3'];
  $id3 = $_POST['id3'];
  $port4 = $_POST['port4'];
  $connection4 = $_POST['connection4'];
  $id4 = $_POST['id4'];
 
  $user = $_POST['user'];
  $pass = $_POST['pass'];
 
  $db = $_POST['db']; 
 
  $handle = @fopen("smsdrc1", "w");
  $text = "[gammu]
# isikan no port di bawah ini
port = ".$port1.":
# isikan jenis connection di bawah ini
connection = ".$connection1."

[smsd]
service = mysql
logfile = smsdlog
debuglevel = 0
phoneid = ".$id1."
commtimeout = 30
sendtimeout = 30
PIN = 1234

# -----------------------------
# Konfigurasi koneksi ke MySQL
# -----------------------------
pc = localhost

# isikan user untuk akses ke MySQL
user = ".$user."
# isikan password user untuk akses ke MySQL
password = ".$pass."
# isikan nama database untuk Gammu
database = ".$db."\n";

  fwrite($handle, $text);
  fclose($handle);

  $handle = @fopen("smsdrc2", "w");
  $text = "[gammu]
# isikan no port di bawah ini
port = ".$port2.":
# isikan jenis connection di bawah ini
connection = ".$connection2."

[smsd]
service = mysql
logfile = smsdlog
debuglevel = 0
phoneid = ".$id2."
commtimeout = 30
sendtimeout = 30
PIN = 1234

# -----------------------------
# Konfigurasi koneksi ke MySQL
# -----------------------------
pc = localhost

# isikan user untuk akses ke MySQL
user = ".$user."
# isikan password user untuk akses ke MySQL
password = ".$pass."
# isikan nama database untuk Gammu
database = ".$db."\n"; 
  fwrite($handle, $text);
  fclose($handle);

  $handle = @fopen("smsdrc3", "w");
  $text = "[gammu]
# isikan no port di bawah ini
port = ".$port3.":
# isikan jenis connection di bawah ini
connection = ".$connection3."

[smsd]
service = mysql
logfile = smsdlog
debuglevel = 0
phoneid = ".$id3."
commtimeout = 30
sendtimeout = 30
PIN = 1234

# -----------------------------
# Konfigurasi koneksi ke MySQL
# -----------------------------
pc = localhost

# isikan user untuk akses ke MySQL
user = ".$user."
# isikan password user untuk akses ke MySQL
password = ".$pass."
# isikan nama database untuk Gammu
database = ".$db."\n"; 
  fwrite($handle, $text);
  fclose($handle);

  $handle = @fopen("smsdrc4", "w");
  $text = "[gammu]
# isikan no port di bawah ini
port = ".$port4.":
# isikan jenis connection di bawah ini
connection = ".$connection4."

[smsd]
service = mysql
logfile = smsdlog
debuglevel = 0
phoneid = ".$id4."
commtimeout = 30
sendtimeout = 30
PIN = 1234

# -----------------------------
# Konfigurasi koneksi ke MySQL
# -----------------------------
pc = localhost

# isikan user untuk akses ke MySQL
user = ".$user."
# isikan password user untuk akses ke MySQL
password = ".$pass."
# isikan nama database untuk Gammu
database = ".$db."\n"; 
  fwrite($handle, $text);
  fclose($handle); 
 
echo "<p>Konfigurasi SMSDRC sudah disimpan</p>";
}
?>
<p>Masukkan konfigurasi SMSDRC berikut ini!</p>

<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>?op=simpan">
<table>
 <tr><td>USERNAME (MySQL)</td><td>:</td><td><input type="text" name="user" value="<?php echo $user;?>"></td></tr>
 <tr><td>PASSWORD (MySQL)</td><td>:</td><td><input type="text" name="pass" value="<?php echo $pass;?>"></td></tr>
 <tr><td>DATABASE NAME GAMMU YANG TELAH DIBUAT SEBELUMNYA (LANGKAH 3)</td><td>:</td><td><input type="text" name="db" value="<?php echo $db;?>"></td></tr>
</table>

<p><b>Modem/HP 1</b></p>

<table>
 <tr><td>ID PHONE</td><td>:</td><td><input type="text" name="id1" value="<?php echo $id1;?>"></td></tr>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port1" value="<?php echo $port1;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection1" value="<?php echo $connection1;?>"></td></tr>
</table>

<p><b>Modem/HP 2</b></p>

<table>
 <tr><td>ID PHONE</td><td>:</td><td><input type="text" name="id2" value="<?php echo $id2;?>"></td></tr>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port2" value="<?php echo $port2;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection2" value="<?php echo $connection2;?>"></td></tr>
</table>

<p><b>Modem/HP 3</b></p>

<table>
 <tr><td>ID PHONE</td><td>:</td><td><input type="text" name="id3" value="<?php echo $id3;?>"></td></tr>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port3" value="<?php echo $port3;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection3" value="<?php echo $connection3;?>"></td></tr>
</table>

<p><b>Modem/HP 4</b></p>

<table>
 <tr><td>ID PHONE</td><td>:</td><td><input type="text" name="id4" value="<?php echo $id4;?>"></td></tr>
 <tr><td>PORT</td><td>:</td><td><input type="text" name="port4" value="<?php echo $port4;?>"></td></tr>
 <tr><td>CONNECTION</td><td>:</td><td><input type="text" name="connection4" value="<?php echo $connection4;?>"></td></tr>
</table>
<br>
<input type="submit" name="submit" value="Simpan">
</form>
Modul Program 5.12 Halaman Step4
<?php include "menu2.php"; ?>

<h2>Langkah 5 - Membuat Service GAMMU</h2>

<p>Klik tombol di bawah ini untuk membuat GAMMU Service!</p>

<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="submit" name="submit" value="INSTALL SERVICE GAMMU"></td></tr>
</form>

<?php
  if ($_POST['submit'])
  {
   echo "<b>Status :</b><br>";
   echo "<pre>";
   passthru("gammu-smsd -n phone1 -k", $hasil);
   passthru("gammu-smsd -n phone2 -k", $hasil);
   passthru("gammu-smsd -n phone3 -k", $hasil);
   passthru("gammu-smsd -n phone4 -k", $hasil);  
   passthru("gammu-smsd -n phone1 -u", $hasil);
   passthru("gammu-smsd -n phone2 -u", $hasil);
   passthru("gammu-smsd -n phone3 -u", $hasil);
   passthru("gammu-smsd -n phone4 -u", $hasil);

   $handle = @fopen("smsdrc1", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port1 = str_replace(":", " ", $split[1]);
            }
   } 
   if ($port1 != "\r\n") passthru("gammu-smsd -c smsdrc1 -n phone1 -i", $hasil);
   fclose($handle);

   $handle = @fopen("smsdrc2", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port2 = str_replace(":", "", $split[1]);
            }
   }
   if ($port2 != "\r\n") passthru("gammu-smsd -c smsdrc2 -n phone2 -i", $hasil);
   fclose($handle);
  
   $handle = @fopen("smsdrc3", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port3 = str_replace(":", "", $split[1]);
            }
   } 
   if ($port3 != "\r\n") passthru("gammu-smsd -c smsdrc3 -n phone3 -i", $hasil);
   fclose($handle);
  
   $handle = @fopen("smsdrc4", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'port = ') > 0)
            {
               $split = explode("port = ", $buffer);
               $port4 = str_replace(":", "", $split[1]);
            }
   } 
   if ($port4 != "\r\n") passthru("gammu-smsd -c smsdrc4 -n phone4 -i", $hasil);
   fclose($handle);
  
   echo "</pre>";
  }
?>
Modul Program 5.13 Halaman Step5
<?php include "menu2.php"; ?>

<h2>Langkah 6 - Menjalankan Service GAMMU</h2>

<p>Klik tombol di bawah ini untuk menjalankan GAMMU Service!</p>

<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="submit" name="submit" value="JALANKAN SERVICE GAMMU"></td></tr>
</form>

<?php
  if ($_POST['submit'])
  {
   echo "<b>Status :</b><br>";
   echo "<pre>";
   passthru("gammu-smsd -c smsdrc1 -n phone1 -s");
   passthru("gammu-smsd -c smsdrc2 -n phone2 -s");
   passthru("gammu-smsd -c smsdrc3 -n phone3 -s");
   passthru("gammu-smsd -c smsdrc4 -n phone4 -s");  
   echo "</pre>";
  }
?>
Modul Program 5.14 Halaman Step6
<?php include "menu2.php"; include "function.php"; ?>

<h2>Langkah 7 - Test Mengirim SMS</h2>


<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<table>
<tr valign="top"><td><b>Masukkan No HP Tujuan</b></td><td>:</td><td><input type="text" name="nohp"></td></tr>
<tr valign="top"><td><b>Kirim Melalui Modem/HP</b></td><td>:</td><td><?php echo service3(''); ?></td></tr>
<tr valign="top"><td><b>Masukkan isi SMS</b><br>(maksimum panjang SMS adalah 160 karakter)</td><td>:</td><td><textarea name="sms" rows="5" cols="40"></textarea></td></tr>

</table>
<input type="submit" name="submit" value="Kirim SMS">
</form>

<?php
  if ($_POST['submit'])
  {
   $nohp = $_POST['nohp'];
   $sms = $_POST['sms'];
   $phone = $_POST['phoneid'];
  
   echo "<b>Status :</b><br>";
   echo "<pre>";
   passthru('gammu-smsd-inject -c '.$phone.' TEXT '.$nohp.' -text "'.$sms.'"');
   echo "</pre>";
  }
?>
Modul Program 5.15 Halaman Step7
<html>
<head>
  <script type="text/javascript">
 
  function ajax()
  {
  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
     xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("sms").innerHTML = xmlhttp.responseText;
    }
  }
  xmlhttp.open("GET","run2.php",true);
  xmlhttp.send();
  setTimeout("ajax()", 1000);
  } 
  </script>
</head>
<body onLoad="ajax()">
<?php include "menu2.php"; ?>

<h2>Langkah 8 - Test Menerima SMS</h2>

<p>Silakan kirim SMS ke nomor HP SMS Center Anda. Jika SMS sukses diterima oleh GAMMU akan muncul di bawah ini</p>

<div id="sms">
</div>
</body>
</html>
Modul Program 5.16 Halaman Step8
<?php

function service3($x)
{
   $string = "<select name='phoneid'>";
   $handle = @fopen($path."smsdrc1", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id1 = str_replace("\r\n", "", $split[1]);
            }
   } 
   if ($id1 != '') {
   $string .= "<option value='smsdrc1'>".$id1."</option>";
   }
   fclose($handle);
   $handle = @fopen($path."smsdrc2", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id2 = str_replace("\r\n", "", $split[1]);
            }
   } 
   if ($id2 != '') {
   $string .= "<option value='smsdrc2'>".$id2."</option>";   
   }
   fclose($handle);
   $handle = @fopen($path."smsdrc3", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id3 = str_replace("\r\n", "", $split[1]);
            }
   } 
   if ($id3 != '') {
   $string .= "<option value='smsdrc3'>".$id3."</option>";
   }
   fclose($handle);
  
   $handle = @fopen($path."smsdrc4", "r");
   while (!feof($handle))
   {
        $buffer = fgets($handle);
        if (substr_count($buffer, 'phoneid = ') > 0)
            {
               $split = explode("phoneid = ", $buffer);
               $id4 = str_replace("\r\n", "", $split[1]);
            }
   } 
   if ($id4 != '') {
   $string .= "<option value='smsdrc4'>".$id4."</option>";
   }
   fclose($handle);  
   $string .= "</select>";
   return $string;
}
?>

Modul Program 5.17 Halaman function

0 Response to "Script PHP Website Online Store Dengan Dreamweaver Lengkap"

Post a Comment