<?PHP
switch($_GET[act]){
default :
include'koneksi.php';
$cek = mysql_query("Select * from berita order by id_berita");
while($lihat=mysql_fetch_array($cek)){
echo "<a href='$lihat[nama_file]' title='$lihat[judul]'><img src='admin/berita/photo/$lihat'[nama_file]' title='$lihat[judul_foto]' width=150px height=150px /></a>";
echo "posted At : $lihat[waktu]";
echo "<p class=gaya>".substr($lihat[isi],0,200)." ......";
echo "<a href=?index.php&act=Selanjutnya&data=$lihat[id_berita]><br>(baca selengkapnya...)</a></p>";
}
case 'Selanjutnya':
if(isset($_GET['data'])){
$dataId=$_GET['data'];
include'koneksi.php';
$lihatsemuanya = mysql_query("SELECT * FROM berita WHERE id_berita='$dataId' ORDER
by id_berita asc");
if($lihatdong = mysql_fetch_array( $lihatsemuanya )){
echo "<font color=blue size=+2> $lihatdong[judul]</font><br>";
echo "At : $lihatdong[waktu]";
echo "<p class=gaya>$lihatdong[isi]</p>";
}
}
}
?>
<?php
session_start();
include "main_function.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Equity Indonesia</title>
<link rel="stylesheet" type="text/css" href="css/accordion_glam.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="header">
<div class="shell">
<img src="images/Logo-Equity.png" align="left" height="95"/>
</div></div>
<br />
<body>
<div id="main_container">
<div class="main_content">
<div class="menu">
<ul><li></li>
<li></li>
</ul>
</div>
<div class="center_content">
<div class="left_content">
<div class="sidebar_search">
<form>
<input type="text" name="" class="search_input" value="search keyword" onclick="this.value=''" />
<input type="image" class="search_submit" src="images/search.png" />
</form>
</div>
<div class="sidebarmenu">
<?php $a = 1;
$kategori=mysql_query("select * from tb_kategori");
while ($data=mysql_fetch_array($kategori))
{
?>
//di bawah ada menu yang ingin saya while -->
<a class="menuitem" href=""><?php echo $a.". ".$data['kategori'];?></a></div>
//<--
<?php
$a++;
}
?> </div>
<div class="right_content">
<h2>Products Categories Settings</h2>
<table id="rounded-corner" width="850" border="0" >
<thead><tr align="center" valign="middle" >
<th width="51" rowspan="2" align="center" valign="middle" class="rounded-company">No</th>
<th width="256" rowspan="2" class="rounded">Sub Kategori</th>
<th colspan="3" class="rounded">Important</th>
<th colspan="3" class="rounded-q4">Desgree</th>
</tr>
<tr align="center" valign="middle">
<th width="44" class="rounded">P</th>
<th width="45" class="rounded">SP</th>
<th width="43" class="rounded">H</th>
<th width="37" class="rounded">1</th>
<th width="38" class="rounded">2</th>
<th width="40" class="rounded">3</th>
</tr></thead>
<tfoot>
<tr>
<td colspan="8" class="rounded-foot-left"><em>Silahkan Pilih</em></td>
</tr>
</tfoot>
<tbody>
<?php $i = 1;
$kategori=mysql_query("select * from tb_kategori INNER JOIN tb_subkategori ON tb_kategori.ID_kategori=tb_subkategori.ID_kategori
WHERE tb_kategori.ID_kategori='1' ORDER BY tb_kategori.ID_kategori");
while ($data=mysql_fetch_array($kategori))
{
?>
<tr align="center" valign="middle" >
<td width="51"><?php echo $i; ?></td>
<td width="256" align="left"><?php echo $data["sub_kategori"]; ?></td>
<td width="44" ><input type="radio" name="A<?php echo $data["ID_kategori"].$data["ID_sub_kategori"]; ?>" value="60" /></td>
<td width="45" ><input type="radio" name="A<?php echo $data["ID_kategori"].$data["ID_sub_kategori"]; ?>" value="75" /></td>
<td width="43" ><input type="radio" name="A<?php echo $data["ID_kategori"].$data["ID_sub_kategori"]; ?>" value="95" /></td>
<td width="37" ><input type="radio" name="B<?php echo $data["ID_kategori"].$data["ID_sub_kategori"]; ?>" value="1" /></td>
<td width="38" ><input type="radio" name="B<?php echo $data["ID_kategori"].$data["ID_sub_kategori"]; ?>" value="2" /></td>
<td width="40" ><input type="radio" name="B<?php echo $data["ID_kategori"].$data["ID_sub_kategori"]; ?>" value="3" /></td>
</tr>
</tbody>
<?php
$i++;
}
?>
</table>
<a href="#" class="bt_blue"><span class="bt_blue_lft"></span><strong>Save</strong><span class="bt_blue_r"></span></a>
<h2> </h2>
<h2> </h2>
</div>
<!-- end of right content-->
</div> <!--end of center content -->
<div class="clear"></div>
</div> <!--end of main content-->
<div class="footer"></div>
</div>
</body>
<br />
</html>
<?php
?>
<?php
defined('__NOT_DIRECT') || define('__NOT_DERECT',1);
include 'cek-akses.php';
if($_POST){
mysql_connect(DB_HOST,DB_USER,DB_PASS);
mysql_select_db(DB_NAME);
if($_POST['password']!=$_POST['password2']{
echo 'Silahkan ketik ulang password!';
} else if(!$_POST['user_id'){
echo 'ID User tidak boleh kosong!';
} else if(mysql_num_rows(mysql_query("select * from user where user_id='".mysql_real_escape_string($_POST['user_id']."'"))){
echo 'User id sudah dipakai, masukan yang lain!';
}else{
mysql_query("insert into user (user_id,name,password,type) values
('".mysql_real_escape_string($_POST['user_id'])."','".mysql_real_escape_string($_POST['name']."',
'"md5($_POST['password'])."','user')");
echo "Registrasi berhasil";
}
}
?>
<form action="" method="post">
<dl>
<dt>ID User:</dt>
<dd><input type="text" name="user_id"/></dd>
<dt>nama:</dt>
<dd><input type="text" name="user_id"/></dd>
<dt>password:</dt>
<dd><input type="password" name="password"/></dd>
<dt>Ketik ulang password:</dt>
<dd><input type="password" name="password2"/></dd>
<dt></dt>
<dd><input type="simbit" value="Register"/></dd>
</dl>
</form>
<a href="index.php">Kembali</a>
<form name="form1" method="post" action="proses_surat_jalan.php">
<center><strong><h1>Input Form Surat Jalan</h1></strong></center><br><br>
<table width="433" border="1">
<tr>
<td width="104">No. Surat Jalan</td>
<td width="0">:</td>
<td width="307"><input name="no_sj" type="text">
<select name="bln_sj" id="bln_sj">
<option>/SP-JMI/I/</option>
<option>/SP-JMI/II/</option>
<option>/SP-JMI/III/</option>
<option>/SP-JMI/IV/</option>
<option>/SP-JMI/V/</option>
<option>/SP-JMI/VI/</option>
<option>/SP-JMI/VII/</option>
<option>/SP-JMI/VIII/</option>
<option>/SP-JMI/IX/</option>
<option>/SP-JMI/X/</option>
<option>/SP-JMI/XI/</option>
<option>/SP-JMI/XII/</option>
</select>
<? $now=date("Y");
echo "<select name=thn_sj>
<option value=2000 selected>2000</option>";
for($thn=2001; $thn<=$now; $thn++){
echo "<option value=$thn>$thn</option>";}
echo "</select>";
?></td>
</tr>
<tr>
<td>Tanggal</td>
<td>:</td>
<td><?php
//array yang digunakan pada ComboBox bulan
$bln=array(1=>"Januari","Februari","Maret","April","Mei",
"Juni","July","Agustus","September","Oktober",
"November","Desember");
//membuat tanggal 1-31 pada ComboBox
echo "<select name=tgl>
<option value=01 selected>01</option>";
for($tgl=2; $tgl<=31; $tgl++){
$tgl_leng=strlen($tgl);
if ($tgl_leng==1)
$i="0".$tgl;
else
$i=$tgl;
echo "<option value=$i>$i</option>";}
echo "</select>";
//membuat bulan ComboBox
echo "<select name=bln>
<option value=Januari selected>Januari</option>";
for($bulan=2; $bulan<=12; $bulan++){
echo "<option value=$bulan>$bln[$bulan]</option>";}
echo "</select>";
$now=date("Y");
echo "<select name=thn>
<option value=2000 selected>2000</option>";
for($thn=2001; $thn<=$now; $thn++){
echo "<option value=$thn>$thn</option>";}
echo "</select>";
?></td>
</tr>
<tr>
<td>Nama Perusahaan</td>
<td>:</td>
<td><select name="nama_perusahaan" id="nama_perusahaan">
<option value="0">---Pilih Perusahaan---</option>
<?php
include "koneksi.php";
$query="SELECT * FROM data_perusahaan";
$hasil=mysql_query($query);
while ($data=mysql_fetch_array($hasil))
{
echo"<option value='$data[nama_perusahaan]'>$data[nama_perusahaan]</option>";
}
?>
</select></td>
</tr>
<tr>
<td>Alamat Perusahaan</td>
<td>:</td>
<td><label for="alamat_perusahaan"></label>
<textarea type=text name="alamat_perusahaan" id="alamat_perusahaan" cols="45" rows="5"></textarea></td>
</tr></table>
<table width="433" border="1">
<tr>
<td>Nama Part</td>
<td>Nomor Part</td>
<td>Jumlah</td>
</tr>
<td>
<input type="text" name="part_name[0]" id="part_name"></td>
<td>
<input type="text" name="part_number[0]" id="part_number">
</td>
<td>
<input type="text" name="qty[0]" id="qty"></td>
<td><button type="button" class="del">Del</button></td>
</tr>
<tr id="last">
<td colspan="4" align="right"><button type="button" id="addRow">Add</button></td>
</tr>
</table>
<br>
<input name="simpan" type="submit" value="Simpan"><input name="cancel" type="reset" value="Cancel">
</form>
<script type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
var i = 1;
$(function(){
$("#addRow").click(function(){
row = '<tr>'+
'<td><input type="text" name="part_name[+i+]" id="part_name"/></td>'+
'<td><input type="text" name="part_number[+i+]" id="part_number"/></td>'+
'<td><input type="text" name="qty[+i+]" id="qty"/></td>'+
'<td><button type="button" class="del">Del</button></td>'+
'</tr>';
$(row).insertBefore("#last");
i++;
});
});
$(".del").live('click', function(){
$(this).parent().parent().remove();
});
</script>
form proses_sj.php<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
include "koneksi.php";
$simpan=mysql_query("INSERT INTO data_surat_jalan(no_sj,bln_sj,thn_sj,tgl,bln,thn,nama_perusahaan,alamat_perusahaan) VALUES('$_POST[no_sj]',
'$_POST[bln_sj]',
'$_POST[thn_sj]',
'$_POST[tgl]',
'$_POST[bln]',
'$_POST[thn]',
'$_POST[nama_perusahaan]',
'$_POST[alamat_perusahaan]')");
$sql = "select max(no_sj) as no_sj from data_surat_jalan limit 1";
$row = mysql_fetch_array(mysql_query($sql));
$no_sj = $row['no_sj'];
foreach($_POST['part_name'] as $key => $part_name)
{
$sql =mysql_query("INSERT INTO data_material_sj(no_sj,part_name,part_number,qty) VALUES ('{$_POST[no_sj]}','{$_POST[part_name][$key]}','{$part_number}','{$_POST[qty][$key]}')");
}
if ($simpan)
{
echo"<script>
window.alert('Input Surat Jalan Berhasil')
window.location='data-surat-jalan.php'</script>";
}
else
{
echo"<script>
window.alert('Input Surat Jalan Gagal')
window.location='input-surat-jalan.php'</script>";
}
?>