Read 166 times | Created 2013-02-26 05:36:54 | Updated 2013-02-26 05:36:54 | | |

 

<?php
/*******************
/ FILENAME     : krl.php
/ PURPOSE      : Jabodetabek Commuter Line Train Schedule
/ CREATED BY   : Cahay DSN
/ CREATED DATE : 2013-02-26
/*******************
DROP TABLE IF EXISTS `stasiun`;  
CREATE TABLE IF NOT EXISTS `statiun` (  
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key untuk table stasiun',
 `nama` varchar(50) NOT NULL COMMENT 'nama stasiun', 
 `kode` varchar(4) NOT NULL COMMENT 'kode stasiun',
 PRIMARY KEY(`id`)  
) ENGINE=MyISAM COMMENT='tabel untuk menyimpan data stasiun KRL Jabodetabek';  

INSERT INTO stasiun(`nama`,`kode`) VALUES
("Jakarta Kota","JAK"),
("Jayakarta","JYK"),
("Mangga Besar","MGB"),
("Sawah Besar","SW"),
("Juanda","JUA"),
("Gambir","GMR"),
("Gondangdia","GDD"),
("Cikini","CKI"),
("Manggarai","MRI"),
("Tebet","TEB"),
("Cawang","CW"),
("Duren Kalibata","DRN"),
("Pasar Minggu Baru","PSMB"),
("Pasar Minggu","PSM"),
("Tanjung Barat","TNT"),
("Lenteng Agung","LNA"),
("Universitas Pancasila","UP"),
("Universitas Indonesia","UI"),
("Pondok Cina","POC"),
("Depok Baru","DPB"),
("Depok","DP"),
("Citayam","CTA"),
("Bojonggede","BJD"),
("Cilebut","CLT"),
("Bogor","BOO"),
("Bekasi","BKS"),
("Kranji","KRI"),
("Cakung","CUK"),
("Klender Baru","KLDB"),
("Buaran","BUA"),
("Klender","KLD"),
("Jatinegara","JNG"),
("Kramat","KMT"),
("Gang Sentiong","GST"),
("Pasar Senen","PSE"),
("Kemayoran","KMO"),
("Rajawali","RJW"),
("Kampung Bandan","KPB"),
("Ancol","AC"),
("Tanjung Priok","TPK"),
("Tangerang","TNG"),
("Batu Ceper","BPR"),
("Poris","PI"),
("Kalideres","KDS"),
("Rawa Buaya","RW"),
("Bojong Indah","BOI"),
("Pesing","PSG"),
("Duri","DU"),
("Tanah Abang","THB"),
("Angke","AK"),
("Karet","KRT"),
("Sudirman","SUD"),
("Serpong","SRP"),
("Rawa Buntu","RU"),
("Sudimara","SDM"),
("Jurangmangu","JRU"),
("Pondok Ranji","PDJ"),
("Kebayoran","KBY"),
("Palmerah","PLM");
*********************/
?>
<!DOCTYPE html>
<html>
  <head>
    <title>KRL Schedule</title>
    <style>
      html,body{padding:0;margin:0;width:100%;}
      .schedule{width:95%;margin:auto;height:400px;border:solid 1px #fff;}
    </style>
  </head>
  <body>
    <div>
      Stasiun : 
      <select      
        onChange="document.getElementById('frm').src='http://infoka.krl.co.id/to/'+this.value;">
        <option>-- select --</option>
        <?php
        $dbhost='localhost';
        $dbuser='root';
        $dbpass='';
        $dbname='test2';
        $sql="SELECT kode,nama FROM stasiun ORDER BY nama";
        $db=new mysqli($dbhost,$dbuser,$dbpass,$dbname);
        $result=$db->query($sql);
        while($row=$result->fetch_object()){
          echo '<option value="'.$row->kode.'">'.$row->nama.'</option>';
        }
        $result->close();
        $db->close();
        ?>
      </select><br/>
      <iframe class="schedule" id="frm"></iframe>
    </div>
  </body>
</html>