$data = array();
$data[] = "IT/managerial/software/kasubsie/Moro/Konsolidasi Server";
$data[] = "IT/managerial/software/kasubsie/Moro/Setting Server";
$data[] = "IT/managerial/software/kasubsie/Setting Server/Moro";
$data[] = "informasi/aaa/bbb/ccc/vvv";
$data[] = "informasi/aaa/bbb/ccc/ddd";
$data = array();
$data[] = "IT/managerial/software/kasubsie/Moro/Konsolidasi Server";
$data[] = "IT/managerial/software/kasubsie/Moro/Setting Server";
//$data[] = "fendy/yefune/teni/yoseph/Moro/Setting Server"; //ini jika posisi array key sama tp folder sebelumnya beda
$data[] = "IT/managerial/software/kasubsie/Setting Server/Moro";
$data[] = "informasi/aaa/bbb/ccc/vvv";
$data[] = "informasi/aaa/bbb/ccc/ddd";
sort($data);
foreach ($data as $value)
{
$item_path = explode("/",$value);
$jml_path = count ($item_path);
/*(for ($i=0;$i<=$jml_path;$i++)
{
$sql = mysql_query("SELECT * FROM treegrid WHERE $parent_id = $i and folder_name = '$item_path[$i]'");
$r = mysql_num_rows($sql);
$data = mysql_fetch_array($sql);
$id = $data['id'];
}*/
foreach ($item_path as $k => $d)
{
//echo $k." ".$d;
//echo "<br>";
$id = mysql_query("SELECT max(id) id FROM treegrid");
$rows = mysql_num_rows($id);
if ($rows > 0)
{
$data = mysql_fetch_array($id);
$id = $data['id'];
$id = $id + 1;
}
else
{
$id = 1;
}
if($k == 0 )
{
$parent_id = 0;
}
else
{
$parent_id = $id-1;
}
$cek = mysql_query("SELECT * FROM treegrid WHERE array_key = $k and folder_name ='$d'");
$baris = mysql_num_rows($cek);
if ($baris == 0)
{
$sql = mysql_query("INSERT INTO treegrid VALUES ($id,$parent_id,$k,'$d')");
if ($sql)
{
echo "YES";
}
else
{
echo "NO";
}
}
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login</title>
</head>
<body class="special-page login-bg dark">
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<form name="myform" onSubmit="return validasi()" method="post" action="log.php?op=in">
<table width="200" border="0">
<tr>
<td>Username</td>
<td><input type="text" name="nama" value="" ></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" value="" ></td>
</tr>
</table><br>
<input type="submit" value="Submit" onclick="fungsi()">
<input type="submit" name="Submit2" value="Daftar">
</form>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>login</title>
</head>
<body class="putih">
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<a name="atas"></a>
<nav id="main-nav">
<div class="columns">
<!-- Left column -->
<div class="colx3-center">
<div class="block-content">
<h1>Welcome</h1>
<div class="columns">
<div class="colx2-left form">
<fieldset>
<legend>Select</legend>
<?php
session_start();
include 'koneksi.php';
$userid = $_POST['nama'];
$psw = $_POST['password'];
$op = $_GET['op'];
if($op=="in"){
$cek = mysql_query("SELECT * FROM tipe_user_aksi,aksi,user WHERE nama='$userid' AND password='$psw' AND user.id=tipe_user_aksi.id_user and tipe_user_aksi.id_aksi=aksi.id ");
if(mysql_num_rows($cek)==1){//jika berhasil akan bernilai 1
$c = mysql_fetch_array($cek);
$_SESSION['nama'] = $c['nama'];
$_SESSION['id_aksi'] = $c['id_aksi'];
if($c['id_aksi']==$c['id_aksi']){
header($_SESSION['aksi.url']);
}else{
die("password salah <a href=\"javascript:history.back()\">kembali</a>");
}
}
}else if($op=="out"){
unset($_SESSION['nama']);
header("location:index.php");
}
?>
</fieldset>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<div class="clear"></div>
<footer>
</footer>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
<!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>English Lesson Of Grammar</title>
<link href="css/rheyank_style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">
/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<script type="text/javascript">
ddsmoothmenu.init({
mainmenuid: "menu", //menu DIV id
orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu', //class added to menu's outer DIV
//customtheme: ["#1c5a80", "#18374a"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})
</script>
<style type="text/css">
<!--
.style1 {color: #75a62c}
.style2 {
color: #333;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div id="body">
<div id="header"></div>
<!-- end of header -->
<div id="menu" class="ddsmoothmenu">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="grammar.php">Grammar</a></li>
<li><a href="soal.php" class="selected">Excercise</a></li>
<li><a href="about.php">About</a></li>
</ul>
<br style="clear: left" />
</div> <!-- end of menu -->
<div id="main">
<h2>Masukan Data Diri Anda !!! </h2>
<div class="col_2 float_l">
<br class="cleaner h20" />
<div id="data_form">
<form method="post" name="data" action="simpan.php">
<label for="nis">NIS</label> <input type="text" id="nis" name="nis" class="input" />
<div class="cleaner h10"></div>
<label for="nama">Nama</label> <input type="text" id="nama" name="nama" class="input" />
<div class="cleaner h10"></div>
<label for="kelas">Kelas</label> <input type="text" name="kelas" id="kelas" class="input" />
<div class="cleaner h10"></div>
<input type="submit" value="Daftar" id="submit" name="submit" class="submit_btn float_l" />
<input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" />
</form>
</div>
</div>
<div class="col_2 float_l">
<h4 class="style1">Petunjuk ..</h4>
<p align="justify">Sebelum anda mangerjakan soal latihan, Anda diharuskan untuk mengisi data diri anda pada form yang ada disebelah kiri tersebut. Setelah itu tekan <span class="style2">"Daftar"</span>. Maka anda akan menuju ke soal latihan yang tersedia. </p>
<p align="justify">Jika anda sudah terdaftar, silakan tekan <span class="style2">"Lanjut"</span> untuk menuju soal latihan yang sudah tersedia.</p>
<p align="justify">Soal ini terdiri dari <span class="style2">20 soal pilihan ganda dan 5 soal esai</span>.</p>
<p align="justify">Selamat mengerjakan !!! </p>
<div class="cleaner h10"></div>
<a href="#" class="more">Lanjut</a>
</div>
<br class="cleaner" />
</div> <!-- end of main -->
<div id="footer">
<div class="footer_social_button">
<a href="#"><img src="images/facebook-32x32.png" title="facebook" alt="facebook" /></a>
<a href="#"><img src="images/flickr-32x32.png" title="flickr" alt="flickr" /></a>
<a href="#"><img src="images/twitter-32x32.png" title="twitter" alt="twitter" /></a>
<a href="#"><img src="images/youtube-32x32.png" title="youtube" alt="youtube" /></a>
<a href="#"><img src="images/rss-32x32.png" title="rss" alt="rss" /></a>
</div>
</div>
<div class="cleaner"></div>
</div> <!-- end of footer -->
<div id="cr_bar_wrapper">
<div id="cr_bar">
Copyright © 2013 Designed by <a href="http://www.facebook.com/rheyank.iwan">Rheyank Iwan</a> </div>
</div>
</body>
</html>
<?
//Cek Tombol
if ($_POST){
//Kirimkan Variabel
$nis = $_POST['nis'];
$nama = $_POST['nama'];
$kelas = $_POST['kelas'];
//validasi data jika nama dan pesan kosong
if (empty($_POST['nis'])|| empty($_POST['nama'])|| empty($_POST['kelas']))
{
?>
<script language="JavaScript">
alert('Data Harap Dilengkapi');
document.location='input.php';
</script>
<?
}
//Jika Validasi Terpenuhi
else
{
//Memanggil File Koneksi Database
$qlname = "root"; // username
$qlpass = "12345"; // password
$qlserver = "localhost"; // server
$qldbase = "english"; // database name
//Masukan data ke Table siswa
$tambah="INSERT INTO siswa VALUES('$nis','$nama','$kelas')";
$query_tambah=mysql_db_query($db,$tambah,$conn_db);
if ($query_tambah)
{
//Jika Sukses
//echo "Data telah diinput";
?>
<script language="JavaScript">
alert('Data Berhasil diinput');
document.location='soal.php';
</script>
<?
}
else
{
//Jika Gagal
//echo "Data gagal diinput, Silakan Ulangi";
}
}
}
?>
<script language="JavaScript">
alert('Data Gagal diinput,, Silakan ulangi');
document.location='input.php';
</script>