<?php
/** ensure this file is being included by a parent file */
defined( '_VALID_' ) or die( 'Direct Access to this location is not allowed.' );

if(!($result_permission['p2_bookobec']==1)){
echo "<div align='center' class='tagline2'>";
echo "<br>";
echo "คุณไม่ได้รับสิทธิ์ส่งหนังสือไป สพฐ.";
echo "</div>";
exit();
}

$sql = "select * from system_sync_code";
$dbquery = mysqli_query($connect,$sql);
$result = mysqli_fetch_array($dbquery);
$sync_code2=md5($result['sync_code']);

if(isset($_GET['from_register'])){
		$sql_register="select * from bookregister_send where ms_id='$_GET[id]' "; 
		$dbquery_register = mysqli_query($connect,$sql_register);
		$result_ref = mysqli_fetch_array($dbquery_register);
		
echo "<iframe src='http://smart.obec.go.th/modules/book/xml/send_bookobec.php?office_code= $result[office_code]&sync_code2=$sync_code2&person=$_SESSION[login_user_id]&book_no=$result_ref[book_no]&subject=$result_ref[subject]&sign_date=$result_ref[signdate]' height='500' width='100%'></iframe>";
}
else{
echo "<iframe src='http://smart.obec.go.th/modules/book/xml/send_bookobec.php?office_code= $result[office_code]&sync_code2=$sync_code2&person=$_SESSION[login_user_id]' height='500' width='100%'></iframe>";
}
?>