You are on page 1of 7

LAPORAN TUGAS INDIVIDU PERANCANGAN WEB DAN INTERNET

OLEH : NAMA NIM : FAJAR KUSNOTO : 08.11.2554

STMIK AMIKOM YOGYAKARTA 2011

1. http://pesonafajar.bogoraya.com 2.
A. tbl admin

B. tbl Content

C.tbl Pesan

3.

a. Insert -content
<?php include"../../conn.php"; extract($_POST); if(empty($judul)){ echo "<script>alert('Title can not be empty') javascript:history.go(-1)</script>"; }else { mysql_query("insert into content (judul, isi,date) values('$judul','$isi',CURDATE())"); echo "<script>alert('message has been sent, thank you for participation') javascript:location.href='home.php'</script>"; } ?>

-pesan
<?php include"conn.php"; extract($_POST); if(empty($nama)){ echo "<script>alert('name can not be empty') javascript:history.go(-1)</script>"; }else if(empty($email)){ echo "<script>alert('email can not be empty') javascript:history.go(-1)</script>"; }else if(empty($pesan)){ echo "<script>alert('message can not be empty') javascript:history.go(-1)</script>"; }else { mysql_query("insert into pesan (nama, email,date,isi) values('$nama','$email',CURDATE(),'$pesan')"); echo "<script>alert('message has been sent, thank you for participation') javascript:location.href='index.php'</script>"; } ?>

b. Select -content
<? include('conn.php'); if(isset($_GET['id'])){ $id=$_GET['id']; $sql="SELECT * from content where id='$id'"; $result=mysql_query($sql) or die(mysql_error()); while($row=mysql_fetch_array($result)){ ?> <h2 class="judul"><a href="index.php"><?php echo $row['judul'];?></a></h2><p class="isi" > Added on : <? echo $row['isi']; ?> <p class="date"> <?php echo $row['date']; } }?>

-pesan
<?php session_start();

if(isset($_SESSION['id']) && isset($_SESSION['pass'])){ ?> <a style="text-decoration:none; color:#333333;" href="home.php"><<<< Back </a> <?php include "../conn.php"; $result = mysql_query("SELECT * FROM pesan order by id DESC"); echo "<table align='center' width='800' border='0'> <tr bgcolor='#666666' height='50'> <th>Nama</th> <th>Email</th> <th>Isi Pesan</th> <th width='90'>Isi Pesan</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr bgcolor='#999999' height='30'>"; echo "<td>" . $row['nama'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['isi'] . "</td>"; echo "<td>" . $row['date'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> <?php }else{ header('Location:index.php'); } ?>

c. Koneksi
<?php $server = "localhost"; $username = "root"; $password = "rizal"; $database = "fajar"; $koneksi=mysql_connect($server,$username,$password); mysql_connect($server,$username,$password) or die("Koneksi gagal");

mysql_select_db($database) or die("Database tidak bisa dibuka"); ?>

4.

-home

-about

-contact

-admin

-home admin

-tambah konten

-lihat pesan

You might also like