<!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>
<!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></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">
<div class="col_l">
<h2>Exercise</h2>
<?php
// DATABASE
$qlname = "root"; // username
$qlpass = "12345"; // password
$qlserver = "localhost"; // server
$qldbase = "english"; // database name
// jumlah soal yang ditampilkan
$jml = 5;
mysql_connect($qlserver,$qlname,$qlpass);
$conn = mysql_select_db($qldbase);
if(!$conn)
{
echo 'Can\'t find database, maybe server down .....';
exit;
}
if($_POST['user']=="jawab")
{
for($i=1; $i<=$jml; $i++)
{
$ns = $_POST["s_".$i.""];
$jb = $_POST["j_".$i.""];
$jwb = mysql_query("select * from soal where id='".$ns."' and jbenar='".$jb."'");
if(mysql_num_rows($jwb)==0)
{
$nilai[$i] = 0;
if($jb)
echo 'Jawaban Soal No. '.$i.' - '.$jb.' : <FONT COLOR="red">SALAH</FONT><BR>';
else
echo 'Tidak menjawab soal nomor '.$i.'<br>';
}
else
{
$nilai[$i] = 1;
if($jb)
echo 'Jawaban Soal No. '.$i.' - '.$jb.' : BENAR<BR>';
// Tempat masukkan jawaban dalam database
// Tempat masukkan jawaban dalam database end
}
}
// REKAP NILAI
$nbenar = array_sum($nilai);
$nsalah = $jml-$nbenar;
$ntotal = number_format($nbenar/$jml*100,1);
if($nbenar>0)
{
echo '<br>Rekap Nilai:<br>';
echo '- Jawaban benar : '.$nbenar.' soal<br>';
echo '- Jawaban salah : '.$nsalah.' soal<br>';
// KATEGORI
// Jenius = >=90
// Pintar = 80 - 90
// Sedang = 70 - 80
// Bodoh = 60 - 70
// Sangat Bodoh = < 60
if($ntotal>=90)
$k = 'Jenius';
elseif($ntotal>=80 && $ntotal<90)
$k = 'Pintar';
elseif($ntotal>=70 && $ntotal<80)
$k = 'Sedang';
elseif($ntotal>=60 && $ntotal<70)
$k = '<FONT COLOR="red">Bodoh</FONT>';
else
$k = '<FONT COLOR="red">Sangat Bodoh</FONT>';
// KATEGORI END
echo '- Nilai Total : '.$ntotal.' dari 100 dan Anda termasuk <B><U>'.$k.'</U></B><br>';
}
echo '<br \><A HREF="'.$_PPHP['SELF'].'">Kembali ke soal</A><br \>';
}
else
{
echo '<FORM METHOD="POST" ACTION="">
<INPUT TYPE="hidden" NAME="user" value="jawab">';
echo '<B>Jawablah soal-soal dibawah ini dengan benar</B>';
echo '<OL>';
$sx = mysql_query("SELECT * FROM soal ORDER BY RAND() LIMIT $jml");
$no = 1;
while($x=mysql_fetch_array($sx))
{
echo '<INPUT TYPE="hidden" NAME="s_'.$no.'" value="'.$x[id].'">';
echo '<LI>'.$x[soal].'<br>';
// pilihan
echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j1].'">'. $x[j1].' ';
echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j2].'">'. $x[j2].' ';
echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j3].'">'. $x[j3].' ';
echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j4].'">'. $x[j4].' ';
echo'</LI>';
$no++;
}
echo '</OL>';
echo '<INPUT TYPE="submit" class="more" value="Jawab Soal">
</FORM>';
}
?>
<div class="cleaner h20"></div>
<a href="#" class="more">More</a>
<br class="cleaner" />
</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>