<?php 

require('../../../wp-blog-header.php');

global $wpdb, $table_subs, $table_builder, $table_info;

$id = mysql_real_escape_string($_GET['id']);

$myrows = $wpdb->get_results( "SELECT * FROM $table_builder WHERE id=$id", "ARRAY_A" );
$con = stripslashes($myrows[0]['con']);
$con = json_decode($con, 1);

$table_info = $wpdb->prefix . "formcraft_info";


if ( (!is_user_logged_in() || $_GET['preview']!=true) )
{

	if (!$con[0]['formpage']=='1')
	{
		exit;
	}
}

?>


<!DOCTYPE html>


<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<meta name="viewport" content="width=device-width" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">	
	<title><?php echo $myrows[0]['name']; ?></title>
	<link rel="profile" href="http://gmpg.org/xfn/11" />
	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
	<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php 

wp_head();

?>

</head>



<body>

	<?php 


	$image = $con[0]['formpage_image'];

	if ($image)
	{
		echo "<img class='logo_form' src='".$image."' style='margin: auto auto; display: block'/><br><br>";
	}
	else
	{
		echo '<br>';
	}
	
	$id = mysql_real_escape_string($_GET['id']);
	formcraft($id);

	do_action('wp_head');

	?>
	<br><br>
	<style>
		body {
			background-color: #fbfbfb;
		}
		.nform
		{
			margin-right: auto;
			margin-left: auto;
			box-shadow: 0px 1px 2px #999 !important;
			-moz-box-shadow: 0px 1px 2px #999 !important;
			-webkit-box-shadow: 0px 1px 2px #999 !important;
			border: 0px !important;
		}
	</style>
</body>
</html>