<?php
if (!defined("root")) {
	define("root", $_SERVER['DOCUMENT_ROOT']);
}
session_start();
require(root."/_common.php");
require(root."/_lib/db.php");
require(root."/_lib/main.php");
$rs=array();
if (!empty($_POST)) {
	$ia = cekpost(cleanQuery($_POST["ia"]), "");
	$it = cekpost(cleanQuery($_POST["it"]), "");
	$sw = " no2d!='' AND no3d='' AND no4d='' ";
	if ($ia!="") { $sw .= " AND no2d LIKE '%$ia%'"; }
	if ($it!="") { $sw .= " AND mimpi LIKE '%$it%'"; }
	$q = "SELECT * FROM mimpi WHERE $sw";
	callRS($rs, $q);
}

require(root."/_tpl/html_begin.php");
require(root."/_tpl/tag_head.php");
require(root."/_tpl/ie_style_exception.php");
/*
 * begin
 * additional style
 * */
cout('<style type="text/css">');
cout('');
cout('</style>');
/*
 * end
 * additional style
 * 
 * v
 * v
 * closing tag head
 * 
 * */
require(root."/_tpl/body_open.php");

cout('<div class="section">');
	cout('<div class="helper">');
		cout('<div class="page-title"><img src="/img/_title_buku-mimpi.png" alt="Buku Mimpi" /></div>');
		cout('<div class="filter">
			<form id="fm" method="post" action="">
				<input type="hidden" name="" id="" value="1" />
				<div class="fields" style="width:220px;">
					<div class="label">Angka</div>
					<div class="field"><input type="text" name="ia" id="ia" placeholder="Masukkan Angka" value="'.$ia.'" /></div>
				</div>
				<div class="fields" style="width:520px;">
					<div class="label">Keyword</div>
					<div class="field"><input type="text" name="it" id="it" placeholder="Masukkan Kata Yang Ingin Dicari" value="'.$it.'" /></div>
				</div>
				<div class="sep"></div>
				<div class="fields">
					<a class="submit" href="#" onclick="$(\'#fm\').submit();return false;">SEARCH &gt;&gt;</a>
					<input type="submit" style="display:none" />
				</div>
			</form>
		</div>');
		cout('
		<table class="tdata">
			<thead>
				<tr>
					<th>Type</th>
					<th class="sep"><div></div></th>
					<th>Nomor</th>
					<th class="sep"><div></div></th>
					<th>Mimpi</th>
				</tr>
			</thead>
			<tbody>');
			if (count($rs)!=0) {
				for ($i=0;$i<count($rs);$i++) {
					$cc = $i%2==0?'reve':'rodd';
					cout('<tr class="'.$cc.'">
						<td class="mid w20">2 A</td>
						<td class="sep"><div></div></td>
						<td>'.$rs[$i]["no2d"].'</td>
						<td class="sep"><div></div></td>
						<td>'.$rs[$i]["mimpi"].'</td>
					</tr>
					<tr class="sep"><td colspan="5"></td></tr>');
				}
			} else {
				cout('<tr class="rodd"><td colspan="5"><em>No data available</em></td></tr>');
			}
			cout('
			</tbody>
		</table>
		');
	cout('</div>');
cout('</div>');

require(root."/_tpl/body_close.php");
?>