Minggu, 09 November 2014

Source code PHP for Gammu to send message

Interface :

<form name="formlp2maray" method="post" action="simpangammu.php">
<h3> Kirim Pesan Single </h3>
<table width="800" border="0" cellspacing="0" cellpadding="3">
<tr>
    <td width="100"> Nomor Tujuan </td><td width="10"> : </td>
    <td><input name="hp" type="text" size="20"></td>
</tr>
<tr valign="top">
    <td> Isi Pesan </td><td> : </td>
    <td>
        <textarea name="isi_pesan" cols="40" rows="7"></textarea>
    </td>
</tr>
<tr>
    <td colspan="2"></td>
    <td><input name="counter" type="text" size="5" maxlength="5" value="160" /></td>
</tr>
<tr>
    <td><input type="submit" value="Kirim Pesan" /></td>
</tr>
</table>
</form>



lalu buat file baru bernama :simpangammu.php

<?php
$host    = "localhost";
$user    = "root";
$pass    = "";
$database = "lp2msetgammuauto";

mysql_connect($host,$user,$pass);
mysql_select_db($database);

$hp = $_POST['hp'];
$isi_pesan = $_POST['isi_pesan'];

$masuk = mysql_query("insert into outbox (InsertIntoDB,SendingDateTime,DestinationNumber,TextDecoded,SendingTimeOut,DeliveryReport,CreatorID)
        values (sysdate(),sysdate(),'$hp','$isi_pesan',sysdate(),'yes','system')");
if ($masuk){
    echo "<h4> Pesan Dikirim </h4>";
}
else {
    echo "<h4> Pesan gagal dikirim </h4>";
}
?>

Ok semoga membantu....



Tidak ada komentar:

Posting Komentar