Sistem Informasi Berbasis Web pada Dinas Pertanian Kabupaten Padang Lawas

  

LISTING PROGRAM

1. administration.php

  <?php require_once 'include/db_connect.php'; session_start(); if(!$_SESSION['name']) { header("Location:login.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title>halaman admin</title> <link href="styles/admin_style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> </style> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> </div>

  </div> <div id="main">

  <div id="contents"> <div align="center">

  <h1> KONTROL PANEL ADMIN </h1></br> <strong>SELAMAT DATANG :</strong><?php echo

  $_SESSION['name']; ?>   <p> </p><p> </p> <div align="center">

  <?php if(isset($_GET['id'])=="viewall") {

  $qry=mysql_query("SELECT * FROM hal_kategori order by hal_kategori.id DESC ", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } echo "<table>"; /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<tr>"; echo "<td><a href=halaman1.php?id=".$row['nama_hal'].">".$row['hyperlink']."</a>  

    </td>"; echo "<td><a href=halaman1_edit.php?id=".$row['id'].">Perbarui</a>     </td>"; echo "<td><a href=delete.php?id=".$row['id'].">Hapus</a>   </td>"; echo "</tr>";

  } echo "</table>"; } ?>

  <?php if(isset($_GET['index'])=="viewall") { $qry=mysql_query("SELECT * FROM artikel WHERE tipe_hal='menu' order by artikel.id DESC ", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } echo "<table>"; /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<tr>"; echo "<td><a href=index.php?page=".$row['nama_hal'].">".$row['hyperlink']."</a>  & nbsp; </td>"; echo "<td><a href=halaman2_edit.php?id=".$row['id'].">Perbarui</a>     </td>"; echo "<td><a href=delete.php?page=".$row['id'].">Hapus</a>    </td>"; echo "</tr>";

  } echo "</table>"; } ?>

  <?php if(isset($_GET['articles'])=="viewall") { $qry=mysql_query("SELECT * FROM berita order by berita.id DESC ", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } echo "<table>"; /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<tr>"; echo "<td><a href=berita.php?id=".$row['id'].">".substr($row['judul'],0,30)."</a>  &n bsp; </td>"; echo "<td><a href=berita_edit.php?id=".$row['id'].">Perbarui</a>    </td >"; echo "<td><a href=berita_hapus.php?id=".$row['id'].">Hapus</a></td>"; echo "</tr>";

  } echo "</table>"; } ?>

  </div> </div> <div id="sidebar">

  <div class="inner"> <h3 class="sidebar"><strong>Kategori (Menu)</strong></h3></br> <ul>

  <li><a href="kategori_new.php" target="_self"> Kategori (Menu) Baru</a></li>

  <li><a href="kategori_remove.php" target="_self"> Hapus Kategori (Menu)</a></li>

  </ul></br></br> <b><h3 class="sidebar"><strong>Kategori (Menu) Yang Ada</strong></h3></b> <br/> <?php

  $qry=mysql_query("SELECT * FROM kategori", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<ul><li><a href=administration.php?cat=".$row['kategori'].">".$row['kategori']."</a></li></ul>"; } ?><p> </p><p> </p>

  <?php if(isset($_GET['home'])=="index") { $qry=mysql_query("SELECT * FROM artikel

  WHERE tipe_hal='content' ", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } echo "<table>"; /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<tr>"; echo "<td><a href=index.php?page=".$row['nama_hal'].">".$row['nama_hal']."</a></td>"; echo "<td><a href=halaman2_edit.php?id=".$row['id'].">Perbarui</a></td>"; echo "</tr>"; } echo "</table>"; } ?>

  </br> <ul>

  <li><a href="../index.php" target="_self"> Ke Branda (Web) </a></li> <li><a href="logout.php" target="_self">Keluar</a></li>

  </ul> </div> </div> <div id="sidebar2">

  <div class="inner">

  <h3 class="sidebar2"><strong>Artikel Menu Atas</strong></h3></br>

  <ul> <li><a href="halaman1_new.php" target="_self">Menu

  Baru</a></li> <li><a href=administration.php?id=viewall>Perbarui / Hapus

  Menu</a></li> </ul><br/><br/> <h3 class="sidebar2"><strong>Artikel Menu

  Samping</strong></h3></br> <ul>

  <li><a href="halaman2_new.php" target="_self">Menu Baru</a></p></li>

  <li><a href=administration.php?index=viewall>Perbarui / Hapus Menu</a></li>

  </ul><br/><br/> <h3 class="sidebar"><strong>Berita Index</strong></h3></br> <ul>

  <li><a href=berita_new.php >Berita Baru</a></li> <li><a href=administration.php?articles=viewall>Perbarui /

  Hapus Berita</a></li> </ul><br/> <h3 class="sidebar"><strong>Input</strong></h3></br> <ul><li><a href=formgalery.php >Tambah Foto Galery</a></li> <li><a href=fasilitas_new.php >Tambah Fasilitas</a></li> </ul>

  </div> </div> </div> <?php mysql_close($con); ?> </div> </body> </html>

  2. berita.php

  <?php require_once 'include/db_connect.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title><?php echo $row['judul']; ?></title> <link href="styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> <div id="cari">

  <?php //require_once 'include/search.php'; ?>

  </div> </div>

  </div> <div id="menus">

  <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?> </div>

  <div id="main"> <div id="contents"> <h4>Berita::</h4>

  <?php /* isset() is used to check wheather arctile id is received through url from "index.php" file and if it is set corresponding arctile is displayted using SELECT statement.

  • / if(isset($_GET['id'])) { $id=$_GET['id'];

  $qry=mysql_query("SELECT * FROM berita WHERE id=$id", $con); if(!$qry)

  { die("Query Failed: ". mysql_error()); }

  /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<h2>".$row['judul']."</h2>"; echo "<img width='400' src=".$row['image']."

  />"; echo "<div id='p2'>".$row['isi_berita']."</div>"; } } /* based on the category name received from index.php file the last added article is displayed

  • / if(isset($_GET['judul'])) { //echo $_GET['cat']; $tit=$_GET['judul']; $qry=mysql_query("SELECT * FROM berita

  WHERE judul='$tit' order by berita.id DESC LIMIT 0, 1", $con); if(!$qry) { die("Query Failed: ". mysql_error()); }

  /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<h2>".$row['judul']."</h2>"; echo "<img src=".$row['image']." />"; echo "<p>".$row['isi_berita']."</p>"; } } ?> </div>

  <div id="contents"> <div id="comments">

  <?php /* form komentar*/ require_once 'include/komentar2.php';?> </div>

  </div> <div id="sidebar">

  <?php /* menu samping dan umpanbalik */ require_once 'include/menu_samping.php';?> <?php /* menu berita kiri */ require_once 'include/menu_berita.php';?> <?php /* kalender harian */ require_once 'include/kalender.php'; ?>

  </div> <p> </p>

  <div id="footer"> <?php /* footer */ require_once 'include/footer.php'; ?>

  </div> <?php mysql_close($con); ?>

  </div> </body> </html>

  3. bukutamu.php

  <?php require_once 'include/db_connect.php'; ?> <?php if(isset($_GET['page'])) { //echo $_GET['cat']; $pg=$_GET['page']; $qry=mysql_query("SELECT * FROM artikel WHERE name_hal='$pg' order by artikel.id ASC LIMIT 0, 1", $con); if(!$qry) { die("Query Failed: ". mysql_error()); }

  /* Fetching data from the field "title" */ $row=mysql_fetch_array($qry); $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } else { $qry=mysql_query("SELECT * FROM artikel WHERE tipe_hal='isi_konten'", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } $row=mysql_fetch_array($qry); $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title>bukutamu</title> <link href="styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> <div id="cari">

  <?php //require_once 'include/search.php'; ?>

  </div> </div>

  </div> <div id="menus">

  <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?> </div>

  <div id="main"> <div id="contents">

  <h2>Buku Tamu</h2> <form action='bukutamusave.php' method='post'> <p></br> Nama : <input type='text' name='nama' /> </br></br> Email : <input type='text' name='email' /> </br></br> Tulis Komentar... : </br><br> <textarea name='isi_komentar' cols='50' rows='3' id='isi_komentar'></textarea> </br> </p> <p><p> </p> <input type='submit' value='Komentari' />        <input type="reset" name="button3" id="button3" value="Batal" /> </p> </form> <p> </p>

  <?php $records_per_page=5; if(isset($_GET['pg'])) { $current_pg=$_GET['pg']; } else { $current_pg=1; } if($current_pg<=1) { $start=0; } else { $start=($current_pg*$records_per_page)-

  $records_per_page;

  } $total_records=mysql_num_rows(mysql_query("SELECT * FROM bukutamu", $con)); if(!$total_records)

  { die("Query Failed: ". mysql_error()); } //echo $total_records; $total_pages= ceil($total_records / $records_per_page); //echo $total_pages; echo $current_pg."/".$total_pages." Dari Semua

  Tamu"; $qry=mysql_query("SELECT * FROM bukutamu order by bukutamu.id DESC LIMIT $start,$records_per_page", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo

  "</br>_______________________________________________________________< /br>"; echo "<b>".$row['nama'].",</b>"; echo "     di komentari pada :

  ".$row['tgl_komentar']."</br></br>"; echo $row['isi_komentar']; } $previous=$current_pg-1; $next=$current_pg+1; echo "</br>"; $pg_number=1; echo

  "</br></br>      

     "; for($pg_number;$pg_number<=$total_pages;$pg_number++) { if($current_pg==$pg_number) { echo " (".$pg_number.")"; } else { echo " <a href=\"bukutamu.php?pg=".$pg_number."\">".$pg_number."</a>";

  } } //echo "</br>"; echo "    "; if($current_pg>=2) { echo "<a href=\"bukutamu.php?pg=".$previous."\">Sebelumnya</a>";

  } echo "         "; if($current_pg<$total_pages)

  { echo "<a href=\"bukutamu.php?pg=".$next."\">Selanjutnya</a>";

  } echo "  "; echo "<a href=\"bukutamu.php?pg=1\">Pertama</a>"; echo

  "         "; echo "<a href=\"bukutamu.php?pg=".$total_pages."\">Terakhir</a>"; if($current_pg==$total_pages)

  { echo "</br></br> Sudah Mencapai Komentar Terakhir";

  }

  ?> </div> <div id="sidebar">

  <?php /* menu samping dan umpanbalik */ require_once 'include/menu_samping.php';?> <?php /* menu berita kiri */ require_once 'include/menu_berita.php';?> <?php /* kalender harian */ require_once 'include/kalender.php'; ?>

  </div> <p> </p>

  <div id="footer"> <?php /* footer */ require_once 'include/footer.php'; ?>

  </div> </div>

  <?php mysql_close($con); ?> </body> </html>

  4. bukutamusave.php

  <?php require_once 'include/db_connect.php'; if($_POST['isi_komentar']=="") { header("Location:bukutamu.php?msg=komentar jangan kosong"); } elseif($_POST['email']=="") { header("Location:bukutamu.php?msg=email jangan kosong"); } else { $name=$_POST['nama']; $email=$_POST['email']; $comment=$_POST['isi_komentar'];

  $qry=mysql_query("INSERT INTO bukutamu(nama,email,isi_komentar)VALUES('$name','$email','$comment')", $con); if(!$qry) { mysql_close($con); die("Query Failed: ". mysql_error()); } else { mysql_close($con); header("Location:bukutamu.php"); } } ?>

  5. fasilitas.php

  <?php require_once 'include/db_connect.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title><?php echo $row['judul']; ?></title> <link href="styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> <div id="cari">

  <?php //require_once 'include/search.php'; ?>

  </div> </div>

  </div> <div id="menus">

  <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?> </div>

  <div id="main"> <div id="contents">

  <center> <?php //koneksi database $query="SELECT * FROM fasilitas where id"; $hasil=mysql_query($query); print("<table class='style'>"); print ("<caption>Daftar Fasilitas Dinas Pertanian Padang

  Lawas</caption></br></br>"); print("<tr>\n"); print("<th scope='row'>Kode</th>"); print("<th scope='row'>Nama</th>"); print("<th scope='row'>Pemilik</th>"); print("<th scope='row'>Jumlah</th>"); print("</tr>\n"); while($baris = mysql_fetch_row($hasil)){

  $id=$baris[0]; $nama=$baris[1]; $pemilik=$baris[2]; $jumlah=$baris[3]; print("<tr class='odd'>\n"); print("<td>" . $id . "</td>"); print("<td>" . $nama . "</td>"); print("<td>" . $pemilik . "</td>"); print("<td>" . $jumlah . "</td>"); print("</tr>"); } print("</table>\n"); mysql_close($id_mysql);

  ?> </div>

  <div id="sidebar"> <?php /* menu samping dan umpanbalik */ require_once 'include/menu_samping.php';?> <?php /* menu berita kiri */ require_once 'include/menu_berita.php';?>

  <?php /* kalender harian */ require_once 'include/kalender.php'; ?> </div>

  <p> </p> <div id="footer">

  <?php /* footer */ require_once 'include/footer.php'; ?> </div> <?php mysql_close($con); ?>

  </div> </body> </div> </html>

  6. galery.php

  <?php require_once('galery/general/maxImageUpload.class.php'); $maxPhoto = new maxImageUpload(); ?> <?php require_once 'include/db_connect.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Album Dinas Pertanian Pemkab Palas</title> <link href="galery/style/style2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <div id="header"><div id="header_left"></div> <div id="header_main">Album Dinas Pertanian Pemkab Palas</div> <div id="header_right"></div> </div>

  <div id="menus"> <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?>

  </div>

  <div id="frameHolder"> <iframe name="imgHolder" frameborder="0" src="<?php $maxPhoto-

  >displayFirst(); ?>"></iframe> </div> <div id="list"><?php $maxPhoto->displayThumbList(); ?></div> <div id="footer"><a href="http://www.phpf1.com"></a></div> </div> </body> 7. halaman1.php

  <?php require_once 'include/db_connect.php'; ?> <?php if(isset($_GET['cat'])&&isset($_GET['page'])) { //echo $_GET['cat']; $cat=$_GET['cat']; $pg=$_GET['page']; $qry=mysql_query("SELECT * FROM hal_kategori WHERE nama_hal='$pg'", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching data from the table "category_pages" */ $row=mysql_fetch_array($qry); $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } elseif(isset($_GET['cat'])) { //echo $_GET['cat']; $cat=$_GET['cat']; $qry=mysql_query("SELECT * FROM hal_kategori WHERE kategori='$cat' order by hal_kategori.id ASC LIMIT 0, 1", $con); if(!$qry)

  { die("Query Failed: ". mysql_error()); } /* Fetching data from the field "title" */ $row=mysql_fetch_array($qry); $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title><?php echo $title; ?></title> <link href="styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> <div id="cari">

  <?php //require_once 'include/search.php'; ?>

  </div> </div>

  </div> <div id="menus">

  <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?> </div>

  <div id="main"> <div id="contents">

  <p> </p> <?php if(isset($_GET['cat'])) { //echo $_GET['cat'];

  $cat=$_GET['cat']; $qry=mysql_query("SELECT * FROM hal_kategori

  WHERE kategori='$cat' order by hal_kategori.id", $con); if(!$qry) { die("Query Failed: ". mysql_error()); }

  /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<div id='l_menus'><ul><li> <a href=pages.php?cat=".$row['kategori']."&page=".$row['nama_hal']."> ".$row['judul']." </a></ul></li></div>"; } } ?>

  <p> </p> <?php echo "<b>Updated on : ".$date."</b><p> </p>"; echo "<div id='p2'>".$contents."</div>"; ?>

  </div> <div id="contents">

  <div id="comments"> <?php /* form komentar */ require_once 'include/komentar.php';?>

  </div> </div> <div id="sidebar">

  <?php /* menu samping */ require_once 'include/menu_samping.php';?> <?php /* menu berita kiri */ require_once 'include/menu_berita.php';?> <?php /* kalender harian */ require_once 'include/kalender.php'; ?>

  </div> <p> </p>

  <div id="footer"> <?php /* footer */ require_once 'include/footer.php'; ?>

  </div> </div> <?php mysql_close($con); ?> </body> </html>

  8. halaman2.php

  <?php require_once 'include/db_connect.php'; ?> <?php if(isset($_GET['page'])) { //echo $_GET['cat']; $pg=$_GET['page']; $qry=mysql_query("SELECT * FROM artikel WHERE nama_hal='$pg' order by artikel.id ASC LIMIT 0, 1", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching data from the field "title" */ $row=mysql_fetch_array($qry); $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } else { $qry=mysql_query("SELECT * FROM artikel WHERE tipe_hal='isi_konten'", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } $row=mysql_fetch_array($qry);

  $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title><?php echo $title; ?></title> <link href="styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> <div id="cari">

  <?php //require_once 'include/search.php'; ?>

  </div> </div>

  </div> <div id="menus">

  <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?> </div>

  <div id="main"> <div id="contents">

  <?php echo "<b>Updated on : ".$date."</b><p> </p></br>"; echo "<div id='p2'>".$contents."</div>"; ?>

  </div> <div id="contents">

  <div id="comments"> <?php /* form komentar */ require_once 'include/komentar1.php';?>

  </div> </div>

  <div id="sidebar"> <?php /* menu samping dan umpanbalik */ require_once 'include/menu_samping.php';?> <?php /* menu berita kiri */ require_once 'include/menu_berita.php';?> <?php /* kalender harian */ require_once 'include/kalender.php'; ?>

  </div> </div>

  <p> </p> <div id="footer">

  <?php /* footer */ require_once 'include/footer.php'; ?> </div>

  </div> <?php mysql_close($con); ?> </body> </html>

  9. index.php

  <?php require_once 'include/db_connect.php'; ?> <?php if(isset($_GET['page'])) { //echo $_GET['cat']; $pg=$_GET['page']; $qry=mysql_query("SELECT * FROM artikel WHERE nama_hal='$pg' order by artikel.id ASC LIMIT 0, 1", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching data from the field "title" */ $row=mysql_fetch_array($qry); $key=$row['keywords'];

  $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } else { $qry=mysql_query("SELECT * FROM artikel WHERE tipe_hal='isi_konten'", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } $row=mysql_fetch_array($qry); $key=$row['keywords']; $title=$row['judul']; $date=$row['tanggal']; $contents=$row['isi_konten']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title><?php echo $title; ?></title> <link href="styles/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> <div id="cari">

  <?php //require_once 'include/search.php'; ?>

  </div> </div>

  </div> <div id="menus">

  <?php /* menu atas di bawah header */ require_once 'include/menu_atas.php';?> </div>

  <div id="main">

  <div id="contents"> <?php /* Selecting the last added articles to display in the secton - "Breaking news" from the table "articles"

  • / $qry=mysql_query("SELECT * FROM berita order by berita.id DESC

  LIMIT 0, 7", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching and dispalying the datas to breakign news section from the databse table "articles" */ /* the php in-built function substr() is used to limit the no of characters displayed in breakign news section to 200 and when "Read more" is clicked article id is transfered through url to articles.php for displaying in full

  • / while($row=mysql_fetch_array($qry)) { echo

  "____________________________________________________________________ _______________________"; echo "<h3>".$row['judul']."</h3><p> </p>"; echo "<img align='left' width='100' src=".$row['image']." />"; echo "<div id='p1'>".substr($row['isi_berita'],0,400)."<a href=berita.php?id=".$row['id']."> Baca selengkapnya.....</a></div></br></br>";

  } ?>

  <p> </p> </div> <div id="sidebar">

  <?php /* menu samping dan umpanbalik */ require_once 'include/menu_samping.php';?> <?php /* menu berita kiri */ require_once 'include/menu_berita.php';?> <?php /* kalender harian */ require_once 'include/kalender.php'; ?>

  </div> <p> </p>

  <div id="footer"> <?php /* footer */ require_once 'include/footer.php'; ?>

  </div> </div> <?php mysql_close($con); ?> </body> </html>

  10. komentar.php

  <h2>Komentar</h2> <form action='comment2.php?id=<?php echo $id;?>' method='post'> <p></br> Nama : <input type='text' name='name' /> </br></br> Email : <input type='text' name='email' /> </br></br> <textarea name='comment' cols='50' rows='3' id='comment'></textarea> </br><p> </p> <input type='submit' value='Komentari' /> </form>

  <?php if(isset($_GET['page'])) { $pg=$_GET['page']; $qry=mysql_query("SELECT * FROM komentar WHERE nama_hal='$id' order by komentar.id ASC", $con); if(!$qry) { die("Query Failed: ". mysql_error()); }

  /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry))

  { echo "</br>_______________________________________________________________< /br>"; echo "<b>di komentari pada : ".$row['comment_date']."</b></br></br>"; echo "Nama : ".$row['nama']."<br/>"; echo "Email : ".$row['email']."<br/>"; echo $row['isi_komentar']; } } ?>

  11. login.php

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html ns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="<?php echo $key; ?>" /> <title>Admin Login</title> <link href="styles/login.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="contain">

  <div id="top"> <div id="header">

  <?php require_once 'include/header.php'; ?> </div>

  </div> <div id="main">

  <div id="contents"> <p align="center"> </p> <p align="center"> </p> <p align="center"><h2 class="admin" align="center">ADMIN LOGIN</h1></p> <h2 align="center" class="h2"> <?php if(isset($_GET['msg'])) { echo $_GET['msg']; } ?> </h2>

  <p align="center"> </p> <form id="form" name="form" method="post" action="verification.php"><p> </p><p> </p>

  <p align="center"><label for="user">Nama Pengguna :</label> <input class="txtbox" type="text" name="user" id="user" value="" /></br></br> <label for="pass">          

  Password :</label> <input class="txtbox" type="password" name="pass" id="pass" value=""/></p></br></br>

            &nbs p;         <input class="" type="submit" name="submit" id="submit" value="Masuk" />     <input type="reset" name="reset" id="reset" value="Batal" /><p> </p>

  <br class="spacer" /> </p><p> </p> </div> </form>

  <p> </p> <div id="footer"><p> </p><p align="center">Dinas Pertanian Padang Lawas </br>Copyright @2012 - All Rights Reserved</br>Emir satria hasibuan</p></div> </div> </body> </html>

  12. db_connect.php

  <?php /* connecting to MySql */ $host="localhost"; $user="root"; $password="hasibuan"; $con = mysql_connect($host,$user,$password); if(!$con) { die("conneksi ke database gagal".mysql_error()); } /* selecting the database "complete_cms" */ $dataselect = mysql_select_db("distan",$con); if(!$dataselect)

  { die("Database tidak ditemukan".mysql_error()); } ?>

  a. menu_atas.php

       <a href="index.php" target="_self">Home </a> <?php /* Displaying List of Categories from the Table - Category and that is limited to 6

  • / $qry=mysql_query("SELECT * FROM hal_kategori order by hal_kategori.id ASC"); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching datas from the field "category" and article id is transfered to articles.php file */ while($row=mysql_fetch_array($qry)) {

  echo "    |    <a href=halaman1.php?cat=".$row['kategori'].">".$row['hyperlink']."</a>"; } ?>   |   <a href="galery.php" target="_self">Galery</a>   |   <a href="fasilitas.php" target="_self">Fasilitas</a>   |   <a href="bukutamu.php">Buku Tamu</a>

  b. menu_berita.php

  <h3 class="sidebar"><strong>Berita::</strong></h3> <p> </p> <?php /* Selecting & querying the Table "articles" in descending order referring to the field "id" and limiting the number of result to 10 */

  $qry=mysql_query("SELECT * FROM berita order by berita.id DESC LIMIT 0, 9", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } /* Fetching data from the field "title" */ while($row=mysql_fetch_array($qry)) { echo "<ul><li><a href=berita.php?id=".$row['id'].">".substr($row['judul'],0,25)."...</a></li></ul>"; } ?>

  c. menu_samping.php

  <h3 class="sidebar"><strong>Program Pokok</strong></h3></br> <?php $qry=mysql_query("SELECT * FROM artikel WHERE tipe_hal='menu' order by artikel.id ASC", $con); if(!$qry) { die("Query Failed: ". mysql_error()); } while($row=mysql_fetch_array($qry)) { echo "<div id='r_menu'><ul><li><a href=halaman2.php?page=".$row['nama_hal'].">".$row['hyperlink']."</a></ul></li></ div>"; } ?> <p> </p><p> </p>